/* ==========================================================================
   CSS SYSTEM - NUTRITION HUMAINE (IAV HASSAN II)
   ========================================================================== */

:root {
    /* Color Palette */
    --primary: #0e6633;        /* IAV Green */
    --primary-light: #168d4a;
    --primary-rgb: 14, 102, 51;
    --secondary: #d32f2f;      /* IAV Red */
    --secondary-light: #ef5350;
    --accent-gold: #c5a059;    /* Sand/Gold */
    --bg-app: #f7f9fa;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #168d4a;
    
    /* Stats Colors */
    --stat-green: #e6f4ea;
    --stat-green-text: #137333;
    --stat-blue: #e8f0fe;
    --stat-blue-text: #1a73e8;
    --stat-gold: #fef7e0;
    --stat-gold-text: #b06000;

    /* Fonts & Radii */
    --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.04), 0 4px 6px -2px rgba(0,0,0,0.02);
    --shadow-glow: 0 0 15px rgba(14, 102, 51, 0.15);
    
    /* Transition */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

/* ==========================================================================
   LAYOUT: HEADER & NAVIGATION
   ========================================================================== */

.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-title-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo-img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.title-details h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.title-details .badge {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    display: inline-block;
    margin-bottom: 0.25rem;
}

.institution-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.app-nav {
    display: flex;
    background-color: var(--bg-app);
    padding: 0.35rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-normal);
}

.nav-btn i {
    width: 16px;
    height: 16px;
}

