/*
 * PREP-HABILITATION.FR — Design System
 * Palette : Navy #0f172a + Ambre électrique #f59e0b
 */

/* ============================================================
   1. VARIABLES
   ============================================================ */
:root {
    /* Couleurs principales */
    --primary:        #0f172a;   /* navy profond */
    --primary-light:  #1e293b;   /* navy clair */
    --accent:         #f59e0b;   /* jaune électrique */
    --accent-dark:    #d97706;   /* ambre foncé */
    --accent-light:   #fef3c7;   /* ambre pâle */
    --blue:           #1d4ed8;   /* bleu confiance */
    --blue-light:     #3b82f6;

    /* Sémantiques */
    --success:        #16a34a;
    --success-light:  #dcfce7;
    --danger:         #dc2626;
    --danger-light:   #fee2e2;
    --warning:        #f59e0b;
    --warning-light:  #fef3c7;
    --info:           #0891b2;
    --info-light:     #cffafe;

    /* Gris */
    --gray-50:   #f8fafc;
    --gray-100:  #f1f5f9;
    --gray-200:  #e2e8f0;
    --gray-300:  #cbd5e1;
    --gray-400:  #94a3b8;
    --gray-500:  #64748b;
    --gray-600:  #475569;
    --gray-700:  #334155;
    --gray-800:  #1e293b;
    --gray-900:  #0f172a;

    /* Texte */
    --text:       #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Fond */
    --bg:         #f8fafc;
    --bg-white:   #ffffff;
    --border:     #e2e8f0;

    /* Rayons */
    --radius-sm:  4px;
    --radius:     8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-2xl: 24px;

    /* Ombres */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:     0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.1),  0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl:  0 16px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);

    /* Typographie */
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover { color: var(--blue-light); }

img { max-width: 100%; height: auto; }

/* ============================================================
   3. LAYOUT
   ============================================================ */
.container-site {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   4. TYPOGRAPHIE
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--primary);
    margin-top: 0;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-muted  { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }

/* ============================================================
   5. HEADER
   ============================================================ */
