/* ===================================
   FORMALEO - Styles
   =================================== */

:root {
    /* === CHARTE FORMALEO === */
    --bleu-nuit: #053e8b;         /* Bleu royal FORMALEO (logo) */
    --bleu-nuit-light: #0b55c4;   /* Bleu moyen */
    --bleu-cerulean: #1a6bc9;     /* Bleu interactif (focus, actif) */
    --primary: #053e8b;           /* Couleur principale (tabs, badges) */
    --primary-light: #ddeaf7;     /* Fond bleu clair */
    --ocre-jaune: #f68712;        /* Orange FORMALEO */
    --ocre-dark: #e0720a;         /* Orange foncé (hover) */
    --white: #ffffff;
    --gris-light: #f5f7fa;
    --gris-border: #e0e4eb;
    --gris-text: #4a5568;
    --text-muted: #9ca3af;
    --vert: #2d7a3a;
    --vert-light: #e8f5e9;
    --rouge: #c0392b;
    --rouge-light: #fdecea;
    --orange: #f68712;            /* Orange FORMALEO (même que ocre-jaune) */
    --orange-light: #fff3e0;      /* Fond orange clair */
    --sidebar-width: 220px;
    --navbar-height: 60px;
    --shadow: 0 2px 8px rgba(5,62,139,0.12);
    --shadow-md: 0 4px 16px rgba(5,62,139,0.18);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    background: var(--gris-light);
    color: var(--gris-text);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== LOGIN ===== */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bleu-nuit) 0%, var(--bleu-cerulean) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: inline-block;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.logo {
    max-height: 70px;
    margin-bottom: 10px;
}

.brand-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--bleu-nuit);
    text-transform: uppercase;
}

.brand-title span { color: var(--bleu-cerulean); }

.login-subtitle {
    text-align: center;
    color: var(--gris-text);
    margin-bottom: 24px;
    font-size: 13px;
}

.login-tabs {
    display: flex;
    border-bottom: 2px solid var(--gris-border);
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-text);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.login-tab.active {
    color: var(--bleu-cerulean);
    border-bottom-color: var(--bleu-cerulean);
}

.login-form { display: none; }
.login-form.active { display: block; }

.info-box {
    background: var(--primary-light);
    border-left: 4px solid var(--bleu-cerulean);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--bleu-nuit);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: var(--bleu-nuit);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gris-border);
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: var(--gris-text);
    background: white;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--bleu-cerulean);
    box-shadow: 0 0 0 3px rgba(29,112,183,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    max-width: 500px;
}

