/* ===========================
   Variables globales
   =========================== */
:root {
    --layout-max-width: 900px;
    --color-body-bg: radial-gradient(circle at top, #132b4f 0, #050816 55%, #020308 100%);
    --color-body-text: #e5f0ff;
}

/* ===========================
   Reset léger & base globale
   =========================== */

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    line-height: 1.5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--color-body-bg);
    color: var(--color-body-text);
}

/* ===========================
   Conteneur principal
   =========================== */

/* Mobile-first : marges plus petites sur petit écran */
.trainer-container {
    max-width: var(--layout-max-width);
    margin: 1.5rem auto 2.5rem;
    padding: 0 1rem 2.5rem;
}

/* Plus d’air sur tablette/desktop */
@media (min-width: 768px) {
    .trainer-container {
        margin: 3rem auto;
        padding: 0 1.5rem 3rem;
    }
}

/* ===========================
   Hero
   =========================== */

.hero {
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f5fbff;
}

.hero .subtitle {
    max-width: 650px;
    margin: 0.3rem auto 0;
    font-size: 0.95rem;
    color: #b3c4ff;
}

/* Alignement à gauche sur écrans plus larges */
@media (min-width: 768px) {
    .hero {
        text-align: left;
    }

    .hero .subtitle {
        margin-left: 0;
    }
}

/* ===========================
   Cartes
   =========================== */

.card {
    margin-top: 1.5rem;
    padding: 1.25rem 1rem;
    border-radius: 1.25rem;
    background: rgba(8, 18, 40, 0.9);
    box-shadow:
            0 18px 45px rgba(0, 0, 0, 0.8),
            0 0 0 1px rgba(88, 134, 255, 0.15);
    backdrop-filter: blur(10px);
}

@media (min-width: 768px) {
    .card {
        margin-top: 2rem;
        padding: 1.75rem 1.5rem;
    }
}

.question-card {
    margin-top: 1.25rem;
}

/* ===========================
   Titre d'infraction
   =========================== */

.infraction-label {
    font-size: clamp(1.2rem, 2.3vw, 1.6rem);
    margin-bottom: 0.5rem;
    color: #f8fbff;
}

.infraction-instruction {
    margin-bottom: 1.3rem;
    font-size: 0.95rem;
    color: #9fb1ff;
}

/* ===========================
   Boutons & zone de contrôle
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.3rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    transition:
            transform 0.1s ease,
            box-shadow 0.1s ease,
            background 0.2s ease;
}

/* Sur mobile, le bouton principal prend toute la largeur pour être plus facile à cliquer */
.controls .btn {
    width: 100%;
}

@media (min-width: 480px) {
    .controls .btn {
        width: auto;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #f9fbff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.5);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.7);
}

.btn-secondary {
    margin-top: 1rem;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #f9fbff;
}

.btn-secondary:hover {
    transform: translateY(-1px);
}

/* Bouton ghost pour s'intégrer à ton design */
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(148, 163, 255, 0.7);
    color: #c7d2fe;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0.02em;
}

.btn-ghost:hover {
    background: rgba(30, 64, 175, 0.25);
}

/* Conteneur interne de la carte de contrôle (boutons + stats + visites) */
.controls-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Formulaire pour les deux boutons de génération */
.controls-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Stats globales (badges) */
.trainer-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
}

/* Badges stats */
.stat-badge {
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(129, 140, 248, 0.7);
    background: radial-gradient(
            circle at top left,
            rgba(37, 99, 235, 0.35),
            rgba(15, 23, 42, 0.95)
    );
    color: #c7d2fe;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-badge-accent {
    border-color: rgba(52, 211, 153, 0.9);
    background: radial-gradient(
            circle at top left,
            rgba(16, 185, 129, 0.35),
            rgba(6, 78, 59, 0.95)
    );
    color: #bbf7d0;
}

/* ===========================
   Formulaires
   =========================== */

.answer-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e2ebff;
}

.field-group textarea {
    width: 100%;
    min-height: 110px;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(129, 140, 248, 0.4);
    border-radius: 0.85rem;
    background: rgba(10, 20, 40, 0.95);
    color: #e5f0ff;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition:
            border 0.15s ease,
            box-shadow 0.15s ease,
            background 0.15s ease;
}

