/* =============================================================================
   theme-dark.css — Thème sombre global
   -----------------------------------------------------------------------------
   Le projet compte une trentaine de vues, chacune avec son propre bloc <style>
   autonome. Deux mécanismes de couleur y coexistent :

     1. des variables CSS préfixées par vue  (--ho-ink, --ct-surface, ...)
     2. des couleurs hexadécimales écrites en dur (#faf8f5, #14110f, ...)

   Ce fichier traite les deux : il redéfinit les variables de chaque préfixe
   connu, puis neutralise les couleurs claires codées en dur sur les conteneurs
   de page. Aucune vue n'a besoin d'être modifiée.
   ============================================================================= */

:root {
    --app-bg:        #ffffff;
    --app-surface:   #ffffff;
    --app-surface-2: #f8fafc;
    --app-ink:       #14110f;
    --app-ink-soft:  #57534e;
    --app-ink-faint: #a29c94;
    --app-line:      #e7e2db;
    --app-accent:    #b5442e;
}

html.theme-dark {
    --app-bg:        #0f1115;
    --app-surface:   #161a21;
    --app-surface-2: #1d222b;
    --app-ink:       #e8eaed;
    --app-ink-soft:  #aab2be;
    --app-ink-faint: #7f8894;
    --app-line:      #2a303a;
    --app-accent:    #e2705a;
    color-scheme: dark;
}

/* -----------------------------------------------------------------------------
   1. Redéfinition des jeux de variables propres à chaque vue.
      Préfixes réellement utilisés : ho (accueil), ct (panier/commande),
      lg (connexion), ep (détail événement), hd (navbar), ft (pied de page),
      inv (studio d'invitations).
   -------------------------------------------------------------------------- */
html.theme-dark {
    /* Accueil */
    --ho-ink: #e8eaed;   --ho-ink-soft: #aab2be;  --ho-ink-faint: #7f8894;
    --ho-line: #2a303a;  --ho-surface: #161a21;   --ho-canvas: #0f1115;
    --ho-accent: #e2705a; --ho-accent-soft: #3a231e;

    /* Panier, commande, billets */
    --ct-ink: #e8eaed;   --ct-ink-soft: #aab2be;  --ct-ink-faint: #7f8894;
    --ct-line: #2a303a;  --ct-surface: #161a21;   --ct-canvas: #0f1115;
    --ct-accent: #e2705a; --ct-accent-soft: #3a231e;

    /* Connexion / inscription */
    --lg-ink: #e8eaed;   --lg-ink-soft: #aab2be;  --lg-ink-faint: #7f8894;
    --lg-line: #2a303a;  --lg-surface: #161a21;   --lg-canvas: #0f1115;
    --lg-accent: #e2705a; --lg-accent-soft: #3a231e;

    /* Détail d'un événement */
    --ep-ink: #e8eaed;   --ep-ink-soft: #aab2be;  --ep-ink-faint: #7f8894;
    --ep-line: #2a303a;  --ep-surface: #161a21;   --ep-canvas: #0f1115;
    --ep-accent: #e2705a; --ep-accent-soft: #3a231e;

    /* Pied de page */
    --ft-ink: #e8eaed;   --ft-ink-soft: #aab2be;  --ft-ink-faint: #7f8894;
    --ft-line: #2a303a;  --ft-surface: #161a21;   --ft-canvas: #0f1115;
    --ft-accent: #e2705a; --ft-accent-soft: #3a231e;
}

/* La navbar définit ses variables sur .hd-nav et non sur :root. */
html.theme-dark .hd-nav {
    --hd-ink: #e8eaed;   --hd-ink-soft: #aab2be;  --hd-ink-faint: #7f8894;
    --hd-line: #2a303a;  --hd-surface: #161a21;   --hd-canvas: #0f1115;
    --hd-accent: #e2705a; --hd-accent-soft: #3a231e;
}

/* -----------------------------------------------------------------------------
   2. Base du document
   -------------------------------------------------------------------------- */
html.theme-dark,
html.theme-dark body {
    background-color: var(--app-bg) !important;
    color: var(--app-ink);
}

/* -----------------------------------------------------------------------------
   3. Conteneurs de page des vues à couleurs codées en dur.
      Chaque page statique utilise le motif « .xx-page » avec un fond clair.
   -------------------------------------------------------------------------- */
html.theme-dark .sp-page,
html.theme-dark .cf-page,
html.theme-dark .co-page,
html.theme-dark .ct-page,
html.theme-dark .lg-page,
html.theme-dark .mt-page,
html.theme-dark .od-page,
html.theme-dark .org-page,
html.theme-dark .pv-page,
html.theme-dark .main-content {
    background-color: var(--app-bg) !important;
    color: var(--app-ink) !important;
}

/* Sections et cartes internes de ces pages. */
html.theme-dark .sp-card,
html.theme-dark .sp-block,
html.theme-dark .sp-panel,
html.theme-dark .sp-section,
html.theme-dark .sp-item,
html.theme-dark .cf-card,
html.theme-dark .co-card,
html.theme-dark .ct-card,
html.theme-dark .lg-card,
html.theme-dark .mt-card,
html.theme-dark .od-card,
html.theme-dark .org-card,
html.theme-dark .pv-card,
html.theme-dark .card,
html.theme-dark .panel,
html.theme-dark .box,
html.theme-dark .org-section,
html.theme-dark .adm-card,
html.theme-dark .hm-card,
html.theme-dark .ev-card,
html.theme-dark .stat-card,
html.theme-dark .form-card,
html.theme-dark .table-wrap {
    background-color: var(--app-surface) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink);
}

