/* ── Variables ── */
:root {
    --brand-50:  #ffe5ef;
    --brand-400: #e84d8a;
    --brand-500: #d60055;
    --brand-600: #d60055;
    --brand-700: #b8004a;
    --brand-800: #9a003e;

    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;

    --white: #ffffff;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--brand-700); }

/* ── Navigation ── */
.nav-main {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}
.nav-brand {
    color: var(--gray-800);
    font-weight: 600;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.nav-brand:hover { text-decoration: none; color: var(--gray-800); }

/* Burger button */
.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 110;
    order: -1;
}
.nav-burger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s;
}
.nav-burger.open span {
    background: var(--white);
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav links - desktop */
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: auto;
}
.nav-links a {
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-links a:hover { color: var(--brand-500); text-decoration: none; }
.nav-admin {
    color: var(--brand-500) !important;
    font-weight: 600 !important;
}
.nav-admin:hover { color: var(--brand-700) !important; }
.nav-sep { display: none; }

/* ── Mobile nav ── */
@media (max-width: 768px) {
    .nav-burger { display: flex; }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        background: var(--gray-800);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
        padding: 4.5rem 1.5rem 2rem;
        z-index: 100;
        overflow-y: auto;
    }
    .nav-links.open { display: flex; }

    .nav-links a,
    .nav-links .btn-link {
        color: var(--gray-200);
        display: block;
        padding: 0.75rem 0;
        font-size: 0.9375rem;
    }
    .nav-links a:hover,
    .nav-links .btn-link:hover {
        color: var(--white);
        text-decoration: none;
    }
    .nav-links .nav-admin {
        color: var(--brand-400) !important;
    }
    .nav-links .nav-admin:hover {
        color: var(--brand-50) !important;
    }

    .nav-links li { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
    .nav-links li:last-child { border-bottom: none; }

    .nav-sep {
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
        margin: 0.5rem 0;
        padding: 0 !important;
    }

    /* Overlay behind drawer */
    .nav-links.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        width: calc(100vw - 280px);
        height: 100vh;
        height: 100dvh;
        background: rgba(0, 0, 0, 0.4);
    }
}

/* ── Container ── */
.container { max-width: 72rem; margin: 2rem auto; padding: 0 1rem; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: var(--gray-100); text-decoration: none; }
.btn-primary {
    background: var(--brand-600);
    color: var(--white);
    border-color: var(--brand-600);
}
.btn-primary:hover { background: var(--brand-700); color: var(--white); }
.btn-danger {
    background: #dc2626;
    color: var(--white);
    border-color: #dc2626;
}
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 0.25rem 0.625rem; font-size: 0.8rem; }
.btn-icon { padding: 0.35rem 0.5rem; line-height: 1; }
.btn-icon i { font-size: 0.8rem; }
.actions { white-space: nowrap; }
.actions .inline-form { display: inline; }
.btn-link {
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    padding: 0;
    transition: color 0.15s;
}
.btn-link:hover { color: var(--brand-500); text-decoration: underline; }
.btn-link.nav-admin { color: var(--brand-500) !important; }
.btn-link.nav-admin:hover { color: var(--brand-700) !important; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: 'Outfit', sans-serif;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(214, 0, 85, 0.1);
}
.form-group textarea { resize: vertical; }
.help-text { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.25rem; }
.auth-form {
    max-width: 450px;
    margin: 3rem auto;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.inline-form { display: inline; }

/* ── Tables ── */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table th, .table td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
}
.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}
.table tr:hover { background: var(--gray-50); }

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Progress bar ── */
.progress-bar {
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    height: 24px;
    position: relative;
    overflow: hidden;
    min-width: 120px;
}
.progress-fill {
    background: var(--brand-500);
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.3s;
}
.progress-bar span {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Status colors ── */
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }

/* ── Cours cards ── */
.cours-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.cours-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.cours-card:hover { box-shadow: var(--shadow); }
.cours-card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--gray-800);
}
.cours-card h2 a { color: var(--gray-800); }
.cours-card h2 a:hover { color: var(--brand-500); text-decoration: none; }
.cours-public { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 0.4rem; }

/* ── Dashboard links ── */
.dashboard-links { display: flex; gap: 1rem; margin: 1.5rem 0; }

/* ── Date rows ── */
.date-row { margin-bottom: 0.5rem; }

/* ── Past rows ── */
.row-past { opacity: 0.5; }

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-top: 3rem;
}

/* ── Headings ── */
h1 { margin-bottom: 1rem; color: var(--gray-800); font-weight: 600; font-size: 1.5rem; }
h2 { margin: 1.5rem 0 0.8rem; color: var(--gray-800); font-weight: 600; font-size: 1.25rem; }
h3 { margin: 1rem 0 0.5rem; color: var(--gray-700); font-weight: 600; font-size: 1rem; }
p { margin-bottom: 0.5rem; }

/* ── White card sections ── */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ── Calendar ── */
.cal-container { margin: 1rem 0; }
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.cal-title { font-weight: 600; font-size: 1.125rem; color: var(--gray-800); }
.cal-grid {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    table-layout: fixed;
}
.cal-grid th {
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.cal-cell {
    padding: 0.5rem 0.25rem;
    text-align: center;
    vertical-align: top;
    height: 3.5rem;
    border-bottom: 1px solid var(--gray-100);
    position: relative;
    cursor: default;
}
.cal-day-num { font-size: 0.875rem; font-weight: 500; }
.cal-other-month .cal-day-num { color: var(--gray-300); }
.cal-today {
    background: var(--brand-50);
    font-weight: 700;
}
.cal-today .cal-day-num { color: var(--brand-600); }
.cal-past { opacity: 0.55; }
.cal-has-event { cursor: pointer; }
.cal-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-500);
    margin: 3px auto 0;
}
.cal-has-event:hover { background: var(--gray-100); }
.cal-detail {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}
.cal-detail h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.cal-detail ul { list-style: none; padding: 0; }
.cal-detail li { padding: 0.25rem 0; border-bottom: 1px solid var(--gray-100); }
.cal-detail li:last-child { border-bottom: none; }
.cal-detail-placeholder { color: var(--gray-400); font-style: italic; margin: 0; }

/* Toggle button */
.view-toggle { margin-bottom: 1rem; display: flex; gap: 0.5rem; align-items: center; }

@media (max-width: 375px) {
    .cal-cell { height: 2.5rem; padding: 0.25rem 0.125rem; }
    .cal-day-num { font-size: 0.75rem; }
    .cal-dot { width: 4px; height: 4px; margin-top: 2px; }
    .cal-grid th { font-size: 0.7rem; padding: 0.35rem 0.125rem; }
    .cal-title { font-size: 0.95rem; }
}

/* ── Session cards ── */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}
.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.session-card:hover { box-shadow: var(--shadow); }
.session-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
}
.session-card-meta {
    font-size: 0.825rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}
.session-card .btn { flex-shrink: 0; }

/* ── Responsive tables ── */
@media (max-width: 768px) {
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .container { padding: 0 0.75rem; }
    .cours-list { grid-template-columns: 1fr; }
    .dashboard-links { flex-direction: column; }
}