.field-group textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.6);
    background: rgba(7, 17, 34, 0.98);
}

/* Légère augmentation des tailles sur grand écran */
@media (min-width: 768px) {
    .field-group textarea {
        font-size: 0.95rem;
    }
}

/* ===========================
   Feedback
   =========================== */

.feedback {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-summary {
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.feedback-summary.good {
    background: rgba(22, 163, 74, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #bbf7d0;
}

.feedback-summary.bad {
    background: rgba(220, 38, 38, 0.16);
    border: 1px solid rgba(248, 113, 113, 0.6);
    color: #fecaca;
}

.feedback-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

/* 2 colonnes seulement quand il y a la place */
@media (min-width: 768px) {
    .feedback-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.feedback-block {
    padding: 1rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 255, 0.4);
    background: rgba(10, 18, 40, 0.95);
}

.feedback-block.correct {
    border-color: rgba(34, 197, 94, 0.6);
}

.feedback-block.wrong {
    border-color: rgba(248, 113, 113, 0.7);
}

.feedback-block h3 {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
}

.feedback-block .status {
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: #e5e7eb;
}

.expected-title {
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.expected-text {
    font-size: 0.9rem;
    color: #dbeafe;
}

/* ===========================
   Header
   =========================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.6rem 0;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.97), rgba(15, 23, 42, 0.9));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

/* Mobile-first : header en colonne, centré */
.site-header-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Desktop : header en ligne */
@media (min-width: 640px) {
    .site-header-inner {
        padding: 0 1.5rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    font-size: 1.6rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e5edff;
}

.brand-title a {
    color: inherit;
    text-decoration: none;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
}

.site-header-meta {
    align-self: flex-start;
}

@media (min-width: 640px) {
    .site-header-meta {
        align-self: center;
    }
}

.site-header-meta .badge {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(129, 140, 248, 0.7);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c7d2fe;
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.25), transparent);
}

/* ===========================
   Footer
   =========================== */

.site-footer {
    margin-top: 2.5rem;
    padding: 1.3rem 0 1.8rem;
    border-top: 1px solid rgba(30, 64, 175, 0.7);
    background: radial-gradient(circle at bottom, rgba(15, 23, 42, 0.96), rgba(3, 7, 18, 0.96));
}

.site-footer-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
}

@media (min-width: 768px) {
    .site-footer-inner {
        padding: 0 1.5rem;
        font-size: 0.85rem;
    }
}

.footer-main {
    margin: 0 0 0.2rem;
    color: #e5e7eb;
}

.footer-sub {
    margin: 0;
    font-size: 0.78rem;
    color: #9ca3af;
}

.visit-counter {
    margin: 0;
    font-size: 0.85rem;
    color: #9ca3af;
}

/* ===========================
   Liste des infractions
   =========================== */

.inf-list-card {
    margin-top: 1.5rem;
}

.inf-list-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.inf-list-title {
    margin: 0;
    font-size: 1.1rem;
    color: #e5f0ff;
}

.inf-back-link {
    align-self: flex-start;
}

/* Sur écrans plus larges, header en ligne */
@media (min-width: 640px) {
    .inf-list-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Liste */
.infraction-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
}

.infraction-item {
    padding: 0.9rem 0.8rem;
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(88, 134, 255, 0.35);
}

.infraction-item-header {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.infraction-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.infraction-item-title {
    margin: 0;
    font-size: 0.98rem;
    color: #e5f0ff;
}

.infraction-item-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.7);
    background: radial-gradient(
            circle at top left,
            rgba(250, 204, 21, 0.35),
            rgba(30, 64, 175, 0.2)
    );
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #facc15;
}

.infraction-toggle {
    align-self: flex-start;
}

/* Détails */
.infraction-item-details {
    margin-top: 0.75rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(148, 163, 255, 0.45);
}

.infraction-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .infraction-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.infraction-column h4 {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    color: #c7d2fe;
}

.infraction-elements {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    list-style: none;
}

.infraction-element-index {
    margin-right: 0.3rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.infraction-element-text {
    font-size: 0.88rem;
    color: #dbeafe;
}

.infraction-empty {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: #9ca3af;
}
