/* ============================================================
   Espace Élève IRDA — Style principal
   Police: Sora (display) + DM Sans (body)
   Thème: Bleu marine profond + Accent orange
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
    --navy:       #021D44;
    --navy-mid:   #0D3272;
    --navy-light: #1A4A96;
    --accent:     #F07B28;
    --accent-2:   #FFAD5A;
    --bg:         #F0F4FA;
    --bg-card:    #FFFFFF;
    --text:       #1C2B4A;
    --text-light: #6B7A99;
    --border:     #DCE4F0;
    --success:    #27AE60;
    --danger:     #E74C3C;
    --warning:    #F39C12;
    --info:       #2980B9;
    --radius:     12px;
    --radius-lg:  20px;
    --shadow-sm:  0 2px 8px rgba(2,29,68,0.08);
    --shadow:     0 6px 24px rgba(2,29,68,0.12);
    --shadow-lg:  0 12px 48px rgba(2,29,68,0.18);
    --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- SIDEBAR ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 44px; height: 44px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    color: white;
    margin-bottom: 10px;
}

.sidebar-logo .logo-text {
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar-logo .logo-sub {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Profil élève dans sidebar */
.sidebar-profile {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--navy-light), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}

.profile-info .name {
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
    line-height: 1.2;
}

.profile-info .mat {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 8px 20px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    text-decoration: none;
    color: rgba(255,255,255,0.6);
    font-size: 0.87rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: white;
    background: rgba(240,123,40,0.15);
    border-left-color: var(--accent);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color var(--transition);
}

.sidebar-footer a:hover { color: var(--accent); }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left h1 {
    font-family: 'Sora', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
}

.topbar-left .breadcrumb {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 1px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ---- PAGE CONTENT ---- */
.page {
    padding: 28px 32px;
    flex: 1;
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: 'Sora', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-info .value {
    font-family: 'Sora', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}

.stat-info .label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 4px;
}

.stat-info .sub {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 4px;
}

/* ---- TABLES ---- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 10px 16px;
    text-align: left;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.87rem;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(2,29,68,0.02); }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-success { background: #D5F5E3; color: #1E8449; }
.badge-danger  { background: #FADBD8; color: #922B21; }
.badge-warning { background: #FDEBD0; color: #9A6F00; }
.badge-info    { background: #D6EAF8; color: #1A5276; }
.badge-gray    { background: #EAECEE; color: #626567; }
.badge-orange  { background: #FEF0E7; color: #C0392B; }

/* ---- NOTE PILL ---- */
.note-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px; height: 32px;
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--text);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--navy-light);
    box-shadow: 0 0 0 3px rgba(26,74,150,0.12);
}

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { cursor: pointer; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.87rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
}

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

.btn-accent {
    background: var(--accent);
    color: white;
}
.btn-accent:hover { background: #d96920; }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy); background: var(--bg); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-success { background: #D5F5E3; color: #1E8449; border: 1px solid #A9DFBF; }
.alert-error   { background: #FADBD8; color: #922B21; border: 1px solid #F5B7B1; }
.alert-info    { background: #D6EAF8; color: #1A5276; border: 1px solid #AED6F1; }
.alert-warning { background: #FDEBD0; color: #9A6F00; border: 1px solid #FAD7A0; }

/* ---- EMPLOI DU TEMPS ---- */
.edt-table th { min-width: 120px; text-align: center; }
.edt-cell {
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.78rem;
    text-align: center;
    margin: 2px;
}
.edt-empty { color: var(--text-light); }

/* ---- PROGRESS BAR ---- */
.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.6s ease;
}

/* ---- DEVOIR CARD ---- */
.devoir-card {
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    background: white;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--transition);
}
.devoir-card:hover { box-shadow: var(--shadow); }
.devoir-card.urgent { border-left-color: var(--danger); }
.devoir-card.rendu  { border-left-color: var(--success); opacity: 0.75; }

/* ---- MESSAGE ---- */
.msg-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    transition: background var(--transition);
}
.msg-item:hover { background: var(--bg); }
.msg-item.unread { background: #EBF3FC; }
.msg-item:last-child { border-bottom: none; }

/* ---- CLASSEMENT ---- */
.podium-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}
.podium-row:last-child { border-bottom: none; }
.rank-badge {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.rank-1 { background: #FFF3CD; color: #856404; border: 2px solid #FFD700; }
.rank-2 { background: #E8E8E8; color: #444; border: 2px solid #C0C0C0; }
.rank-3 { background: #FFE8D6; color: #7D3C00; border: 2px solid #CD7F32; }
.rank-n { background: var(--bg); color: var(--text-light); border: 2px solid var(--border); }
.me-highlight { background: rgba(240,123,40,0.07); }

/* ---- GRIDS ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--navy);
    position: relative;
    overflow: hidden;
}

.login-deco {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 60%, rgba(240,123,40,0.18) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(26,74,150,0.4) 0%, transparent 50%);
    pointer-events: none;
}

.login-left {
    width: 45%;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

/* ---- MOBILE TOGGLE ---- */
.mobile-toggle {
    display: none;
    background: var(--navy);
    color: white;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1.1rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-toggle { display: block; }
    .login-left { display: none; }
    .login-right { width: 100%; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .page { padding: 20px 16px; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .login-box { padding: 32px 24px; }
}

/* ---- UTILS ---- */
.text-navy   { color: var(--navy); }
.text-accent { color: var(--accent); }
.text-light  { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

.fw-bold { font-weight: 700; }
.fw-600  { font-weight: 600; }

.font-sora { font-family: 'Sora', sans-serif; }

.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.flex    { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }

.text-center { text-align: center; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }

.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }

.section-title {
    font-family: 'Sora', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 10px; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2,29,68,0.5);
    z-index: 99;
}
.sidebar-overlay.show { display: block; }
