:root {
    --bg-app: #fdfbf7;
    --bg-panel: #ffffff;
    --bg-input: #f4f1ea;
    --text-primary: #4a4a4a;
    --text-secondary: #8c8c8c;
    --accent-primary: #ff8c69;
    --accent-hover: #e07b5c;
    --accent-text: #ffffff;
    --border-radius: 16px;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
}

body.dark-theme {
    --bg-app: #1a1a1a;
    --bg-panel: #2d2d2d;
    --bg-input: #3d3d3d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-primary: #ff8c69;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: 'Lato', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0; 
}


.portal-container {
    width: 100%;
    margin: auto;
    padding: 20px;
}

.login-container {
    max-width: 420px;
}

.dashboard-container {
    max-width: 1000px; 
}

.nav-container {
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    padding: 0 20px;
}


.card-portal {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
}

.portal-icon {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 15px;
}

.portal-title {
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 1.8rem;
}

.portal-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    background-color: var(--bg-panel);
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 140, 105, 0.1);
}

.btn-portal {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: var(--accent-primary);
    color: white;
    margin-top: 10px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.btn-portal:hover {
    background-color: var(--accent-hover);
}

.btn-portal:active {
    transform: scale(0.98);
}

.portal-navbar {
    background-color: var(--bg-panel);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
    background-color: var(--bg-input);
}

.btn-logout-nav:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.nav-toggle {
    display: none; 
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    
    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--bg-panel);
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        box-shadow: 0 10px 10px rgba(0,0,0,0.05);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    .nav-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-link {
        width: 100%;
        padding: 15px;
        font-size: 1.1rem;
    }
    
    .nav-divider {
        height: 1px;
        background-color: var(--bg-input);
        width: 100%;
        margin: 10px 0;
    }
}


#studentsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
}

.student-card {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.05);
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.student-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 4px solid var(--bg-app);
}


.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 8px 0;
}

.btn-back:hover { color: var(--accent-primary); }

.student-header-card {
    text-align: left;
    margin-bottom: 30px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 30px;
}

.student-avatar-small {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--accent-primary);
    transition: transform 0.1s;
}

.history-item:hover { transform: translateX(5px); }

.history-date {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 10px 15px;
    text-align: center;
    min-width: 70px;
}

.history-date .day {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.history-date .month {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.history-details {
    flex-grow: 1;
}

.badge-status {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
}

.badge-status.success { background: #d1fae5; color: #065f46; }
.badge-status.warning { background: #fef3c7; color: #92400e; }

.theme-toggle-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-panel);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    z-index: 100;
    transition: background 0.3s, color 0.3s;
}

.swal2-popup {
    border-radius: 20px !important;
    font-family: 'Lato', sans-serif !important;
}
.urgent-banner {
    background-color: #fee2e2;
    border-bottom: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
    position: relative;
    animation: slideDown 0.4s ease-out;
    z-index: 900;
}

.urgent-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    max-width: 1000px;
    width: 100%;
    justify-content: space-between;
}

.urgent-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.urgent-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: #7f1d1d;
    text-decoration: underline;
    white-space: nowrap;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.announcement-card {
    background: var(--bg-panel);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.announcement-summary {
    padding: 20px;
    cursor: pointer;
    list-style: none;
    position: relative;
}

.announcement-summary::-webkit-details-marker {
    display: none;
}

.ann-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.ann-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-normal { background: #e0f2fe; color: #075985; }

.ann-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ann-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 5px 0;
}

.ann-preview {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

details[open] .ann-preview {
    display: none;
}

.ann-content {
    padding: 0 20px 20px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    border-top: 1px solid var(--bg-input);
    margin-top: 10px;
    padding-top: 15px;
    white-space: pre-wrap;
}

.expand-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: transform 0.3s;
}

details[open] .expand-icon {
    transform: translateY(-50%) rotate(180deg);
}