/* =========================================================================
   YorkHost — mode sombre, couche fixe
   Le gros de la conversion est fait par js/yh-dark-engine.js (couleurs des
   feuilles et des modules remplacées par la palette du panel). Ici : la base
   de page, ce que le moteur ne peut pas atteindre (contrôles natifs,
   barres de défilement, autofill) et le sélecteur de thème.
   ========================================================================= */

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

/* Pendant la conversion (quelques ms) : fond sombre, contenu masqué → aucun flash blanc.
   Le script d'amorçage retire cette classe au plus tard après 2,5 s. */
html.yh-dk-pending body { visibility: hidden; }
html[data-theme="dark"] body { background: #171717; }

/* Fond de page : un cran sous les cartes, comme le panel (#171717 / #1D1D1D). */
html[data-theme="dark"] body,
html[data-theme="dark"] body .body-content,
html[data-theme="dark"] body .section-main {
  background: #171717 !important;
}

html[data-theme="dark"] ::selection { background: rgba(147, 91, 240, 0.4); color: #F4F2F7; }
html[data-theme="dark"] ::placeholder { color: #8C8994 !important; opacity: 1; }

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill {
  -webkit-text-fill-color: #E8E6ED !important;
  -webkit-box-shadow: 0 0 0 1000px #232323 inset !important;
  caret-color: #E8E6ED;
}

html[data-theme="dark"] * { scrollbar-color: #34333A transparent; }
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #34333A; border-radius: 9999px; border: 2px solid #171717; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4A4852; }

/* Images sur fond blanc intégré (captures, logos tiers) : légère atténuation. */
html[data-theme="dark"] img:not([src$=".svg"]):not([data-yh-nodark]) { filter: brightness(0.92); }
html[data-theme="dark"] .navbar-brand img { filter: none; }

/* =========================================================================
   Sélecteur de thème (barre du haut)
   ========================================================================= */
.yh-theme-toggle { position: relative; }
.yh-theme-toggle .yh-theme-btn { width: 36px; padding: 7px 0 !important; justify-content: center; }
.yh-theme-toggle .yh-theme-ic { display: none; width: 16px; height: 16px; }
html:not([data-theme="dark"]) .yh-theme-toggle .yh-theme-ic-sun { display: block; }
html[data-theme="dark"] .yh-theme-toggle .yh-theme-ic-moon { display: block; }

.navbar.navbar-modern .dropdown-menu.yh-theme-menu { min-width: 200px; }
.yh-theme-menu .yh-theme-title { display: block; padding: 4px 10px 6px; font-size: 12px; font-weight: 500; color: #6B6B73; }
.navbar.navbar-modern .yh-theme-menu .dropdown-item { min-height: 40px; }
.yh-theme-menu .dropdown-item .yh-theme-hint { margin-left: auto; font-size: 12px; color: #6B6B73; }
.navbar.navbar-modern .yh-theme-menu .dropdown-item.active,
.navbar.navbar-modern .yh-theme-menu .dropdown-item.active:hover {
  background: rgba(118, 59, 212, 0.10) !important;
  color: #763BD4 !important;
}
.navbar.navbar-modern .yh-theme-menu .dropdown-item.active svg.yh-lucide { color: #763BD4; }
html[data-theme="dark"] .navbar.navbar-modern .yh-theme-menu .dropdown-item.active,
html[data-theme="dark"] .navbar.navbar-modern .yh-theme-menu .dropdown-item.active:hover {
  background: rgba(118, 59, 212, 0.16) !important;
  color: #C4A6F7 !important;
}
html[data-theme="dark"] .navbar.navbar-modern .yh-theme-menu .dropdown-item.active svg.yh-lucide { color: #C4A6F7; }
