/**
 * ==========================================================================
 *    CHARTE GRAPHIQUE CAAT - PALETTE SANS BLEU
 *    - Calama Purple : #A8188D
 *    - Vert Grass / Success : #0E8437
 *    - Vert Mint : #74E0C1
 *    - Or / Bronze : #947946
 *    - Dark / Background : #101325 (Anthracite profond) / #000000
 *    - White / Cards : #FFFFFF
 *    - Red / Error : #D93838
 *    ==========================================================================
 *
 * @format
 */

:root {
   --color-purple: #a8188d;
   --color-purple-dark: #7b0f66;
   --color-green: #0e8437;
   --color-green-light: #74e0c1;
   --color-gold: #947946;
   --color-bg: #101325;
   --color-card-bg: rgba(255, 255, 255, 0.07);
   --color-text: #ffffff;
   --color-text-muted: #b3b9c1;
   --color-error: #d93838;
   --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
   --radius-lg: 20px;
   --radius-md: 12px;
}

* {
   box-sizing: border-box;
   margin: 0;
   padding: 0;
   user-select: none; /* Kiosque / Tactile */
   -webkit-user-select: none;
}

body,
html {
   width: 100%;
   height: 100%;
   overflow: hidden;
   background-color: var(--color-bg);
   color: var(--color-text);
   font-family: var(--font-main);
   background: radial-gradient(circle at 50% 20%, #1a1f3b 0%, #101325 100%);
}

.app-container {
   width: 100vw;
   height: 100vh;
   position: relative;
   display: flex;
   justify-content: center;
   align-items: center;
}

/* ==================== ÉCRANS GENERAL ==================== */
.screen {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   padding: 2rem;
   opacity: 0;
   pointer-events: none;
   transition:
      opacity 0.4s ease,
      transform 0.4s ease;
   transform: scale(0.98);
}

.screen.active {
   opacity: 1;
   pointer-events: auto;
   transform: scale(1);
}

/* ==================== ÉCRAN 1 : ACCUEIL ==================== */
.welcome-content {
   text-align: center;
   max-width: 650px;
   width: 100%;
}

.brand-header {
   margin-bottom: 1rem;
}

.logo-placeholder img {
   height: 12rem;
}

.tagline {
   display: block;
   color: var(--color-gold);
   font-size: 1rem;
   margin-top: 0.2rem;
   font-weight: 600;
}

.hero-badge {
   display: inline-block;
   background: rgba(116, 224, 193, 0.15);
   color: var(--color-green-light);
   padding: 0.4rem 1.2rem;
   border-radius: 50px;
   font-size: 0.9rem;
   font-weight: 700;
   border: 1px solid var(--color-green-light);
   margin-bottom: 1rem;
}

.main-title {
   font-size: 3rem;
   font-weight: 800;
   margin-bottom: 0.5rem;
   background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
}

.subtitle {
   font-size: 1.3rem;
   color: var(--color-text-muted);
   margin-bottom: 2.5rem;
}

.quiz-info-cards {
   display: flex;
   justify-content: space-between;
   gap: 1rem;
   margin-bottom: 3rem;
}

.info-card {
   flex: 1;
   background: var(--color-card-bg);
   border: 1px solid rgba(255, 255, 255, 0.1);
   border-radius: var(--radius-md);
   padding: 1.2rem 0.5rem;
   backdrop-filter: blur(10px);
}

.card-num {
   display: block;
   font-size: 1.8rem;
   font-weight: 800;
   color: var(--color-green-light);
}

.card-txt {
   font-size: 0.85rem;
   color: var(--color-text-muted);
}

/* ==================== BOUTONS ==================== */
.btn {
   border: none;
   outline: none;
   cursor: pointer;
   border-radius: 50px;
   font-weight: 700;
   font-size: 1.1rem;
   padding: 1rem 2rem;
   transition:
      transform 0.15s ease,
      background-color 0.2s ease,
      box-shadow 0.2s ease;
   display: inline-flex;
   align-items: center;
   justify-content: center;
}

.btn-primary {
   background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-purple-dark) 100%);
   color: #ffffff;
   box-shadow: 0 8px 25px rgba(168, 24, 141, 0.4);
}