.site-header {
    background: var(--primary);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 24px;
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.site-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 900;
    flex-shrink: 0;
}
.site-logo .logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.site-logo .logo-text span {
    color: var(--accent);
}
.site-logo:hover .logo-text { color: #fff; }

/* Nav */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav a {
    color: var(--gray-300);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius);
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.site-nav a.active {
    color: var(--accent);
}

/* Burger mobile */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    color: #fff;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

@media (max-width: 640px) {
    .nav-toggle { display: flex; }
    .site-nav {
        display: none;
        position: absolute;
        top: 67px;
        left: 0; right: 0;
        background: var(--primary-light);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 16px 16px;
        border-bottom: 3px solid var(--accent);
        box-shadow: var(--shadow-lg);
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 12px 16px; border-radius: var(--radius); }
}

/* ============================================================
   6. FOOTER
   ============================================================ */
.site-footer {
    background: var(--primary);
    color: var(--gray-400);
    padding: 48px 0 24px;
    margin-top: 80px;
    border-top: 3px solid var(--accent);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
}

.footer-col h4 {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.footer-col a {
    color: var(--gray-400);
    font-size: 0.875rem;
    transition: color 0.15s;
}
.footer-col a:hover { color: var(--accent); }
.footer-col p {
    font-size: 0.875rem;
    line-height: 1.7;
    margin: 0;
    color: var(--gray-400);
}

.footer-disclaimer {
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-bottom: 32px;
    line-height: 1.6;
}
.footer-disclaimer strong { color: var(--accent); }

.footer-bottom {
    border-top: 1px solid var(--gray-700);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
}
.footer-bottom a { color: var(--gray-500); }
.footer-bottom a:hover { color: var(--gray-300); }

/* ============================================================
   7. BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 22px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary);
}
.btn-primary:hover {
    background: var(--accent-dark);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}

.btn-secondary {
    background: transparent;
    color: var(--gray-600);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--text);
}

.btn-dark {
    background: var(--primary);
    color: #fff;
}
.btn-dark:hover {
    background: var(--primary-light);
    color: #fff;
    transform: translateY(-1px);
}

.btn-lg {
    font-size: 1rem;
    padding: 14px 28px;
    border-radius: var(--radius-lg);
}
.btn-sm {
    font-size: 0.8rem;
    padding: 6px 14px;
}
.btn-w100 { width: 100%; }

/* ============================================================
   8. CARTES
   ============================================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-body { padding: 24px; }
.card-body-sm { padding: 16px; }

/* ============================================================
   9. BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-accent  { background: var(--accent-light); color: var(--accent-dark); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }

/* ============================================================
   10. FORMULAIRES
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}
.form-required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: var(--font-sans);
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.form-control::placeholder { color: var(--gray-400); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

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

/* ============================================================
   11. ALERTES
   ============================================================ */
.alert {
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 0.9rem;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-left: 4px solid;
}
.alert-success { background: var(--success-light); border-color: var(--success); color: #14532d; }
.alert-danger   { background: var(--danger-light);  border-color: var(--danger);  color: #7f1d1d; }
.alert-warning  { background: var(--warning-light); border-color: var(--warning); color: #78350f; }
.alert-info     { background: var(--info-light);    border-color: var(--info);    color: #164e63; }

/* ============================================================
   12. HERO (index)
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 100%);
    color: #fff;
    padding: 72px 0 80px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23f59e0b' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 1;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.15;
}
.hero h1 span { color: var(--accent); }
.hero p {
    color: var(--gray-300);
    font-size: 1.1rem;
    margin-bottom: 32px;
    max-width: 600px;
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .hero { padding: 48px 0 56px; }
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 1rem; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
}

/* ============================================================
   13. HABILITATION CARDS (index)
   ============================================================ */
.habilitation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.habilitation-card {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.habilitation-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.2s;
    transform-origin: left;
}
.habilitation-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: inherit;
}
.habilitation-card:hover::before { transform: scaleX(1); }

.habilitation-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.habilitation-code {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    font-family: var(--font-mono);
    line-height: 1;
}
.habilitation-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
    flex: 1;
}
.habilitation-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.habilitation-card-footer .start-link {
    color: var(--accent-dark);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Couleur par tension */
.habilitation-card.bt  { --card-color: #1d4ed8; }
.habilitation-card.ht  { --card-color: #dc2626; }
.habilitation-card.bt .habilitation-code  { color: #1d4ed8; }
.habilitation-card.ht .habilitation-code  { color: #dc2626; }

/* ============================================================
   14. SECTIONS
   ============================================================ */
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.section-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}
.section-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 40px;
}

/* ============================================================
   15. BARRE DE PROGRESSION QUIZ
   ============================================================ */
.quiz-progress-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 24px;
}
.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ============================================================
   16. TIMER
   ============================================================ */
.quiz-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: 99px;
    padding: 5px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-mono);
}
@keyframes timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
.timer-critical { animation: timer-pulse 0.8s infinite; }

/* ============================================================
   17. OPTIONS QCM
   ============================================================ */
.quiz-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 10px;
}
.quiz-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.quiz-option input[type="checkbox"],
.quiz-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: #14532d;
}
.quiz-option.wrong {
    border-color: var(--danger);
    background: var(--danger-light);
    color: #7f1d1d;
}

/* ============================================================
   18. SCORE CIRCLE
   ============================================================ */
.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    margin: 0 auto 24px;
    box-shadow: var(--shadow-xl);
    border: 4px solid rgba(255,255,255,0.2);
}
.score-circle .score-num {
    font-size: 2.5rem;
    line-height: 1;
    color: #fff;
}
.score-circle .score-denom {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}
.score-circle.excellent { background: linear-gradient(135deg, #16a34a, #15803d); }
.score-circle.good      { background: linear-gradient(135deg, #d97706, #b45309); }
.score-circle.poor      { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ============================================================
   19. UTILITAIRES
   ============================================================ */
.d-none     { display: none !important; }
.d-flex     { display: flex !important; }
.d-grid     { display: grid !important; }
.d-block    { display: block !important; }
.flex-col   { flex-direction: column !important; }
.items-center  { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-2  { gap: 8px !important; }
.gap-3  { gap: 12px !important; }
.gap-4  { gap: 16px !important; }
.gap-5  { gap: 20px !important; }
.w-100  { width: 100% !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }
.mt-0  { margin-top: 0 !important; }
.mt-2  { margin-top: 8px !important; }
.mt-3  { margin-top: 12px !important; }
.mt-4  { margin-top: 16px !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-2  { margin-bottom: 8px !important; }
.mb-3  { margin-bottom: 12px !important; }
.mb-4  { margin-bottom: 16px !important; }
.mb-6  { margin-bottom: 24px !important; }
.p-0   { padding: 0 !important; }
.fw-bold { font-weight: 700 !important; }
.fs-sm  { font-size: 0.875rem !important; }
.fs-xs  { font-size: 0.8rem !important; }

/* ============================================================
   20. RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .section { padding: 40px 0; }
    .habilitation-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}
