/* =========================================================
   theme.css — Bouton « Mode clair / Mode sombre » + thème clair
   (dashboard.html, logique dans js/theme.js)

   Le thème sombre est celui de jj.css (aucune modification).
   Ici : le bouton, et les surcharges appliquées quand
   <html data-theme="light">. À charger APRÈS les autres CSS.

   Palette claire (maquette) : fond #f1f4fa, cartes #ffffff,
   texte #0b1220, texte secondaire #5b6678, accent jaune #ffd400
   (texte accent : #7a5b00 pour rester lisible sur fond clair).
   ========================================================= */

/* --- Bouton de thème (en-tête) --- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.12); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle + .user-area { margin-left: 0; }

html[data-theme="dark"]  { color-scheme: dark; }

/* =========================================================
   THÈME CLAIR
   ========================================================= */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f4fa;
  --card: #ffffff;
  --text: #0b1220;
  --accent-text: #7a5b00;
  --panel-bg: #f4f6fb;
  --svc-line: rgba(11, 18, 32, 0.14);
  --svc-surface: #f4f6fb;
  --svc-muted: #5b6678;
}

html[data-theme="light"] body {
  /* fond uni : le dégradé de jj.css se répète à la hauteur de l'écran
     et laisserait une bande visible en clair */
  background: var(--bg);
  color: var(--text);
}