/* -----------------------------------------------------------------------------
   4. Couleurs claires codées en dur, quel que soit l'élément porteur.
      Ces valeurs proviennent d'un relevé exhaustif du projet.
   -------------------------------------------------------------------------- */
html.theme-dark [class*="-page"],
html.theme-dark [class*="-shell"],
html.theme-dark [class*="-section"],
html.theme-dark [class*="-hero"],
html.theme-dark [class*="-band"],
html.theme-dark [class*="-strip"] {
    border-color: var(--app-line);
}

/* Fonds clairs déclarés en style inline. */
html.theme-dark [style*="background:#fff"],
html.theme-dark [style*="background: #fff"],
html.theme-dark [style*="background-color:#fff"],
html.theme-dark [style*="background-color: #fff"],
html.theme-dark [style*="background:#ffffff"],
html.theme-dark [style*="background: #ffffff"],
html.theme-dark [style*="background:#f8fafc"],
html.theme-dark [style*="background: #f8fafc"],
html.theme-dark [style*="background:#f1f5f9"],
html.theme-dark [style*="background: #f1f5f9"],
html.theme-dark [style*="background:#faf8f5"],
html.theme-dark [style*="background: #faf8f5"],
html.theme-dark [style*="background:#f9fafb"],
html.theme-dark [style*="background: #f9fafb"] {
    background-color: var(--app-surface) !important;
    color: var(--app-ink);
}

/* Textes sombres déclarés en style inline. */
html.theme-dark [style*="color:#14110f"],
html.theme-dark [style*="color: #14110f"],
html.theme-dark [style*="color:#0f172a"],
html.theme-dark [style*="color: #0f172a"],
html.theme-dark [style*="color:#222222"],
html.theme-dark [style*="color: #222222"],
html.theme-dark [style*="color:#1a1a1a"],
html.theme-dark [style*="color: #1a1a1a"],
html.theme-dark [style*="color:#000"],
html.theme-dark [style*="color: #000"] {
    color: var(--app-ink) !important;
}

html.theme-dark [style*="color:#57534e"],
html.theme-dark [style*="color: #57534e"],
html.theme-dark [style*="color:#64748b"],
html.theme-dark [style*="color: #64748b"],
html.theme-dark [style*="color:#475569"],
html.theme-dark [style*="color: #475569"] {
    color: var(--app-ink-soft) !important;
}

html.theme-dark .text-muted,
html.theme-dark .org-text-muted,
html.theme-dark .muted {
    color: var(--app-ink-faint) !important;
}

/* -----------------------------------------------------------------------------
   5. Pied de page
   -------------------------------------------------------------------------- */
html.theme-dark .ft-footer,
html.theme-dark footer {
    background-color: var(--app-surface) !important;
    border-top-color: var(--app-line) !important;
    color: var(--app-ink-soft);
}

/* -----------------------------------------------------------------------------
   6. Formulaires
   -------------------------------------------------------------------------- */
html.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]),
html.theme-dark select,
html.theme-dark textarea {
    background-color: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
    color: var(--app-ink-faint) !important;
}

html.theme-dark input:focus,
html.theme-dark select:focus,
html.theme-dark textarea:focus {
    border-color: var(--app-accent) !important;
    outline-color: var(--app-accent);
}

html.theme-dark option {
    background-color: var(--app-surface-2);
    color: var(--app-ink);
}

/* Les sélecteurs de date natifs restent lisibles. */
html.theme-dark input[type="date"]::-webkit-calendar-picker-indicator,
html.theme-dark input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85);
}

/* -----------------------------------------------------------------------------
   7. Tableaux
   -------------------------------------------------------------------------- */
html.theme-dark table {
    background-color: var(--app-surface) !important;
    color: var(--app-ink);
}
html.theme-dark thead,
html.theme-dark thead th {
    background-color: var(--app-surface-2) !important;
    color: var(--app-ink) !important;
}
html.theme-dark td,
html.theme-dark th {
    border-color: var(--app-line) !important;
}
html.theme-dark tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.02); }
html.theme-dark tbody tr:hover           { background-color: rgba(255, 255, 255, 0.05); }

/* -----------------------------------------------------------------------------
   8. Bordures claires codées en dur
   -------------------------------------------------------------------------- */
html.theme-dark [style*="border:1px solid #e2e8f0"],
html.theme-dark [style*="border: 1px solid #e2e8f0"],
html.theme-dark [style*="border:1px solid #e7e2db"],
html.theme-dark [style*="border: 1px solid #e7e2db"],
html.theme-dark [style*="border:1px solid #f1f5f9"],
html.theme-dark [style*="border: 1px solid #f1f5f9"],
html.theme-dark [style*="border:1px solid #ddd"],
html.theme-dark [style*="border: 1px solid #ddd"] {
    border-color: var(--app-line) !important;
}

/* -----------------------------------------------------------------------------
   9. Images : légère atténuation pour éviter l'éblouissement sur fond sombre.
      La carte d'invitation et les QR codes sont exclus : ils doivent rester
      strictement fidèles.
   -------------------------------------------------------------------------- */
