/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
    --sidebar-w: 240px;
    --sidebar-bg: #0f172a;
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --page-bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--page-bg);
}

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

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-brand i { color: var(--accent); font-size: 20px; }

.sidebar-section-label {
    padding: 18px 20px 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.22);
}

.sidebar-nav { flex: 1; padding: 6px 0 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 20px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.14s;
    border-left: 3px solid transparent;
}

.nav-link i { width: 15px; text-align: center; font-size: 13px; flex-shrink: 0; }

.nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,0.05); }

.nav-link.active {
    color: #fff;
    background: rgba(59,130,246,0.13);
    border-left-color: var(--accent);
}

.nav-link-danger { color: #f87171 !important; }
.nav-link-danger:hover { color: #fca5a5 !important; background: rgba(239,68,68,0.07) !important; }

.sidebar-footer {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    padding: 32px;
}

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.page-icon {
    width: 44px;
    height: 44px;
    background: rgba(59,130,246,0.1);
    color: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.page-title { font-size: 20px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 9px;
}

.card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.card-title i { color: var(--accent); }
.card-body { padding: 20px; }

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

/* ── SECTION LABEL ─────────────────────────────────────────── */
.section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.14s, box-shadow 0.14s;
    font-family: inherit;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.14s;
    font-family: inherit;
    letter-spacing: 0.01em;
    width: 100%;
}

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

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-dark { background: var(--sidebar-bg); color: #fff; border-color: var(--sidebar-bg); }
.btn-dark:hover { background: #1e293b; border-color: #1e293b; }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
    width: auto;
}

.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 12px; width: auto; }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
    border: none;
}

.alert::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    flex-shrink: 0;
    font-size: 13px;
}

.alert-danger  { background: #fef2f2; color: #dc2626; }
.alert-danger::before  { content: '\f06a'; }
.alert-success { background: #f0fdf4; color: #16a34a; }
.alert-success::before { content: '\f058'; }

/* ── ITEM LIST ─────────────────────────────────────────────── */
.item-list { list-style: none; padding: 0; margin: 0; }

.item-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 6px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.item-list li:last-child { border-bottom: none; }
.item-list li:hover { background: #f8fafc; border-radius: 4px; }

.item-list li::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 9px;
    color: var(--accent);
    flex-shrink: 0;
}

/* ── CATEGORY HEADER ───────────────────────────────────────── */
.cat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 14px;
    margin: 14px 0 5px;
    border-radius: 5px;
}

.cat-header i { color: var(--accent); font-size: 10px; }

/* ── CHECKBOX ROW ──────────────────────────────────────────── */
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 1px;
}

.check-row:hover { background: #f1f5f9; }

.check-row input[type=checkbox] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── WIKI ITEMS ────────────────────────────────────────────── */
.wiki-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.1s;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.wiki-item:hover, .wiki-item.active {
    background: rgba(59,130,246,0.07);
    border-color: rgba(59,130,246,0.15);
    color: var(--accent);
}

.wiki-item i { color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* ── PREPA RESULT ITEM ─────────────────────────────────────── */
.prepa-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 3px;
    background: #f8fafc;
    border: 1px solid var(--border);
    transition: background 0.1s;
}

.prepa-item:hover { background: #f1f5f9; }

.prepa-count {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    color: #cbd5e1;
}

.empty-state p { font-size: 13px; }

/* ── AUTH PAGE ─────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    padding: 32px;
}

.auth-wrapper { width: 100%; max-width: 800px; }

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand i { font-size: 42px; color: var(--accent); }

.auth-brand h1 {
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    margin-top: 12px;
    border: none;
    padding: 0;
    letter-spacing: -0.01em;
}

.auth-brand p { color: #94a3b8; font-size: 14px; margin-top: 6px; }

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}

.auth-card h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: none;
    padding: 0;
    text-transform: none;
    letter-spacing: 0;
}

.auth-card h2 i { color: var(--accent); }

/* ── UTILITIES ─────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gap-10 { gap: 10px; }

/* ── BURGER BUTTON ─────────────────────────────────────────── */
#burger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    box-shadow: var(--shadow-md);
}
#burger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}
#burger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#burger-btn.open span:nth-child(2) { opacity: 0; }
#burger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── SIDEBAR OVERLAY ───────────────────────────────────────── */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0,0,0,0.45);
}
#sidebar-overlay.active { display: block; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .grid-3, .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
    .auth-grid { grid-template-columns: 1fr; }

    #burger-btn { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; padding: 16px; padding-top: 64px; }
    .app-wrapper { flex-direction: column; }
}

/* ── CALENDRIER HEURES ──────────────────────────────────────── */
.input-heure {
    width: 60px;
    text-align: center;
    padding: 4px 6px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}
.input-heure:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.input-saved  { background: #dcfce7 !important; transition: background 0.3s; }
.input-error  { background: #fee2e2 !important; border-color: #dc2626; }

.cal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cal-table th, .cal-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.cal-table th:first-child, .cal-table td:first-child {
    text-align: left;
    min-width: 180px;
}
.cal-table tfoot td { font-weight: 700; background: #f8fafc; }

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    min-width: 320px;
    max-width: 90%;
    box-shadow: var(--shadow-md);
}

/* ── BADGE NOTIFICATIONS ────────────────────────────────────── */
.badge-count {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    margin-left: auto;
}