/* ===== BOUTONS ===== */
.btn-primary {
    background: var(--orange);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--ocre-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: var(--gris-light);
    color: var(--bleu-nuit);
    border: 1.5px solid var(--gris-border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover { background: var(--gris-border); }

.btn-danger {
    background: var(--rouge);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

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

.btn-full { width: 100%; }

.btn-logout {
    background: transparent;
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bleu-nuit);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    height: 52px;
    width: auto;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
}

.nav-logo { height: 32px; }

.nav-title {
    font-weight: 800;
    font-size: 16px;
    color: white;
    letter-spacing: 0.5px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-username {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 600;
}

.nav-role-badge {
    background: var(--ocre-jaune);
    color: var(--bleu-nuit);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-page {
    display: none;
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.dashboard-page.active { display: flex; }

.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: white;
    border-right: 1px solid var(--gris-border);
    padding: 16px 0;
    flex-shrink: 0;
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    overflow-y: auto;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-text);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-btn:hover { background: var(--gris-light); color: var(--bleu-nuit); }
.sidebar-btn.active {
    background: var(--primary-light);
    color: var(--bleu-cerulean);
    border-left-color: var(--bleu-cerulean);
}

.sidebar-btn .icon { font-size: 16px; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
}

.section-content { display: none; }
.section-content.active { display: block; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--bleu-nuit);
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gris-border);
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--bleu-nuit);
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 12px;
    color: var(--gris-text);
    margin-bottom: 12px;
}

.card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-blue { background: var(--primary-light); color: var(--bleu-cerulean); }
.badge-green { background: var(--vert-light); color: var(--vert); }
.badge-red { background: var(--rouge-light); color: var(--rouge); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-gold { background: #fef9e7; color: var(--ocre-dark); }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* Badges disponibilité intérimaire */
.badge-worker-available   { background: #d1fae5; color: #065f46; }
.badge-worker-on_mission  { background: #fef3c7; color: #92400e; }
.badge-worker-unavailable { background: #fee2e2; color: #991b1b; }

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.token-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ocre-jaune);
    color: var(--bleu-nuit);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 12px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: var(--bleu-nuit);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}
th.sortable:hover {
    background: #1a2d5a;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gris-border);
    font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gris-light); }

.score-cell {
    font-weight: 700;
    font-size: 14px;
}

.score-pass { color: var(--vert); }
.score-fail { color: var(--rouge); }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    margin-left: auto;
    padding: 5px 14px;
    border: 1.5px solid var(--gris-border);
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    min-width: 230px;
    outline: none;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-dark);
}
.search-input:focus {
    border-color: var(--bleu-cerulean);
    box-shadow: 0 0 0 3px rgba(30, 100, 200, 0.08);
}
.search-input::placeholder {
    color: #aab;
    font-weight: 400;
}

/* ===== CHECKBOX GROUP (habilitations stagiaire) ===== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: #f8f9ff;
    border: 1.5px solid var(--gris-border);
    border-radius: 8px;
    min-height: 44px;
    align-items: center;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border: 1.5px solid var(--gris-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.checkbox-group label:hover {
    border-color: var(--bleu-cerulean);
    background: #eef3ff;
}
.checkbox-group input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--bleu-cerulean);
    cursor: pointer;
}
.checkbox-group label:has(input:checked) {
    border-color: var(--bleu-cerulean);
    background: #e8f0fb;
    color: var(--bleu-cerulean);
    font-weight: 600;
}

.filter-btn {
    padding: 6px 16px;
    border: 1.5px solid var(--gris-border);
    border-radius: 20px;
    background: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--bleu-cerulean);
    color: white;
    border-color: var(--bleu-cerulean);
}

/* ===== QUIZ PAGE ===== */
.quiz-wrapper {
    min-height: 100vh;
    background: var(--gris-light);
    display: flex;
    flex-direction: column;
    padding-top: var(--navbar-height);
}

.quiz-header-bar {
    background: white;
    padding: 16px 32px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.quiz-info h2 {
    font-size: 16px;
    color: var(--bleu-nuit);
    font-weight: 700;
}

.habilitation-badge {
    background: var(--bleu-cerulean);
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.quiz-progress-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-text);
}

.progress-bar-container {
    width: 200px;
    height: 8px;
    background: var(--gris-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bleu-cerulean), var(--ocre-jaune));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quiz-body {
    flex: 1;
    padding: 32px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.question-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 700px;
    width: 100%;
    box-shadow: var(--shadow);
}

.question-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--bleu-nuit);
    margin-bottom: 24px;
    line-height: 1.5;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    padding: 14px 18px;
    border: 2px solid var(--gris-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.answer-option:hover {
    border-color: var(--bleu-cerulean);
    background: var(--primary-light);
}

.answer-option.selected {
    border-color: var(--bleu-cerulean);
    background: var(--primary-light);
    color: var(--bleu-nuit);
    font-weight: 700;
}

.answer-option .answer-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gris-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.answer-option.selected .answer-letter {
    background: var(--bleu-cerulean);
    color: white;
}

/* ── Timer quiz ──────────────────────────────────────────────────────────── */
.quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #4b5563;
    background: #f3f4f6;
    padding: 5px 14px;
    border-radius: 20px;
    transition: color .3s, background .3s;
    white-space: nowrap;
}
.quiz-timer--warning {
    color: #92400e;
    background: #fef3c7;
}
.quiz-timer--danger {
    color: #dc2626;
    background: #fee2e2;
    animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

.quiz-footer {
    background: white;
    padding: 16px 32px;
    box-shadow: 0 -2px 8px rgba(16,44,104,0.08);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-submit {
    background: var(--vert);
}

.btn-submit:hover { background: #1e5c28; }

/* ===== RESULTS PAGE ===== */
.results-wrapper {
    min-height: 100vh;
    padding-top: var(--navbar-height);
    background: var(--gris-light);
}

.results-header {
    background: var(--bleu-nuit);
    padding: 24px 32px;
    color: white;
}

.results-header h2 { font-size: 20px; }
.results-header p { font-size: 14px; opacity: 0.8; margin-top: 4px; }

.score-display {
    background: white;
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: var(--shadow);
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 6px solid var(--gris-border);
}

.score-circle.pass { border-color: var(--vert); }
.score-circle.fail { border-color: var(--rouge); }

.score-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.score-label { font-size: 14px; }

.score-circle.pass .score-value { color: var(--vert); }
.score-circle.fail .score-value { color: var(--rouge); }

.score-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--bleu-nuit);
    margin-bottom: 6px;
}

.score-status {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
}

.score-status.pass { color: var(--vert); }
.score-status.fail { color: var(--rouge); }

.results-detail {
    padding: 24px 32px;
}

.result-item {
    background: white;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--gris-border);
}