/* --- En-tête --- */
html[data-theme="light"] .theme-toggle {
  border-color: rgba(11, 18, 32, 0.14);
  background: #ffffff;
}
html[data-theme="light"] .theme-toggle:hover { background: #f4f6fb; }
html[data-theme="light"] .brand p,
html[data-theme="light"] .user-info,
html[data-theme="light"] .header-user-info { color: #5b6678; }
html[data-theme="light"] .user-info span,
html[data-theme="light"] .header-user-info span { color: var(--text); }
html[data-theme="light"] .login-btn {
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(11, 18, 32, 0.14);
}
html[data-theme="light"] .login-btn:hover { background: #f4f6fb; color: var(--text); }
html[data-theme="light"] .logout-btn {
  background: rgba(220, 38, 38, 0.08);
  color: #b42318;
  border-color: rgba(220, 38, 38, 0.3);
}

/* --- Bandeaux et cartes --- */
html[data-theme="light"] .welcome-banner {
  background: linear-gradient(90deg, rgba(255, 212, 0, 0.22), rgba(255, 212, 0, 0.1));
  border-color: rgba(122, 91, 0, 0.3);
  color: var(--text);
}
html[data-theme="light"] .card {
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.1);
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.05);
}
html[data-theme="light"] .small,
html[data-theme="light"] .field-hint,
html[data-theme="light"] .prix-note { color: #5b6678; }

html[data-theme="light"] .steps-block {
  background: linear-gradient(135deg, rgba(255, 212, 0, 0.16), #ffffff);
  border-color: rgba(122, 91, 0, 0.25);
}
html[data-theme="light"] .steps-title { color: var(--accent-text); }
html[data-theme="light"] .step-card {
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.1);
}
html[data-theme="light"] .step-card:hover { border-color: rgba(122, 91, 0, 0.4); }
html[data-theme="light"] .step-card h3 { color: var(--text); }
html[data-theme="light"] .step-card p { color: #5b6678; }

html[data-theme="light"] .op-btn { border-color: rgba(11, 18, 32, 0.12); background: #ffffff; }
html[data-theme="light"] .service-item {
  background: #f4f6fb;
}
html[data-theme="light"] .policy {
  background: rgba(255, 212, 0, 0.2);
  color: #5c4300;
}

/* --- Contact (couleur accent utilisée comme couleur de texte) --- */
html[data-theme="light"] .contact-compact span,
html[data-theme="light"] .contact-compact a,
html[data-theme="light"] .contact .phone { color: var(--accent-text) !important; }

/* --- Historique (couleurs posées en inline par app.js : les navigateurs
       les ré-écrivent en rgb(), d'où ces sélecteurs) --- */
html[data-theme="light"] .historique-list .transaction,
html[data-theme="light"] .historique-list > div { background: #f4f6fb !important; }
html[data-theme="light"] .historique-list [style*="rgb(203, 213, 225)"],
html[data-theme="light"] .historique-list [style*="rgb(154, 166, 178)"] { color: #5b6678 !important; }
html[data-theme="light"] .historique-list [style*="rgb(255, 212, 0)"]   { color: var(--accent-text) !important; }
html[data-theme="light"] .historique-list [style*="rgb(251, 191, 36)"]  { color: #a15c00 !important; }
html[data-theme="light"] .historique-list [style*="rgb(52, 211, 153)"]  { color: #0f7a55 !important; }
html[data-theme="light"] .historique-list [style*="rgb(248, 113, 113)"] { color: #c0352b !important; }
html[data-theme="light"] .rebuy-btn { border-color: rgba(11, 18, 32, 0.25); }
html[data-theme="light"] .rebuy-btn:hover,
html[data-theme="light"] .rebuy-btn:focus-visible { color: var(--accent-text); border-color: var(--accent-text); }
html[data-theme="light"] #clearHistoryBtn { background: rgba(220, 38, 38, 0.08); color: #b42318; border-color: rgba(220, 38, 38, 0.3); }

/* --- Achats habituels --- */
html[data-theme="light"] .habit-item { background: #f4f6fb; border-color: rgba(11, 18, 32, 0.12); }
html[data-theme="light"] .habit-item:hover,
html[data-theme="light"] .habit-item:focus-visible { background: #eceff6; border-color: rgba(11, 18, 32, 0.3); }
html[data-theme="light"] .habit-sub { color: #5b6678; }
html[data-theme="light"] .habit-cta { color: var(--accent-text); }

/* --- Formulaires --- */
html[data-theme="light"] input[type="tel"],
html[data-theme="light"] #unitesMontant,
html[data-theme="light"] .prog-content input,
html[data-theme="light"] .prog-content select {
  background: #ffffff;
  border: 1px solid rgba(11, 18, 32, 0.2);
  color: var(--text);
  color-scheme: light;
}
html[data-theme="light"] input[type="tel"]:focus { outline: 2px solid var(--accent-text); outline-offset: 1px; }

/* --- Fenêtre de paiement --- */
html[data-theme="light"] .modal { background: rgba(11, 18, 32, 0.5); }
html[data-theme="light"] .modal-content {
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.12);
  box-shadow: 0 12px 40px rgba(11, 18, 32, 0.25);
}
html[data-theme="light"] .accordion { border-color: rgba(11, 18, 32, 0.14); }
html[data-theme="light"] .forfait-card { border-color: rgba(11, 18, 32, 0.12); background: #f4f6fb; }
html[data-theme="light"] .forfait-card:hover { background: #eceff6; box-shadow: 0 6px 16px rgba(11, 18, 32, 0.1); }
html[data-theme="light"] .forfait-card:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
html[data-theme="light"] .forfait-card input[type="radio"] { border-color: rgba(11, 18, 32, 0.35); }
html[data-theme="light"] .forfait-desc { color: #5b6678; }
/* nom et prix : couleur d'accent de l'opérateur, assombrie pour le fond clair
   (app.js la pose en inline, d'où !important) */
html[data-theme="light"] .forfait-name,
html[data-theme="light"] .forfait-price {
  color: #7a5b00 !important;
  color: color-mix(in srgb, var(--accent) 50%, #000) !important;
}
html[data-theme="light"] .btn-cancel { border-color: rgba(11, 18, 32, 0.2); }
html[data-theme="light"] .form-footer {
  background: #f4f6fb;
  border-top-color: rgba(11, 18, 32, 0.12);
}
html[data-theme="light"] .form-message { color: #8a6500; }
html[data-theme="light"] .form-message[style*="rgb(251, 191, 36)"]  { color: #a15c00 !important; }
html[data-theme="light"] .form-message[style*="rgb(52, 211, 153)"]  { color: #0f7a55 !important; }
html[data-theme="light"] .form-message[style*="rgb(248, 113, 113)"] { color: #c0352b !important; }
html[data-theme="light"] .form-message[style*="rgb(154, 166, 178)"] { color: #5b6678 !important; }

/* --- Transfert d'unités --- */
html[data-theme="light"] .unites-intro { color: #5b6678; }
html[data-theme="light"] .unites-chip {
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.2);
  color: var(--text);
}
html[data-theme="light"] .unites-chip:hover { background: #f4f6fb; }
html[data-theme="light"] .unites-chip:focus-visible { outline-color: var(--accent-text); }
html[data-theme="light"] .unites-chip.is-active { background: var(--accent, #ffd400); border-color: var(--accent, #ffd400); color: #042; }
html[data-theme="light"] .unites-total {
  color: var(--text);
  background: rgba(255, 212, 0, 0.18);
  border-color: rgba(122, 91, 0, 0.45);
}
html[data-theme="light"] .unites-total strong { color: var(--accent-text); }

/* --- Souscriptions programmées --- */
html[data-theme="light"] .prog-open {
  color: var(--text);
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.3);
}
html[data-theme="light"] .prog-open:hover { background: #f4f6fb; }
html[data-theme="light"] .prog-count { background: var(--text); color: #ffffff; }
html[data-theme="light"] .prog-due-item,
html[data-theme="light"] .prog-item {
  color: var(--text);
  background: #f4f6fb;
  border-color: rgba(11, 18, 32, 0.12);
  border-left-color: var(--pa, rgba(11, 18, 32, 0.3));
}
html[data-theme="light"] .prog-l1 { color: var(--text); }
html[data-theme="light"] .prog-l2,
html[data-theme="light"] .prog-hint,
html[data-theme="light"] .prog-note,
html[data-theme="light"] .prog-or,
html[data-theme="light"] .prog-offre-nom { color: #5b6678; }
html[data-theme="light"] .prog-or::before,
html[data-theme="light"] .prog-or::after { background: rgba(11, 18, 32, 0.14); }
html[data-theme="light"] .prog-btn {
  color: var(--text);
  background: #f4f6fb;
  border-color: rgba(11, 18, 32, 0.2);
}
html[data-theme="light"] .prog-btn:hover { background: #eceff6; }
html[data-theme="light"] .prog-btn-go { background: var(--pa, #0b1220); border-color: var(--pa, #0b1220); color: var(--pat, #ffffff); }
html[data-theme="light"] .prog-btn-outline { background: transparent; color: var(--text); }
html[data-theme="light"] .prog-btn-del { color: #b42318; background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.3); }
html[data-theme="light"] .prog-modal { background: rgba(11, 18, 32, 0.5); }
html[data-theme="light"] .prog-content {
  color: var(--text);
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.12);
  border-top-color: var(--pa, rgba(11, 18, 32, 0.25));
}
html[data-theme="light"] .prog-close { color: #5b6678; }
html[data-theme="light"] .prog-steps li { color: #5b6678; border-top-color: rgba(11, 18, 32, 0.14); }
html[data-theme="light"] .prog-steps li.is-done { color: #5b6678; }
html[data-theme="light"] .prog-steps li.is-active { color: var(--text); }
html[data-theme="light"] .prog-recap,
html[data-theme="light"] .prog-info-box { color: var(--text); }
html[data-theme="light"] .prog-op { background: #ffffff; border-color: rgba(11, 18, 32, 0.14); }
html[data-theme="light"] .prog-tabs { background: #eceff6; }
html[data-theme="light"] .prog-tab { color: #5b6678; }
html[data-theme="light"] .prog-tab:focus-visible,
html[data-theme="light"] .prog-offre:focus-visible { outline-color: var(--accent-text); }
html[data-theme="light"] .prog-offre,
html[data-theme="light"] .prog-chip {
  color: var(--text);
  background: #ffffff;
  border-color: rgba(11, 18, 32, 0.14);
}
html[data-theme="light"] .prog-offre:hover,
html[data-theme="light"] .prog-offre.is-selected,
html[data-theme="light"] .prog-chip:hover,
html[data-theme="light"] .prog-chip.is-active { border-color: var(--pa); background: var(--pa-soft); }
html[data-theme="light"] .prog-content label.prog-lbl { color: #5b6678; }

/* --- Dépôt / fibre : messages (contraste sur fond clair) --- */
html[data-theme="light"] .svc-msg.is-error { color: #c0352b; }
html[data-theme="light"] .svc-msg.is-ok    { color: #0f7a55; }
html[data-theme="light"] .svc-chip[aria-pressed="true"] { color: #1a1500; }

/* Le pied de page reste sombre dans les deux thèmes (identité du site). */