html.theme-dark img:not(.no-dim):not(.inv-qr-img):not(.inv-head-logo) {
    filter: brightness(0.94);
}

/* La carte d'invitation reste blanche en toutes circonstances. */
html.theme-dark .inv-card-root,
html.theme-dark .inv-card-root * {
    background-color: initial;
    color: initial;
}
html.theme-dark .inv-card-root {
    background-color: #ffffff !important;
}

/* -----------------------------------------------------------------------------
   10. Sélecteurs de langue et de thème (barre de navigation)
   -------------------------------------------------------------------------- */
.app-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-lang-switch {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    overflow: hidden;
    background: transparent;
}

.app-lang-switch a {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-decoration: none;
    color: var(--app-ink-soft);
    line-height: 1.5;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.app-lang-switch a:hover { color: var(--app-ink); }

.app-lang-switch a.is-active {
    background: var(--app-accent);
    color: #ffffff;
}

html.theme-dark .app-lang-switch a.is-active { color: #16191f; }

.app-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: transparent;
    color: var(--app-ink-soft);
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease;
}

.app-theme-btn:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
}

.app-theme-btn svg { width: 15px; height: 15px; display: block; }

/* Une seule des deux icônes est visible selon le thème actif. */
.app-theme-btn .icon-moon { display: block; }
.app-theme-btn .icon-sun  { display: none; }
html.theme-dark .app-theme-btn .icon-moon { display: none; }
html.theme-dark .app-theme-btn .icon-sun  { display: block; }

@media (max-width: 900px) {
    .app-switcher { gap: 4px; }
    .app-lang-switch a { padding: 3px 8px; font-size: 11px; }
    .app-theme-btn { width: 30px; height: 30px; }
}

/* -----------------------------------------------------------------------------
   11. Impression : toujours en clair, quel que soit le thème choisi à l'écran.
       Les cartes d'invitation PDF doivent rester strictement blanches.
   -------------------------------------------------------------------------- */
@media print {
    html.theme-dark,
    html.theme-dark body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    html.theme-dark img { filter: none !important; }
    .app-switcher { display: none !important; }
}

/* =============================================================================
   12. Espaces de gestion (organisateur, administration, contrôleur)
   -----------------------------------------------------------------------------
   Ces vues emploient une palette « slate » (#0f172a, #f8fafc, #e2e8f0) écrite
   en dur, sans variables. On la transpose ici en équivalents sombres.
   ============================================================================= */