.result-item.correct { border-left-color: var(--vert); }
.result-item.incorrect { border-left-color: var(--rouge); }

.result-question {
    font-weight: 700;
    color: var(--bleu-nuit);
    margin-bottom: 8px;
    font-size: 14px;
}

.result-answer {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-answer.user-correct { background: var(--vert-light); color: var(--vert); }
.result-answer.user-wrong { background: var(--rouge-light); color: var(--rouge); }
.result-answer.correct-answer { background: #e8f5e9; color: var(--vert); font-weight: 600; }

.result-explanation {
    font-size: 12px;
    color: var(--bleu-cerulean);
    margin-top: 6px;
    font-style: italic;
}

/* ===== MODALES ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,20,50,0.5);
    z-index: 200;
}

.modal-overlay.active { display: block; }

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow-md);
}

.modal.active { display: block; }
.modal-large { max-width: 600px; }
.modal-xlarge { max-width: 900px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gris-border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--bleu-nuit);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--gris-text);
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover { background: var(--gris-light); }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gris-border);
}

/* ===== MODAL MON COMPTE — ONGLETS ===== */
.acc-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.acc-tab-btn:hover { color: var(--primary); }
.acc-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

#modalClientAccount.active { display: flex !important; }
#modalClientAnalytics.active { display: flex !important; }

/* ===== MODAL PROFIL ADMIN — ONGLETS ===== */
.adm-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.adm-tab-btn:hover { color: var(--primary); }
.adm-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
#modalAdminProfile.active { display: flex !important; }

/* ===== QUESTIONS MANAGER ===== */
.questions-manager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.questions-list-panel, .question-form-panel {
    max-height: 500px;
    overflow-y: auto;
}

.questions-list-panel h4, .question-form-panel h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bleu-nuit);
    margin-bottom: 12px;
    font-weight: 700;
}

.question-item {
    background: var(--gris-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.question-item-text { flex: 1; font-weight: 500; }

.question-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-icon:hover { background: var(--gris-border); }

.answers-inputs { display: flex; flex-direction: column; gap: 8px; }

.answer-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-input-row input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid var(--gris-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
}

/* ===== TOKEN DISPLAY ===== */
.token-display {
    text-align: center;
    padding: 20px;
}

.token-code {
    font-size: 36px;
    font-weight: 800;
    color: var(--bleu-nuit);
    letter-spacing: 4px;
    background: var(--gris-light);
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
}

.token-password {
    font-size: 24px;
    font-weight: 700;
    color: var(--bleu-cerulean);
    margin-top: 4px;
}

.token-info {
    font-size: 12px;
    color: var(--gris-text);
    margin-top: 12px;
}

/* ===== SESSION DETAIL ===== */
.session-detail-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.session-trainee-row {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--gris-border);
    gap: 12px;
}

.session-trainee-row:last-child { border-bottom: none; }

.trainee-name { flex: 1; font-weight: 600; }

.status-chip {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.status-pending { background: var(--orange-light); color: var(--orange); }
.status-pass { background: var(--vert-light); color: var(--vert); }
.status-fail { background: var(--rouge-light); color: var(--rouge); }

/* ===== LOADING / EMPTY ===== */
.loading-state, .empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gris-text);
}

.loading-state::before {
    content: '⏳';
    display: block;
    font-size: 32px;
    margin-bottom: 12px;
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 32px;
    margin-bottom: 12px;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bleu-nuit);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    max-width: 300px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { background: var(--vert); }
.toast.error { background: var(--rouge); }

/* ===== ERROR MSG ===== */
.error-msg {
    color: var(--rouge);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

/* ===== EXPIRY ALERT ===== */
.expiry-list { display: flex; flex-direction: column; gap: 8px; }

.expiry-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--orange-light);
    border-left: 4px solid var(--orange);
    font-size: 13px;
}

.expiry-item.urgent {
    background: var(--rouge-light);
    border-left-color: var(--rouge);
}

/* ===== INVITE LINK ===== */
.invite-link-box {
    background: var(--gris-light);
    border: 1.5px dashed var(--bleu-cerulean);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
}

.user-no-password {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--orange-light);
    color: var(--orange);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