.nav-btn:hover {
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   LAYOUT: MAIN CONTAINER & COMMON CARDSTYLES
   ========================================================================== */

.main-content {
    max-width: 1440px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Cards & Containers */
.info-card {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.04) 0%, rgba(var(--primary-rgb), 0.01) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.info-icon {
    color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.1);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-icon i {
    width: 24px;
    height: 24px;
}

.info-body h2 {
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
}

.info-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header i {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ==========================================================================
   STUDENT GRID & VIDEO COMPONENT
   ========================================================================== */

.student-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    align-items: start;
}

.video-container-card, .form-container-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-footer {
    padding: 1.5rem;
    background-color: #fafbfc;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.video-footer p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition-normal);
}

.btn i {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-app);
    border-color: var(--text-light);
}

.btn-large {
    padding: 0.9rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-full {
    width: 100%;
    padding: 0.8rem;
}

.btn-icon-only {
    padding: 0.65rem;
    border-radius: var(--radius-md);
}

/* ==========================================================================
   STUDENT FORM COMPONENTS
   ========================================================================== */

#submission-form {
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section:last-of-type {
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.step-num {
    background-color: var(--primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.required {
    color: var(--secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.input-wrapper input:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

/* Error validation states */
.form-group.invalid .input-wrapper input,
.form-group.invalid textarea {
    border-color: var(--secondary);
    background-color: rgba(211, 47, 47, 0.02);
}

.form-group.invalid .error-msg {
    display: block;
}

.error-msg {
    display: none;
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 500;
}

/* Essay layout */
.essay-group {
    margin-top: 1.25rem;
}

.essay-header {
    display: flex;
    justify-content: justify;
    align-items: center;
    justify-content: space-between;
}

.word-counter {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition-fast);
}

/* Progress bar */
.progress-container {
    margin-top: 2rem;
    background-color: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.progress-bar-bg {
    background-color: #e2e8f0;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    background-color: var(--secondary);
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Submit bar */
.submit-container {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================================
   ADMIN LOGIN CARD
   ========================================================================== */

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    max-width: 450px;
    margin: 4rem auto;
    text-align: center;
}

.login-icon {
    width: 64px;
    height: 64px;
    background-color: rgba(211, 47, 47, 0.08);
    color: var(--secondary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.login-icon i {
    width: 28px;
    height: 28px;
}

.login-header h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

#login-form {
    text-align: left;
}

#login-form .form-group {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   ADMIN DASHBOARD LAYOUT & METRICS
   ========================================================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title-group p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Export Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.chevron {
    width: 14px;
    height: 14px;
    margin-left: 0.25rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-card);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    z-index: 10;
    overflow: hidden;
    margin-top: 0.25rem;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.dropdown-content a i {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.dropdown-content a:hover {
    background-color: var(--bg-app);
    color: var(--primary);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 22px;
    height: 22px;
}

.bg-green {
    background-color: var(--stat-green);
    color: var(--stat-green-text);
}

.bg-blue {
    background-color: var(--stat-blue);
    color: var(--stat-blue-text);
}

.bg-gold {
    background-color: var(--stat-gold);
    color: var(--stat-gold-text);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* ==========================================================================
   DASHBOARD SPLIT GRID
   ========================================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    height: 700px;
}

.students-list-panel, .student-detail-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Left panel: student search/list */
.panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--text-light);
    width: 16px;
    height: 16px;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.sort-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.sort-box select {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-primary);
    background-color: white;
    cursor: pointer;
}

.students-list {
    flex: 1;
    overflow-y: auto;
}

/* Student card in list */
.student-card {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.student-card:hover {
    background-color: #fafbfc;
}

.student-card.active {
    background-color: rgba(var(--primary-rgb), 0.04);
    border-left: 4px solid var(--primary);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
}

.student-name-order {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.student-name-order h4 {
    font-size: 0.95rem;
    font-weight: 700;
}

.order-badge {
    background-color: #e2e8f0;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

.submission-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.student-email-row {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.word-count-badge {
    background-color: #edf2f7;
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.75rem;
}

.student-card.active .word-count-badge {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

/* Empty/Loading States */
.empty-state, .detail-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    padding: 3rem 1.5rem;
    height: 100%;
}

.empty-state i, .detail-empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.detail-empty-state {
    padding: 4rem 2rem;
}

.detail-empty-state .big-icon {
    width: 64px;
    height: 64px;
    color: var(--border-color);
    margin-bottom: 1.5rem;
}

.detail-empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.detail-empty-state p {
    max-width: 350px;
    font-size: 0.9rem;
}

/* Right panel: detailed reader */
.student-detail-panel {
    background-color: var(--bg-card);
}

.detail-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.detail-student-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #fafbfc;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
}

.student-initials {
    width: 54px;
    height: 54px;
    background-color: var(--primary);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.student-meta-info {
    flex: 1;
}

.student-meta-info h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.meta-row {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.meta-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.meta-row i {
    width: 14px;
    height: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
}

/* Essay Reader Cards & Tabs */
.essay-reader-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #f1f5f9;
    padding: 1.25rem;
}

.reader-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.reader-tab-btn {
    flex: 1;
    background-color: rgba(226, 232, 240, 0.6);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tab-word-count {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-light);
    margin-top: 0.1rem;
}

.reader-tab-btn:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.reader-tab-btn.active {
    background-color: var(--bg-card);
    color: var(--primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.reader-tab-btn.active .tab-word-count {
    color: var(--primary);
}

.reader-body {
    flex: 1;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    overflow-y: auto;
    /* Styles mimicking real printed page */
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.reader-tab-content {
    display: none;
}

.reader-tab-content.active {
    display: block;
}

.reader-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #334155;
    white-space: pre-wrap; /* Preserve formatting */
    text-align: justify;
}

/* ==========================================================================
   TOASTS, LOADERS & UTILITIES
   ========================================================================== */

.hide {
    display: none !important;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    background-color: var(--bg-card);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.toast.toast-success {
    border-left-color: var(--primary);
}

.toast.toast-error {
    border-left-color: var(--secondary);
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success i {
    color: var(--primary);
}

.toast-error i {
    color: var(--secondary);
}

/* Loading Spin */
.spinner {
    animation: rotate 1s linear infinite;
    width: 16px;
    height: 16px;
}

/* CSS Animations */
@keyframes slideIn {
    from {
        transform: translateY(1rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 1024px) {
    .student-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .students-list-panel {
        height: 400px;
    }

    .student-detail-panel {
        height: 550px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .logo-title-group {
        justify-content: center;
    }

    .app-nav {
        justify-content: center;
    }

    .main-content {
        margin: 1rem auto;
        padding: 0 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

/* ==========================================================================
   PRINT STYLES (For generating clean PDFs)
   ========================================================================== */
@media print {
    body * {
        visibility: hidden;
    }
    
    #detail-content, #detail-content * {
        visibility: visible;
    }
    
    #detail-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto !important;
        overflow: visible !important;
    }

    .header-actions, .reader-tabs, .student-initials {
        display: none !important;
    }

    .reader-body {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow: visible !important;
        max-width: 100% !important;
    }

    .reader-tab-content {
        display: block !important;
        margin-bottom: 2rem;
        page-break-inside: avoid;
    }

    .reader-tab-content::before {
        content: attr(id);
        display: block;
        font-family: var(--font-heading);
        font-size: 1.2rem;
        font-weight: 700;
        border-bottom: 1px solid #000;
        margin-bottom: 1rem;
        text-transform: capitalize;
    }

    #tab-intro::before { content: "1. Introduction"; }
    #tab-dev::before { content: "2. Développement"; }
    #tab-conclusion::before { content: "3. Conclusion"; }
}