/* Barre latérale et cartes principales */
html.theme-dark .dashboard-sidebar,
html.theme-dark .org-sidebar,
html.theme-dark .sales-sidebar,
html.theme-dark .admin-sidebar,
html.theme-dark .org-kpi-card,
html.theme-dark .org-card,
html.theme-dark .org-card-body,
html.theme-dark .org-card-header,
html.theme-dark .org-shortcut,
html.theme-dark .org-period-card,
html.theme-dark .org-block,
html.theme-dark .inv-block,
html.theme-dark .inv-step,
html.theme-dark .inv-hist,
html.theme-dark .sidebar-header,
html.theme-dark .sidebar-footer {
    background-color: var(--app-surface) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

/* Éléments de navigation de la barre latérale */
html.theme-dark .nav-item,
html.theme-dark .org-nav-item,
html.theme-dark .sidebar-nav a {
    color: var(--app-ink-soft) !important;
}
html.theme-dark .nav-item:hover,
html.theme-dark .org-nav-item:hover,
html.theme-dark .sidebar-nav a:hover {
    background-color: var(--app-surface-2) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .nav-item.active,
html.theme-dark .org-nav-item.active,
html.theme-dark .sidebar-nav a.active {
    background-color: var(--app-surface-2) !important;
    color: var(--app-ink) !important;
    border-right-color: var(--app-accent) !important;
}

/* Titres et libellés en gris ardoise foncé : illisibles sur fond sombre. */
html.theme-dark .org-page-title,
html.theme-dark .org-section-title,
html.theme-dark .org-card-title,
html.theme-dark .org-kpi-value,
html.theme-dark .org-user-name,
html.theme-dark .org-admin-name,
html.theme-dark .sidebar-title,
html.theme-dark .org-hero-title,
html.theme-dark .inv-hero-title,
html.theme-dark .inv-step-title,
html.theme-dark .inv-hist-title,
html.theme-dark .org-section-visual strong,
html.theme-dark .org-link {
    color: var(--app-ink) !important;
}

html.theme-dark .org-page-subtitle,
html.theme-dark .org-kpi-label,
html.theme-dark .org-date,
html.theme-dark .org-detail,
html.theme-dark .org-admin-role,
html.theme-dark .sidebar-subtitle,
html.theme-dark .org-empty-state,
html.theme-dark .org-section-visual span {
    color: var(--app-ink-soft) !important;
}

/* Bandeaux d'en-tête de section (fonds pastel clairs). */
html.theme-dark .org-section-visual,
html.theme-dark .org-hero,
html.theme-dark .inv-hero,
html.theme-dark .org-banner {
    background-color: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
}

/* Pastilles KPI colorées : on assombrit le fond en gardant la teinte. */
html.theme-dark .org-kpi-blue   { background-color: #12283a !important; color: #7cc4f0 !important; }
html.theme-dark .org-kpi-green  { background-color: #123024 !important; color: #6fce9a !important; }
html.theme-dark .org-kpi-purple { background-color: #241c3d !important; color: #b49bf0 !important; }
html.theme-dark .org-kpi-orange { background-color: #33280f !important; color: #e8bd63 !important; }

/* Boutons sombres sur fond clair : ils doivent s'inverser. */
html.theme-dark .org-btn-primary,
html.theme-dark .org-create-btn,
html.theme-dark .btn-dark {
    background-color: var(--app-accent) !important;
    color: #16191f !important;
    border-color: var(--app-accent) !important;
}

/* Barre de navigation mobile de l'organisateur */
html.theme-dark .org-mobile-nav,
html.theme-dark .mobile-nav-bar {
    background-color: var(--app-surface) !important;
    border-top-color: var(--app-line) !important;
}

/* Le studio d'invitations : la carte reste blanche, son cadre s'adapte. */
html.theme-dark .inv-form-grid,
html.theme-dark .inv-actions-bar,
html.theme-dark .inv-actions-bar-2 {
    background-color: transparent !important;
}

/* Carte d'accueil du tableau de bord (bandeau bleu pâle) et titre latéral. */
html.theme-dark .org-welcome-card {
    background-color: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
}
html.theme-dark .org-welcome-card h2,
html.theme-dark .org-welcome-copy h2 {
    color: var(--app-ink) !important;
}
html.theme-dark .org-welcome-card p,
html.theme-dark .org-welcome-copy p {
    color: var(--app-ink-soft) !important;
}
html.theme-dark .org-welcome-kicker {
    color: var(--app-accent) !important;
}
html.theme-dark .org-sidebar-title,
html.theme-dark .org-sidebar-sub {
    color: var(--app-ink) !important;
}
html.theme-dark .org-sidebar-sub { color: var(--app-ink-soft) !important; }

/* Les illustrations vectorielles blanches restent lisibles sur fond sombre. */
html.theme-dark .org-welcome-art svg rect[fill="#fff"],
html.theme-dark .org-welcome-art svg rect[fill="#ffffff"] {
    fill: #222933;
}

/* =============================================================================
   13. Dégradés clairs
   -----------------------------------------------------------------------------
   Plusieurs bandeaux utilisent un « linear-gradient » pastel comme image de
   fond. Une couleur de fond ne suffit pas à les masquer : il faut neutraliser
   l'image elle-même.
   ============================================================================= */
html.theme-dark .org-welcome-card,
html.theme-dark .org-hero-card,
html.theme-dark .inv-hero,
html.theme-dark .hm-hero,
html.theme-dark .sp-hero,
html.theme-dark .ct-hero,
html.theme-dark .pf-hero,
html.theme-dark .od-hero,
html.theme-dark .cf-hero,
html.theme-dark [class*="welcome"],
html.theme-dark [class*="-banner"] {
    background-image: none !important;
    background-color: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
}

/* Les dégradés appliqués en style inline. */
html.theme-dark [style*="linear-gradient(135deg, #eff6ff"],
html.theme-dark [style*="linear-gradient(135deg,#eff6ff"],
html.theme-dark [style*="linear-gradient(135deg, #f2efff"],
html.theme-dark [style*="linear-gradient(135deg, #fff"] {
    background-image: none !important;
    background-color: var(--app-surface-2) !important;
}

/* Le dégradé du titre d'accueil doit rester visible : il porte l'identité. */
html.theme-dark .ho-text-gradient {
    background-image: linear-gradient(135deg, #e2705a, #ff6b81) !important;
}

/* =============================================================================
   14. Liste des organisateurs (administration)
   ============================================================================= */
html.theme-dark .adm-org-btn {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .adm-org-btn.is-config:hover  { background: #12283a !important; border-color: #2f5f80 !important; color: #7cc4f0 !important; }
html.theme-dark .adm-org-btn.is-message:hover { background: #241c3d !important; border-color: #4c3d78 !important; color: #b49bf0 !important; }
html.theme-dark .adm-org-btn.is-ghost         { color: var(--app-ink-soft) !important; }
html.theme-dark .adm-org-btn.is-ghost:hover   { background: var(--app-surface) !important; }
html.theme-dark .adm-org-btn.is-send {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #16191f !important;
}

/* Fenêtre d'envoi de message */
html.theme-dark .adm-modal-box {
    background: var(--app-surface) !important;
    border-color: var(--app-line) !important;
}
html.theme-dark .adm-modal-head,
html.theme-dark .adm-modal-foot { border-color: var(--app-line) !important; }
html.theme-dark .adm-modal-title { color: var(--app-ink) !important; }
html.theme-dark .adm-modal-sub,
html.theme-dark .adm-field-help  { color: var(--app-ink-soft) !important; }
html.theme-dark .adm-modal-close {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink-soft) !important;
}
html.theme-dark .adm-modal-close:hover { color: var(--app-ink) !important; }
html.theme-dark .adm-field-label { color: var(--app-ink) !important; }
html.theme-dark .adm-field:focus { border-color: var(--app-accent) !important; }

/* Bandeaux de confirmation et d'erreur */
html.theme-dark .adm-flash.is-success { background: #123024 !important; border-color: #1f5c3c !important; color: #7ddba4 !important; }
html.theme-dark .adm-flash.is-error   { background: #3a1a1a !important; border-color: #7a2f2f !important; color: #f0a0a0 !important; }

/* Cellules a deux niveaux du tableau des organisateurs valides.
   Sans ces regles, .adm-cell-main garde son #0f172a d'origine et devient
   illisible sur fond sombre. */
html.theme-dark .adm-cell-main { color: var(--app-ink) !important; }
html.theme-dark .adm-cell-sub,
html.theme-dark .adm-cell-date { color: var(--app-ink-soft) !important; }

/* Barre de recherche du journal d'audit */
html.theme-dark .adm-audit-search input[type="search"] {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .adm-audit-search button {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #16191f !important;
}
html.theme-dark .adm-audit-clear { color: var(--app-ink-soft) !important; }
html.theme-dark .adm-audit-clear:hover { color: var(--app-ink) !important; }
html.theme-dark .org-action-badge {
    background: var(--app-surface-2) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .org-detail-text { color: var(--app-ink-soft) !important; }
html.theme-dark .org-date-text { color: var(--app-ink-soft) !important; }

/* -----------------------------------------------------------------------------
   9. Couleurs codees en dur dans les <style> des vues
   -----------------------------------------------------------------------------
   Plusieurs pages statiques (Devenir organisateur, A propos, Contact, FAQ,
   Aide, CGU, Confidentialite, Suivi de commande...) declarent leurs couleurs
   directement dans une balise <style>, sans passer par les variables du
   theme. En mode sombre, ces textes restaient noirs sur fond noir et
   devenaient illisibles.

   Les selecteurs ci-dessous rattachent ces valeurs fixes aux variables du
   theme. La palette claire n'est pas modifiee.
   -------------------------------------------------------------------------- */

/* Fonds clairs des pages statiques. */
html.theme-dark .sp-page,
html.theme-dark .sv-page {
    background: var(--app-bg) !important;
    color: var(--app-ink) !important;
}

/* Titres et textes principaux (#14110f). */
html.theme-dark .sp-page-heading h1,
html.theme-dark .sp-panel h2,
html.theme-dark .sp-card h2,
html.theme-dark .sp-page h1,
html.theme-dark .sp-page h2,
html.theme-dark .sp-page h3,
html.theme-dark .sp-page h4,
html.theme-dark .sp-page dt,
html.theme-dark .sp-page strong,
html.theme-dark .sv-page h1,
html.theme-dark .sv-page h2,
html.theme-dark .sv-card h2,
html.theme-dark .sv-muted strong,
html.theme-dark .sv-tickets strong,
html.theme-dark .cf-save-account-title,
html.theme-dark .cf-save-head strong,
html.theme-dark .cf-mail-head strong,
html.theme-dark .cf-save-account dd {
    color: var(--app-ink) !important;
}

/* Textes secondaires (#57534e, #6f6a64). */
html.theme-dark .sp-page p,
html.theme-dark .sp-page li,
html.theme-dark .sp-page dd,
html.theme-dark .sp-page small,
html.theme-dark .sp-back-link,
html.theme-dark .sp-organizer-hero-copy p,
html.theme-dark .sv-page p,
html.theme-dark .sv-muted,
html.theme-dark .sv-head p,
html.theme-dark .sv-tickets span,
html.theme-dark .cf-save-head span,
html.theme-dark .cf-mail-head span,
html.theme-dark .cf-save-hint,
html.theme-dark .cf-save-account dt,
html.theme-dark .cf-save-account p {
    color: var(--app-ink-soft) !important;
}

/* Cartes, encadres et panneaux sur fond blanc. */
html.theme-dark .sp-panel,
html.theme-dark .sp-card,
html.theme-dark .sp-organizer-hero,
html.theme-dark .sp-note,
html.theme-dark .sv-card,
html.theme-dark .cf-save-box,
html.theme-dark .cf-mail-box,
html.theme-dark .cf-save-account {
    background: var(--app-surface) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

/* Champs de saisie de ces memes pages. */
html.theme-dark .sv-form input,
html.theme-dark .cf-mail-form input,
html.theme-dark .cf-save-link input {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .sv-form input::placeholder,
html.theme-dark .cf-mail-form input::placeholder {
    color: var(--app-ink-faint) !important;
}

/* Pastilles et libelles d'accentuation. */
html.theme-dark .sp-eyebrow,
html.theme-dark .sp-organizer-kicker,
html.theme-dark .sv-pill,
html.theme-dark .cf-section-kicker {
    background: var(--app-surface-2) !important;
    color: var(--app-accent) !important;
}

/* Boutons secondaires a fond blanc : le texte sombre y reste lisible. */
html.theme-dark .sv-dl,
html.theme-dark .sp-btn-secondary {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

/* -----------------------------------------------------------------------------
   10. Boutons sombres devenus invisibles
   -----------------------------------------------------------------------------
   Certains boutons combinent un fond fonce fixe (#14110f, #1f2937) et un
   texte blanc. En mode sombre, la feuille eclaircit le fond sans toucher au
   texte : le libelle blanc disparaissait sur fond clair. On retablit un
   couple lisible.
   -------------------------------------------------------------------------- */
html.theme-dark .sv-form button,
html.theme-dark .cf-mail-form button,
html.theme-dark .sv-btn,
html.theme-dark .sp-btn-primary,
html.theme-dark .ho-btn-primary,
html.theme-dark .ct-btn-checkout,
html.theme-dark .co-btn-checkout,
html.theme-dark .cf-btn-primary {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #16191f !important;
}
html.theme-dark .sv-form button:hover,
html.theme-dark .cf-mail-form button:hover,
html.theme-dark .sp-btn-primary:hover,
html.theme-dark .ho-btn-primary:hover,
html.theme-dark .ct-btn-checkout:hover,
html.theme-dark .co-btn-checkout:hover {
    background: #ef8570 !important;
    border-color: #ef8570 !important;
    color: #16191f !important;
}

/* -----------------------------------------------------------------------------
   11. Cartes, vignettes et boutons restes clairs
   -----------------------------------------------------------------------------
   Les pages statiques partagent une meme structure : vignettes blanches
   (.sp-organizer-illustration), encadres pastel (.sp-mini-steps > div) et
   boutons a fond sombre. En mode sombre, ces fonds restaient clairs alors
   que le texte, lui, devenait clair : le libelle disparaissait.
   -------------------------------------------------------------------------- */
html.theme-dark .sp-organizer-illustration,
html.theme-dark .sp-organizer-art,
html.theme-dark .sp-mini-steps > div,
html.theme-dark .sp-list > li,
html.theme-dark .sp-faq-item,
html.theme-dark .sp-contact-card,
html.theme-dark .sp-info-card,
html.theme-dark .sp-step,
html.theme-dark .sp-feature-item {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

html.theme-dark .sp-organizer-illustration h3,
html.theme-dark .sp-organizer-illustration strong,
html.theme-dark .sp-mini-steps strong,
html.theme-dark .sp-page article h3,
html.theme-dark .sp-page article h4,
html.theme-dark .sp-feature-item strong {
    color: var(--app-ink) !important;
}
html.theme-dark .sp-organizer-illustration p,
html.theme-dark .sp-mini-steps p,
html.theme-dark .sp-page article p,
html.theme-dark .sp-feature-item p,
html.theme-dark .sp-small-note {
    color: var(--app-ink-soft) !important;
}

/* Pastilles numerotees : fond fonce et chiffre blanc a l'origine. */
html.theme-dark .sp-mini-steps span,
html.theme-dark .sp-feature-icon,
html.theme-dark .ho-step-num,
html.theme-dark .sp-step-num {
    background: var(--app-accent) !important;
    color: #16191f !important;
}

/* Boutons pleins. */
html.theme-dark .sp-button-accent,
html.theme-dark .hd-btn-cta,
html.theme-dark .ho-search-btn,
html.theme-dark .sp-button-dark {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #16191f !important;
}
html.theme-dark .sp-button-accent:hover,
html.theme-dark .hd-btn-cta:hover,
html.theme-dark .ho-search-btn:hover {
    background: #ef8570 !important;
    border-color: #ef8570 !important;
    color: #16191f !important;
}

/* Boutons a contour : le blanc d'origine devient la couleur du theme. */
html.theme-dark .sp-button-outline-light,
html.theme-dark .sp-button-outline {
    border-color: var(--app-line) !important;
    background: transparent !important;
    color: var(--app-ink) !important;
}
html.theme-dark .sp-button-outline-light:hover,
html.theme-dark .sp-button-outline:hover {
    border-color: var(--app-accent) !important;
    background: var(--app-surface-2) !important;
    color: var(--app-ink) !important;
}

/* Bandeaux d'accroche a fond fonce des pages statiques. */
html.theme-dark .sp-organizer-hero,
html.theme-dark .sp-hero,
html.theme-dark .sp-cta-band {
    background: var(--app-surface) !important;
    border-color: var(--app-line) !important;
}
html.theme-dark .sp-organizer-hero h2,
html.theme-dark .sp-hero h1,
html.theme-dark .sp-hero h2,
html.theme-dark .sp-cta-band h2 {
    color: var(--app-ink) !important;
}
html.theme-dark .sp-organizer-hero p,
html.theme-dark .sp-hero p,
html.theme-dark .sp-cta-band p {
    color: var(--app-ink-soft) !important;
}

/* -----------------------------------------------------------------------------
   12. Pied de page : variables redefinies localement
   -----------------------------------------------------------------------------
   views/footer.php declare ses variables sur .ft-footer lui-meme. Cette
   declaration l'emporte sur celle posee plus haut sur html.theme-dark : le
   pied de page restait donc en palette claire (texte #14110f sur fond
   sombre). On les redefinit avec une specificite superieure.
   -------------------------------------------------------------------------- */
html.theme-dark .ft-footer {
    --ft-ink:        #e8eaed;
    --ft-ink-soft:   #aab2be;
    --ft-ink-faint:  #7f8894;
    --ft-line:       #2a303a;
    --ft-surface:    #161a21;
    --ft-canvas:     #12151b;
    --ft-accent:     #e2705a;
}

/* Les pastilles reseaux sociaux utilisent l'encre comme fond. */
html.theme-dark .ft-social-btn {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

/* -----------------------------------------------------------------------------
   13. Surfaces claires restantes des pages statiques
   -----------------------------------------------------------------------------
   Liste etablie en analysant les balises <style> des vues : toutes les
   classes dont le fond est fixe a #fff, #faf8f5 ou #fff7f4. Sans ces
   regles, le fond restait blanc alors que le texte devenait clair.
   -------------------------------------------------------------------------- */
html.theme-dark .sp-callout,
html.theme-dark .sp-callout-light,
html.theme-dark .sp-contact-art,
html.theme-dark .sp-contact-illustration,
html.theme-dark .sp-faq-art,
html.theme-dark .sp-faq-illustration,
html.theme-dark .sp-faq-list details,
html.theme-dark .sp-form-field,
html.theme-dark .sp-help-art,
html.theme-dark .sp-help-illustration,
html.theme-dark .sp-illustration-art,
html.theme-dark .sp-illustration-card,
html.theme-dark .sp-legal-document,
html.theme-dark .sp-terms-document,
html.theme-dark .sp-terms-document-head,
html.theme-dark .sp-terms-highlight,
html.theme-dark .sp-terms-nav,
html.theme-dark .sp-terms-note,
html.theme-dark .sp-terms-section,
html.theme-dark .sp-terms-section-art,
html.theme-dark .lg-card,
html.theme-dark .lg-contact-note,
html.theme-dark .lg-legal-card,
html.theme-dark .lg-notice,
html.theme-dark .cf-empty-state,
html.theme-dark .cf-notice-icon {
    background: var(--app-surface) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}

/* Titres et textes contenus dans ces surfaces. */
html.theme-dark .sp-callout h3,
html.theme-dark .sp-callout strong,
html.theme-dark .sp-terms-section h2,
html.theme-dark .sp-terms-section h3,
html.theme-dark .sp-terms-document h2,
html.theme-dark .sp-legal-document h2,
html.theme-dark .sp-legal-document h3,
html.theme-dark .lg-card h2,
html.theme-dark .lg-title,
html.theme-dark .lg-label,
html.theme-dark .lg-legal-card h3,
html.theme-dark .cf-empty-state h1 {
    color: var(--app-ink) !important;
}
html.theme-dark .sp-callout p,
html.theme-dark .sp-terms-section p,
html.theme-dark .sp-terms-section li,
html.theme-dark .sp-terms-note,
html.theme-dark .sp-legal-document p,
html.theme-dark .sp-legal-document li,
html.theme-dark .lg-card p,
html.theme-dark .lg-subtitle,
html.theme-dark .lg-field-value,
html.theme-dark .lg-contact-note,
html.theme-dark .cf-empty-state p {
    color: var(--app-ink-soft) !important;
}

/* Numeros de section et marqueurs discrets. */
html.theme-dark .sp-terms-section-number,
html.theme-dark .sp-terms-section-mark,
html.theme-dark .ft-legal-sep {
    color: var(--app-ink-faint) !important;
}

/* Champs de formulaire des pages statiques. */
html.theme-dark .sp-form-field input,
html.theme-dark .sp-form-field textarea,
html.theme-dark .sp-form-field select,
html.theme-dark .lg-input {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .sp-form-field input::placeholder,
html.theme-dark .sp-form-field textarea::placeholder,
html.theme-dark .lg-input::placeholder {
    color: var(--app-ink-faint) !important;
}

/* -----------------------------------------------------------------------------
   14. Derniers textes fixes : FAQ, sommaire, formulaires, etats vides
   -------------------------------------------------------------------------- */
html.theme-dark .sp-faq-question,
html.theme-dark .sp-faq-list summary,
html.theme-dark .sp-terms-nav-label,
html.theme-dark .sp-form-field label,
html.theme-dark .sp-page label,
html.theme-dark .ct-empty h3,
html.theme-dark .ct-page h3,
html.theme-dark .sp-page h2,
html.theme-dark .lg-page h2 {
    color: var(--app-ink) !important;
}

html.theme-dark .sp-faq-answer,
html.theme-dark .sp-faq-list details p,
html.theme-dark .sp-terms-nav a,
html.theme-dark .sp-check-list span,
html.theme-dark .sp-page-heading + p,
html.theme-dark .ct-empty p {
    color: var(--app-ink-soft) !important;
}

html.theme-dark .sp-terms-nav a:hover {
    color: var(--app-accent) !important;
}

/* Encadres d'alerte et liens colores des mentions legales. */
html.theme-dark .lg-todo,
html.theme-dark .lg-warning,
html.theme-dark .lg-page strong {
    color: var(--app-accent) !important;
}
html.theme-dark .lg-page a,
html.theme-dark .sp-page a:not(.sp-button):not(.sp-back-link) {
    color: var(--app-accent) !important;
}

/* Titres de section restes tres sombres sur le fond de page. */
html.theme-dark .sp-shell > h2,
html.theme-dark .lg-wrap > h2,
html.theme-dark .sp-section-title {
    color: var(--app-ink) !important;
}

/* -----------------------------------------------------------------------------
   15. Derniers cas isoles
   -------------------------------------------------------------------------- */
/* Liste de valeurs de la page A propos. */
html.theme-dark .sp-value-list span,
html.theme-dark .sp-value-list li {
    color: var(--app-ink-soft) !important;
}

/* Titre de section de la page Confidentialite. */
html.theme-dark .pv-heading h2,
html.theme-dark .pv-heading {
    color: var(--app-ink) !important;
}

/* Bouton violet des mentions legales : le texte accent devenait illisible. */
html.theme-dark .lg-side-link {
    background: var(--app-surface-2) !important;
    border-color: var(--app-line) !important;
    color: var(--app-ink) !important;
}
html.theme-dark .lg-side-link:hover {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #16191f !important;
}

/* Encadre "Previsualiser le billet" du formulaire de creation d'evenement.
   Sans cette regle le bloc garderait son fond clair (#f8fafc) en mode sombre. */
html.theme-dark .org-preview-row {
    background: var(--app-surface-2);
    border-color: var(--app-line);
}
html.theme-dark .org-preview-hint {
    color: var(--app-ink-soft);
}

/* Bloc "aucun billet" du detail de commande (attente / echec / remboursement). */
/* Specificite alignee sur ".od-empty p.od-empty-lead" (0,2,1) de la vue :
   sans le "p" le titre restait en encre sombre sur fond sombre, donc illisible. */
html.theme-dark .od-empty p.od-empty-lead { color: var(--app-ink); }
html.theme-dark .od-empty p.od-empty-sub { color: var(--app-ink-soft); }
html.theme-dark .od-empty-cta { background: var(--app-accent); color: #14161b; }
html.theme-dark .od-empty-cta-soft { background: transparent; color: var(--app-ink); border-color: var(--app-line); }

/* Detail de la transaction (page=order). */
html.theme-dark .od-tx { background: var(--app-surface); border-color: var(--app-line); }
html.theme-dark .od-tx-line { border-bottom-color: var(--app-line); }
html.theme-dark .od-tx dt { color: var(--app-ink-soft); }
html.theme-dark .od-tx dd, html.theme-dark .od-tx-total dt { color: var(--app-ink); }
html.theme-dark .od-tx-cta-hint { color: var(--app-ink-faint); }

/* Billets dans "Mes billets" (page=profile#billets). */
html.theme-dark .org-ticket-block { border-bottom-color: var(--app-line); }
html.theme-dark .org-ticket-block .od-btn-outline {
    background: var(--app-surface-2);
    border-color: var(--app-line);
    color: var(--app-ink);
}
html.theme-dark .org-ticket-block .od-btn-outline:hover { background: var(--app-surface); }

/* Bandeau de reassurance de l'accueil (moyens de paiement + chiffres). */
html.theme-dark .ho-trust-card {
    background: var(--app-surface);
    border-color: var(--app-line);
    box-shadow: none;
}
html.theme-dark .ho-pay-item {
    background: var(--app-surface-2);
    border-color: var(--app-line);
}
html.theme-dark .ho-pay-name,
html.theme-dark .ho-stat-num,
html.theme-dark .ho-trust-note strong { color: var(--app-ink); }
html.theme-dark .ho-trust-note,
html.theme-dark .ho-stat-label { color: var(--app-ink-soft); }
html.theme-dark .ho-trust-label { color: var(--app-ink-faint); }
html.theme-dark .ho-trust-stats { border-top-color: var(--app-line); }
html.theme-dark .ho-guest-note { background: var(--app-surface); border-color: var(--app-line); color: var(--app-ink-soft); }
html.theme-dark .ho-guest-note strong { color: var(--app-ink); }

/* Couverture geographique de l'accueil. */
html.theme-dark .ho-country { background: var(--app-surface); border-color: var(--app-line); box-shadow: none; }
html.theme-dark .ho-country:hover { border-color: var(--app-ink-faint); box-shadow: none; }
html.theme-dark .ho-country-name { color: var(--app-ink); }
/* Vignette claire conservee sous le drapeau : plusieurs drapeaux ont du
   blanc dans leur composition et disparaitraient sur fond sombre. */
html.theme-dark .ho-country-flag { background: rgba(255, 255, 255, .10); }
html.theme-dark .ho-country-live {
    background: rgba(31, 122, 82, .16);
    border-color: rgba(31, 122, 82, .48);
}
html.theme-dark .ho-country-live .ho-country-flag { background: rgba(255, 255, 255, .16); }
html.theme-dark .ho-country-live .ho-country-name { color: var(--app-ink); }
/* Double classe : la regle claire ".ho-country-live .ho-country-tag" est
   plus specifique et ecrasait la version sombre, laissant un vert fonce
   illisible sur fond sombre. */
html.theme-dark .ho-country .ho-country-tag { background: rgba(110, 231, 160, .18); color: #7cf0ae; }
html.theme-dark .ho-coverage-head strong { color: var(--app-ink); }
html.theme-dark .ho-flag-code { color: var(--app-ink-soft); }

/* FAQ de l'accueil. */
html.theme-dark .ho-faq-item { background: var(--app-surface); border-color: var(--app-line); }
html.theme-dark .ho-faq-q { color: var(--app-ink); }
html.theme-dark .ho-faq-a { color: var(--app-ink-soft); }

/* Bandeau de reassurance et section applications de l'accueil. */
html.theme-dark .ho-trust-note { background: var(--app-surface-2); color: var(--app-ink-soft); }
html.theme-dark .ho-trust-stats { border-left-color: var(--app-line); border-top-color: var(--app-line); }
html.theme-dark .ho-pay-item:hover { border-color: var(--app-ink-faint); }
/* Les logos Orange Money et Africell comportent du texte noir, illisible
   sur fond sombre. On garde donc une pastille claire sous chaque logo :
   c'est aussi la facon dont ces marques sont affichees sur fond fonce. */
html.theme-dark .ho-pay-item { background: #ffffff; border-color: rgba(255,255,255,.16); }
html.theme-dark .ho-pay-item:hover { background: #ffffff; border-color: rgba(255,255,255,.32); }