/* ===== RÉPONSES DYNAMIQUES ===== */
.answer-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.answer-field-row input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--vert);
    flex-shrink: 0;
    cursor: pointer;
}
.answer-field-row .answer-text-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--gris-border);
    border-radius: 6px;
    font-size: 14px;
}
.answer-field-row .answer-text-input:focus {
    border-color: var(--bleu-cerulean);
    outline: none;
}
.answer-field-row .btn-remove-answer {
    background: none;
    border: none;
    color: var(--rouge, #e74c3c);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.answer-field-row .btn-remove-answer:hover { background: #fdecea; }

/* ===== LIGNES TABLEAU CLIQUABLES ===== */
.table-hover tbody tr.clickable-row {
    cursor: pointer;
    transition: background 0.15s;
}
.table-hover tbody tr.clickable-row:hover {
    background: var(--bleu-light, #e8f4fd);
}

/* ===== ÉVALUATION PRATIQUE ===== */
.eval-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--gris-border);
    margin-bottom: 8px;
}
.eval-legend-item {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 2px solid;
}
.eval-legend-item.rating-ts { color: #22a34a; border-color: #22a34a; background: #f0faf4; }
.eval-legend-item.rating-s  { color: #1a7fc1; border-color: #1a7fc1; background: #f0f7ff; }
.eval-legend-item.rating-ps { color: #e07b00; border-color: #e07b00; background: #fff8f0; }
.eval-legend-item.rating-i  { color: #c62828; border-color: #c62828; background: #fff0f0; }

.eval-grid-rows { display: flex; flex-direction: column; }
.eval-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-bottom: 1px solid var(--gris-border);
    transition: background 0.12s;
}
.eval-row:hover { background: var(--gris-light); }
.eval-criterion-text { flex: 1; font-size: 14px; }

.rating-group { display: flex; gap: 6px; flex-shrink: 0; }
.rating-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.15s;
    white-space: nowrap;
    user-select: none;
}
.rating-btn input[type="radio"] { display: none; }
.rating-btn.rating-ts { color: #22a34a; border-color: #22a34a; }
.rating-btn.rating-s  { color: #1a7fc1; border-color: #1a7fc1; }
.rating-btn.rating-ps { color: #e07b00; border-color: #e07b00; }
.rating-btn.rating-i  { color: #c62828; border-color: #c62828; }
.rating-btn.rating-ts:has(input:checked) { background: #22a34a; color: white; }
.rating-btn.rating-s:has(input:checked)  { background: #1a7fc1; color: white; }
.rating-btn.rating-ps:has(input:checked) { background: #e07b00; color: white; }
.rating-btn.rating-i:has(input:checked)  { background: #c62828; color: white; }

.eval-preview { min-height: 40px; }
.eval-result {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}
.eval-result.pass { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.eval-result.fail { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* ===== RESPONSIVE ===== */

/* Hamburger et overlay — cachés par défaut */
.hamburger-btn { display: none; }
.mobile-sidebar-overlay { display: none; }
.mobile-account-icon { display: none; }

/* ─────────────────────────────────────────────────────────
   Tablette ET mobile (≤ 768px) : hamburger + sidebar overlay
   ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* ── Hamburger ── */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 8px;
        background: rgba(255,255,255,0.1);
        border: 1px solid rgba(255,255,255,0.25);
        border-radius: var(--radius-sm);
        cursor: pointer;
        flex-shrink: 0;
    }
    .hamburger-btn span {
        display: block;
        height: 2px;
        background: white;
        border-radius: 2px;
        transition: all 0.25s;
    }
    body.sidebar-open .hamburger-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.sidebar-open .hamburger-btn span:nth-child(2) { opacity: 0; }
    body.sidebar-open .hamburger-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ── Sidebar → overlay slide-in ── */
    .sidebar {
        left: 0;                        /* ancrage explicite */
        transform: translateX(-100%);
        width: 280px;
        z-index: 150;
        transition: transform 0.28s ease;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }

    /* ── Backdrop ── */
    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: var(--navbar-height);
        background: rgba(5,20,60,0.55);
        z-index: 140;
        animation: overlayFadeIn 0.25s ease;
    }
    body.sidebar-open .mobile-sidebar-overlay { display: block; }
    @keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* ── Main content : plus de marge gauche ── */
    .main-content { margin-left: 0; }

    /* ── Grille simple colonne ── */
    .questions-manager { grid-template-columns: 1fr; }
    .form-row          { grid-template-columns: 1fr; }
    .quiz-header-bar   { flex-direction: column; align-items: flex-start; }
    .score-display     { flex-direction: column; align-items: center; text-align: center; }
}

/* ─────────────────────────────────────────────────────────
   Téléphone (≤ 480px) : ajustements d'interface supplémentaires
   ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {

    /* ── Navbar ── */
    .navbar      { padding: 0 12px; }
    .navbar-logo { height: 32px; }
    #btnClientAnalytics  { display: none !important; }
    /* Compte : masquer le nom, afficher icône seule */
    #btnClientAccountLabel { display: none !important; }
    .mobile-account-icon   { display: inline; font-size: 16px; }
    #btnClientAccount { padding: 6px 10px !important; }
    .btn-logout { padding: 5px 10px; font-size: 11px; }

    /* ── Main content ── */
    .main-content { padding: 16px 12px; }

    /* ── Section header ── */
    .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .section-header h2 { font-size: 17px; }

    /* ── Cards ── */
    .cards-grid { grid-template-columns: 1fr; }

    /* ── Tables ── */
    .table-container { display: block; -webkit-overflow-scrolling: touch; }
    th, td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

    /* ── Filter bar ── */
    .filter-bar  { flex-wrap: wrap; gap: 6px; }
    .search-input { min-width: 0 !important; width: 100%; margin-left: 0; }

    /* ── Forms ── */
    .form-grid-4, .form-grid-2 { grid-template-columns: 1fr !important; }
    input[type="text"][style*="min-width"],
    div[style*="min-width: 200px"] { min-width: 0 !important; width: 100% !important; }

    /* ── Modales ── */
    .modal {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh;
        overflow-y: auto;
        padding: 16px;
    }
    .modal-xlarge, .modal-large { max-width: 95vw !important; }
    .acc-tab-btn, .adm-tab-btn  { padding: 10px; font-size: 12px; }
    #evalModalBody { max-height: 60vh !important; }

    /* ── Quiz ── */
    .quiz-body     { padding: 12px; }
    .question-card { padding: 16px; }
    .question-text { font-size: 15px; }
    .quiz-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .quiz-footer .btn-secondary,
    .quiz-footer .btn-primary { flex: 1; min-width: 0; text-align: center; }

    /* ── Résultats quiz ── */
    .results-detail { padding: 16px; }

    /* ── Boutons flottants ── */
    #supportBtn  { bottom: 16px !important; right: 16px !important; width: 48px !important; height: 48px !important; font-size: 20px !important; }
    #aiChatBtn   { bottom: 76px !important; right: 16px !important; width: 48px !important; height: 48px !important; font-size: 18px !important; }
    #aiChatPanel { width: calc(100vw - 32px) !important; right: 16px !important; bottom: 136px !important; }

    /* ── Toast ── */
    .toast { right: 12px; left: 12px; bottom: 80px; max-width: none; }

    /* ── Bannière abonnement (inline-styled) ── */
    #subscriptionBanner {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 10px 12px !important;
        font-size: 12px !important;
    }

    /* ── Recherche par compétences (grid inline 300px 1fr) ── */
    #client-search > div[style] { display: flex !important; flex-direction: column !important; }

    /* ── Login ── */
    .login-container { padding: 24px 20px; }

    /* ── E-learning ── */
    #elSlideBody { padding: 16px !important; }

    /* ── Recherche mission agence — layout responsive ── */
    #client-mission > div > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* ══ Recherche de mission agence ══════════════════════════════════════════ */
/* Carte Leaflet — z-index bas pour ne pas passer sur les modales */
#missionMap { z-index: 1; }
/* Sur mobile : forcer la carte à pleine largeur */
@media (max-width: 768px) {
    #missionMap { height: 300px !important; }
}

/* ══════════════════════════════════════════════════════
   V1.04 — Espace Intérimaire
   ══════════════════════════════════════════════════════ */

/* Badges statut demandes */
.badge-pending    { background: #fef9c3; color: #a16207; }
.badge-inprogress { background: #dbeafe; color: #1e40af; }
.badge-done       { background: #dcfce7; color: #15803d; }
.badge-rejected   { background: #fee2e2; color: #b91c1c; }

/* Badge notification rouge (sidebar agence) */
.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: auto;
}

/* Chat bubbles (agence, dans la SPA worker.html) */
.chat-container { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 16px; }
.chat-bubble { max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.chat-bubble.worker { background: #f1f5f9; color: #1e293b; align-self: flex-end; border-radius: 12px 12px 2px 12px; }
.chat-bubble.agency { background: var(--primary); color: white; align-self: flex-start; border-radius: 12px 12px 12px 2px; }
.chat-meta { font-size: 11px; color: #94a3b8; margin-top: 2px; }