.btn-primary:active {
   transform: scale(0.96);
   box-shadow: 0 4px 15px rgba(168, 24, 141, 0.3);
}

.btn-secondary {
   background: rgba(255, 255, 255, 0.1);
   color: #ffffff;
   border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-accent {
   background: linear-gradient(135deg, var(--color-green) 0%, #095924 100%);
   color: #ffffff;
   box-shadow: 0 8px 25px rgba(14, 132, 55, 0.4);
}

.btn-giant {
   width: 100%;
   padding: 1.4rem;
   font-size: 1.3rem;
   letter-spacing: 1px;
}

.admin-button {
   width: auto;
   margin-top: 1.25rem;
   padding: 0.55rem 1rem;
   border: 1px solid rgba(255, 255, 255, 0.18);
   background: transparent;
   box-shadow: none;
   color: var(--color-text-muted);
   font-size: 0.78rem;
   letter-spacing: 0.5px;
   opacity: 0.7;
}

.admin-button:hover {
   opacity: 1;
   background: rgba(255, 255, 255, 0.08);
}

/* ==================== FORMULAIRE & CARTES ==================== */
.card-panel {
   background: rgba(255, 255, 255, 0.05);
   border: 1px solid rgba(255, 255, 255, 0.12);
   border-radius: var(--radius-lg);
   padding: 2.5rem;
   width: 100%;
   max-width: 500px;
   backdrop-filter: blur(15px);
   box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-panel h2 {
   font-size: 2rem;
   margin-bottom: 0.5rem;
}

.panel-subtitle {
   color: var(--color-text-muted);
   font-size: 0.95rem;
   margin-bottom: 2rem;
}

.form-group {
   display: flex;
   flex-direction: column;
   text-align: left;
   margin-bottom: 1.5rem;
}

.form-group label {
   font-size: 0.9rem;
   font-weight: 600;
   margin-bottom: 0.5rem;
   color: var(--color-text-muted);
}

.form-group input {
   background: rgba(255, 255, 255, 0.08);
   border: 1px solid rgba(255, 255, 255, 0.2);
   border-radius: var(--radius-md);
   padding: 1rem 1.2rem;
   color: #ffffff;
   font-size: 1.1rem;
   outline: none;
   transition: border-color 0.2s ease;
}

.form-group input:focus {
   border-color: var(--color-purple);
   background: rgba(255, 255, 255, 0.12);
}

.help-text {
   font-size: 0.75rem;
   color: var(--color-text-muted);
   margin-top: 0.3rem;
}

.form-actions {
   display: flex;
   gap: 1rem;
   margin-top: 1rem;
}

.form-actions .btn {
   flex: 1;
}

/* ==================== GAMEPLAY / QUIZ ==================== */
.quiz-header {
   width: 100%;
   max-width: 700px;
   margin-bottom: 2rem;
}

.quiz-step-badge {
   font-size: 1rem;
   font-weight: 700;
   color: var(--color-gold);
   margin-bottom: 0.5rem;
   text-align: center;
}

/* .timer-bar-container {
   width: 100%;
   height: 12px;
   background: rgba(255, 255, 255, 0.1);
   border-radius: 10px;
   overflow: hidden;
} */

/* .timer-bar {
   width: 100%;
   height: 100%;
   background: linear-gradient(90deg, var(--color-green-light), var(--color-purple));
   transition: width 0.1s linear;
} */

/* .timer-text {
   text-align: right;
   font-size: 0.9rem;
   font-weight: 700;
   margin-top: 0.3rem;
   color: var(--color-text-muted);
} */
.timer-circle-container {
   position: relative;
   width: 90px;
   height: 90px;
   display: flex;
   align-items: center;
   justify-content: center;
   margin: 15px auto;
}

.timer-svg {
   width: 100%;
   height: 100%;
   transform: rotate(-90deg); /* Démarrage de l'animation en haut */
}

.timer-circle-bg {
   fill: none;
   stroke: rgba(255, 255, 255, 0.1);
   stroke-width: 8;
}

.timer-circle-progress {
   fill: none;
   stroke: var(--primary-color, #a8188d); /* Calama Purple de la CAAT */
   stroke-width: 8;
   stroke-linecap: round;
   /* Circonférence pour r=42 : 2 * PI * 42 ≈ 263.89 */
   stroke-dasharray: 263.89;
   stroke-dashoffset: 0;
   transition:
      stroke-dashoffset 0.1s linear,
      stroke 0.3s ease;
}

.timer-circle-text {
   position: absolute;
   font-size: 1.2rem;
   font-weight: 700;
   color: #ffffff;
}

/* Optionnel : Changement de couleur sous les 3 secondes */
.timer-circle-progress.warning {
   stroke: #d32f2f; /* Rouge alerte */
}

.quiz-body {
   width: 100%;
   max-width: 700px;
}

.question-text {
   font-size: 1.8rem;
   font-weight: 700;
   text-align: center;
   margin-bottom: 2.5rem;
   min-height: 80px;
   display: flex;
   align-items: center;
   justify-content: center;
}

.answers-grid {
   display: flex;
   flex-direction: column;
   gap: 1rem;
}

.answer-btn {
   width: 100%;
   background: rgba(255, 255, 255, 0.06);
   border: 2px solid rgba(255, 255, 255, 0.15);
   border-radius: var(--radius-md);
   padding: 1.3rem 1.5rem;
   color: #ffffff;
   font-size: 1.15rem;
   font-weight: 600;
   text-align: left;
   cursor: pointer;
   transition: all 0.2s ease;
}

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

.answer-btn.correct {
   background: var(--color-green) !important;
   border-color: var(--color-green-light) !important;
   box-shadow: 0 0 20px rgba(14, 132, 55, 0.6);
}

.answer-btn.incorrect {
   background: var(--color-error) !important;
   border-color: #ff6b6b !important;
   box-shadow: 0 0 20px rgba(217, 56, 56, 0.6);
}

/* ==================== RÉSULTAT ==================== */
.result-panel {
   text-align: center;
}

.result-icon {
   font-size: 4rem;
   margin-bottom: 1rem;
}

.score-display {
   font-size: 3.5rem;
   font-weight: 900;
   color: var(--color-green-light);
   margin-bottom: 1.5rem;
}

.reward-box {
   background: rgba(14, 132, 55, 0.15);
   border: 1px solid var(--color-green);
   border-radius: var(--radius-md);
   padding: 1.5rem;
   margin-bottom: 1.5rem;
}

.reward-box.loss-box {
   background: rgba(255, 255, 255, 0.05);
   border-color: rgba(255, 255, 255, 0.2);
}

.reward-msg {
   font-weight: 700;
   font-size: 1.1rem;
   margin-bottom: 0.5rem;
}

.reward-label {
   font-size: 0.85rem;
   color: var(--color-text-muted);
   margin-bottom: 0.5rem;
}

.code-badge {
   display: inline-block;
   background: var(--color-purple);
   color: #ffffff;
   font-size: 2rem;
   font-weight: 900;
   letter-spacing: 3px;
   padding: 0.5rem 1.5rem;
   border-radius: var(--radius-md);
   margin-top: 0.5rem;
   box-shadow: 0 0 15px rgba(168, 24, 141, 0.5);
}

.margin-top {
   margin-top: 1.5rem;
}

.hidden {
   display: none !important;
}

/* ==================== ADMIN & MODALE ==================== */
.modal-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100vw;
   height: 100vh;
   background: rgba(0, 0, 0, 0.85);
   display: flex;
   justify-content: center;
   align-items: center;
   z-index: 1000;
   backdrop-filter: blur(8px);
}

.modal-content {
   background: #1a1f3b;
   border: 1px solid var(--color-purple);
   border-radius: var(--radius-lg);
   width: 90%;
   max-width: 450px;
   padding: 2rem;
}

.modal-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 1.5rem;
}

.btn-close {
   background: none;
   border: none;
   color: #fff;
   font-size: 2rem;
   cursor: pointer;
}

.stats-grid {
   display: flex;
   gap: 1rem;
   margin-bottom: 1.5rem;
}

.stat-card {
   flex: 1;
   background: rgba(255, 255, 255, 0.05);
   padding: 1rem;
   border-radius: var(--radius-md);
   text-align: center;
}

.stat-val {
   display: block;
   font-size: 2rem;
   font-weight: 800;
   color: var(--color-green-light);
}

.stat-lbl {
   font-size: 0.8rem;
   color: var(--color-text-muted);
}

/* Container principal responsive */
.admin-body {
   background-color: #0d0f1d;
   color: #ffffff;
   font-family:
      system-ui,
      -apple-system,
      sans-serif;
   padding: 16px;
   margin: 0;
   box-sizing: border-box;
}

.admin-container {
   max-width: 1100px;
   margin: 0 auto;
   width: 100%;
}

.admin-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 16px;
   margin-bottom: 20px;
   flex-wrap: wrap; /* S'adapte sur petit écran */
}

.admin-header h1 {
   font-size: 1.5rem;
   margin: 0;
}

.card-panel {
   background: #161a30;
   border-radius: 12px;
   padding: 20px;
   margin-bottom: 24px;
   box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Normalisation rigoureuse de TOUS les inputs + textarea */
.form-group {
   margin-bottom: 16px;
   display: flex;
   flex-direction: column;
}

.form-group label {
   margin-bottom: 6px;
   font-weight: 600;
   font-size: 0.95rem;
   color: #e0e6ed;
}

/* Style identique pour input, textarea et select */
.form-group input[type="text"],
.form-group textarea,
.form-group select {
   width: 100%;
   box-sizing: border-box;
   padding: 12px 14px;
   border-radius: 8px;
   border: 1px solid #2d345a;
   background-color: #0f1225;
   color: #ffffff;
   font-size: 1rem;
   font-family: inherit;
   line-height: 1.4;
   outline: none;
   transition:
      border-color 0.2s ease,
      box-shadow 0.2s ease;
}

.form-group textarea {
   resize: vertical;
   min-height: 80px;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
   border-color: #3b82f6;
   box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Alignement responsive du formulaire */
.form-row {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
   gap: 16px;
}

.form-actions {
   display: flex;
   gap: 12px;
   margin-top: 10px;
   flex-wrap: wrap;
}

/* Rendre le tableau défilable sur mobile */
.admin-list-panel {
   overflow-x: auto;
}

.admin-table {
   width: 100%;
   border-collapse: collapse;
   margin-top: 12px;
   min-width: 700px; /* Conserve la lisibilité du tableau sur mobile */
}

.admin-table th,
.admin-table td {
   padding: 12px;
   text-align: left;
   border-bottom: 1px solid #232948;
   vertical-align: middle;
}

.admin-table th {
   background: #1f2545;
   color: #a0a7cc;
   font-weight: 600;
   white-space: nowrap;
}

.action-cells {
   display: flex;
   gap: 8px;
   white-space: nowrap;
}

/* Boutons & Badges */
.btn {
   padding: 10px 20px;
   border-radius: 8px;
   border: none;
   font-weight: 600;
   cursor: pointer;
   text-decoration: none;
   display: inline-block;
   text-align: center;
}

.btn-primary {
   background-color: #3b82f6;
   color: #fff;
}
.btn-secondary {
   background-color: #2d345a;
   color: #fff;
}

.btn-sm {
   padding: 8px 12px;
   border-radius: 6px;
   border: none;
   cursor: pointer;
   font-size: 0.85rem;
   font-weight: 500;
}

.btn-edit {
   background: #2563eb;
   color: #fff;
}
.btn-delete {
   background: #dc2626;
   color: #fff;
}

.badge-success {
   background: #0e8437;
   color: #fff;
   padding: 4px 8px;
   border-radius: 4px;
   font-size: 0.8rem;
   display: inline-block;
}

.text-center {
   text-align: center;
}
.hidden {
   display: none !important;
}

/* Adjustments spécifiques Mobile */
@media (max-width: 600px) {
   .admin-body {
      padding: 10px;
   }

   .card-panel {
      padding: 16px;
   }

   .admin-header {
      flex-direction: column;
      align-items: flex-start;
   }

   .btn {
      width: 100%;
      box-sizing: border-box;
   }

   .form-actions {
      flex-direction: column;
   }

   .form-actions .btn {
      width: 100%;
   }
}

.trigger {
   position: fixed;
   top: 0;
   right: 0;
   width: 100px;
   height: 100px;
   /* background: rgba(177, 22, 22, 1); */
   z-index: 999;
}
