/* ====================================================
   Arms — Design tokens
   ==================================================== */

:root {
    /* Couleurs */
    --c-bg: #0A0A0D;
    --c-bg-soft: #0F0F13;
    --c-surface: #15151A;
    --c-surface-2: #1B1B21;
    --c-border: #27272E;
    --c-border-strong: #35353F;
    --c-text: #F5F5F7;
    --c-text-muted: #C8C8CC;
    --c-text-dim: #7B7B85;
    --c-red: #E8323C;
    --c-red-glow: #FF4D57;
    --c-red-dim: #7A1F26;
    --c-green-live: #3DDC84;

    /* Typo */
    --f-display: "Space Grotesk", sans-serif;
    --f-body: "Inter", sans-serif;
    --f-mono: "JetBrains Mono", monospace;

    /* Radius / espace */
    --r-card: 14px;
    --r-pill: 999px;
    --gap-section: clamp(64px, 8vw, 120px);

    /* Ombres / glow */
    --glow-red: 0 0 24px rgba(var(--c-secondary-rgb), 0.35);
    --glow-red-soft: 0 0 40px rgba(var(--c-secondary-rgb), 0.18);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

/* Scrollbar custom, site entier (au lieu de celle par défaut du
   navigateur) : Firefox via scrollbar-width/scrollbar-color sur html
   (s'applique à la fenêtre ET est hérité par tout élément scrollable qui
   ne redéfinit pas ces propriétés lui-même) ; Chrome/Edge/Opera via
   ::-webkit-scrollbar sur * puisque ces propriétés ne s'héritent pas et
   doivent être posées sur chaque élément scrollable (fenêtre comprise,
   ciblée ici via html/body). Des règles plus spécifiques (ex: le panneau
   de debug, voir debug-bar.css) peuvent toujours surcharger ces couleurs
   par contexte. */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--c-red-dim) var(--c-bg-soft);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: var(--c-bg-soft);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--c-red-dim);
    border-radius: var(--r-pill);
    border: 2px solid var(--c-bg-soft);
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--c-red);
}

*::-webkit-scrollbar-corner {
    background: var(--c-bg-soft);
}

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--f-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* Colonne flex pleine hauteur : le footer (dernier enfant direct du
     body, après <main>) reste collé en bas même quand le contenu de la
     page est plus court que la fenêtre — voir main { flex: 1 } ci-dessous
     et la règle .site-footer dans layout.css qui n'a plus besoin de marge. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body>main {
    flex: 1 0 auto;
}

h1,
h2,
h3,
h4 {
    font-family: var(--f-display);
    margin: 0;
    letter-spacing: -0.01em;
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
select {
    font-family: inherit;
}

::selection {
    background: var(--c-red);
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--c-red-glow);
    outline-offset: 3px;
    border-radius: 4px;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: var(--gap-section) 0;
    position: relative;
}

.eyebrow {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-red-glow);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-red-glow);
    box-shadow: var(--glow-red);
}

.section-title {
    font-size: clamp(28px, 3.4vw, 40px);
    margin-bottom: 12px;
}

.section-sub {
    color: var(--c-text-muted);
    font-size: 16px;
    max-width: 560px;
    line-height: 1.6;
    margin-bottom: 40px;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: var(--r-pill);
    font-size: 14.5px;
    font-weight: 600;
    font-family: var(--f-body);
    border: 1px solid transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--c-red);
    color: #fff;
}

.btn-primary:hover {
    background: var(--c-red-glow);
    box-shadow: var(--glow-red);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--c-text);
    border-color: var(--c-border-strong);
}

.btn-ghost:hover {
    border-color: var(--c-red);
    color: var(--c-red-glow);
    background: rgba(var(--c-secondary-rgb), 0.06);
}

.btn-sm {
    padding: 9px 18px;
    font-size: 13px;
}

.btn-danger {
    background: #B91C24;
    color: #fff;
}

.btn-danger:hover {
    background: #ff5c5c;
    box-shadow: 0 0 24px rgba(255, 92, 92, 0.35);
    transform: translateY(-1px);
}

/* ---------- Cartes ---------- */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    padding: 24px;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.card:hover {
    border-color: var(--c-red-dim);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card), var(--glow-red-soft);
}

/* ---------- Badges / tags ---------- */
.badge {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--c-border-strong);
    color: var(--c-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-live {
    color: var(--c-green-live);
    border-color: rgba(61, 220, 132, 0.35);
    background: rgba(61, 220, 132, 0.08);
}

.badge-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-green-live);
    box-shadow: 0 0 8px rgba(61, 220, 132, 0.8);
    animation: pulse-dot 1.6s ease-in-out infinite;
}

.badge-off {
    color: var(--c-text-dim);
}

.badge-off::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-text-dim);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ---------- Inputs ---------- */
.input {
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    color: var(--c-text);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.2s ease;
}

.input::placeholder {
    color: var(--c-text-dim);
}

.input:focus,
.input:focus-visible {
    border-color: var(--c-red);
    outline: none;
}

/* ---------- Checkbox ---------- */
/* Case à cocher personnalisée façon "carte cochée", cohérente avec le
   thème — remplace le rendu par défaut du navigateur (gris, anguleux)
   tout en gardant un <input type="checkbox"> natif (accessibilité,
   comportement clavier, soumission de formulaire inchangés). */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    border: 1.5px solid var(--c-border-strong);
    border-radius: 5px;
    background: var(--c-surface);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
    vertical-align: middle;
}

input[type="checkbox"]:hover {
    border-color: var(--c-red-dim);
}

input[type="checkbox"]:checked {
    background: var(--c-red);
    border-color: var(--c-red);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--c-red-glow);
    outline-offset: 2px;
}

input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Number ---------- */
/* Mêmes dimensions que .input, mais flèches d'incrément/décrément
   recolorées pour rester lisibles sur fond sombre (le natif les rend
   souvent invisibles ou mal contrastées sur un thème dark). */
.input[type="number"] {
    font-family: var(--f-mono);
}

.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    filter: invert(1) brightness(1.6);
    cursor: pointer;
}

/* ---------- Datetime / Date / Time ---------- */
/* L'icône calendrier/horloge native est très sombre par défaut (pensée
   pour un fond clair) : invert() la rend visible sur le thème sombre du
   site sans avoir à reconstruire l'intégralité du widget natif.

   Le POPUP qui s'ouvre au clic (calendrier + colonnes heure/minute) est
   un widget système rendu directement par le navigateur/OS — son layout
   et ses couleurs de fond ne sont PAS personnalisables en CSS au-delà de
   color-scheme (qui bascule déjà son fond en sombre). accent-color est
   en revanche le seul levier qui influence la couleur des cases
   sélectionnées (jour du mois, heure, minute) à l'intérieur de ce
   popup — sans lui, ces cases restent bleues (couleur système) même
   si tout le reste du popup est déjà en thème sombre. */
.input[type="datetime-local"],
.input[type="date"],
.input[type="time"] {
    font-family: var(--f-mono);
    color-scheme: dark;
    accent-color: var(--c-red);
}

.input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.9);
    cursor: pointer;
    border-radius: 4px;
}

.input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
.input[type="date"]::-webkit-calendar-picker-indicator:hover,
.input[type="time"]::-webkit-calendar-picker-indicator:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ---------- Color picker ---------- */
/* Pattern : un input[type=color] (la pastille cliquable) toujours
   couplé à un champ texte hex à côté (voir .color-field dans les vues) —
   le picker natif ne permet pas de saisir un hex précis au clavier,
   le texte comble ce manque. */
.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--c-border-strong);
    border-radius: 10px;
    background: var(--c-surface);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

input[type="color"]:hover {
    border-color: var(--c-red-dim);
}

input[type="color"]:focus-visible {
    outline: 2px solid var(--c-red-glow);
    outline-offset: 2px;
}

/* Neutralise le padding interne natif du swatch pour qu'il remplisse
   complètement le carré (sinon Chrome/Firefox laissent une bordure grise
   visible à l'intérieur, qui casse l'arrondi défini ci-dessus). */
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 9px;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 9px;
}

/* ---------- File ---------- */
/* Le bouton "Parcourir" natif est recolore pour matcher le thème ; le
   texte "Aucun fichier choisi" reste celui du navigateur (pas de moyen
   fiable de le personnaliser sans reconstruire tout le widget en JS). */
.input[type="file"] {
    padding: 8px 12px;
    cursor: pointer;
}

.input[type="file"]::file-selector-button {
    font-family: var(--f-body);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--c-red);
    border: none;
    border-radius: var(--r-pill);
    padding: 8px 16px;
    margin-right: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.input[type="file"]::file-selector-button:hover {
    background: var(--c-red-glow);
}

/* ---------- Select / Option ---------- */
/* Flèche personnalisée en SVG (la flèche native ne peut pas être
   recolorée par CSS) ; les <option> héritent du thème sombre dans les
   navigateurs qui le permettent (Chrome/Firefox récents) — certains
   navigateurs ignorent le style des <option> et affichent leur menu
   déroulant natif du système, ce qui est une limitation connue et
   acceptée du HTML natif, pas un bug de ce CSS. */
select.input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237B7B85' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

select.input option {
    background: var(--c-surface);
    color: var(--c-text);
}

select.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-search {
    position: relative;
}

.input-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--c-text-dim);
}

.input-search input {
    padding-left: 40px;
}

/* ---------- Filtres pill ---------- */
.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.filter-pill {
    font-family: var(--f-mono);
    font-size: 12.5px;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    border: 1px solid var(--c-border-strong);
    background: transparent;
    color: var(--c-text-muted);
    transition: all 0.2s ease;
}

.filter-pill:hover {
    border-color: var(--c-red-dim);
    color: var(--c-text);
}

.filter-pill.active {
    background: var(--c-red);
    border-color: var(--c-red);
    color: #fff;
}

/* ---------- Grilles ---------- */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 980px) {
    .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {

    .grid-6,
    .grid-5,
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ---------- Tooltip personnalisé (attribut title) ---------- */
/* Remplace le tooltip natif du navigateur (gris clair, anguleux, lent à
   apparaître) sur les boutons icônes du dashboard, qui n'ont qu'une
   icône sans texte visible — le title="..." reste dans le HTML pour
   l'accessibilité (lecteurs d'écran), mais son rendu visuel est repris
   entièrement en CSS pour rester cohérent avec le thème sombre. */
.icon-btn[title],
.md-tool-btn[title],
.icon-badge[title] {
    position: relative;
}

.icon-btn[title]::after,
.md-tool-btn[title]::after,
.icon-badge[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--c-surface-2);
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    font-family: var(--f-body);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 7px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 200;
}

.icon-btn[title]:hover::after,
.md-tool-btn[title]:hover::after,
.icon-badge[title]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.3s;
    /* léger délai, comme un tooltip natif, pour éviter un clignotement au survol rapide */
}

/* ---------- Tooltip 100% custom (attribut data-tooltip, sans title) ---------- */
/* Variante du tooltip ci-dessus mais SANS attribut title="" : title
   déclenche toujours la bulle native grise du navigateur après ~1s de
   survol, en plus du style personnalisé — ce qui n'est pas souhaitable
   partout (ex. badges de /profil). Ici on lit data-tooltip à la place,
   qui n'a aucun comportement natif, donc seul le style ci-dessous
   s'affiche. aria-label doit être posé en parallèle sur l'élément pour
   les lecteurs d'écran (data-tooltip n'est pas lu par les technologies
   d'assistance). */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--c-surface-2);
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    font-family: var(--f-body);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 7px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 200;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.3s;
}

/* ---------- Texte accessible caché visuellement (sr-only) ---------- */
/* Classe utilitaire réutilisable : garde un texte lisible par les lecteurs
   d'écran (nom accessible d'un bouton icône, ex. .perm-dot en /stream)
   sans l'afficher à l'écran. Valeurs standard (Tailwind/Bootstrap). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ---------- Badges icônes (statuts de compte : broadcaster, mod, VIP...) ---------- */
/* Le nom du badge n'est plus affiché en texte à côté de l'icône : il est
   uniquement dans l'attribut title, lu au survol via le tooltip ci-dessus
   (et toujours disponible pour les lecteurs d'écran).

   Broadcaster/Modérateur/VIP/Abonné affichent la vraie image de badge
   Twitch (18×18, sans cercle de fond — ces images ont déjà leur propre
   design complet, un cercle autour dénaturerait leur apparence connue).
   Banni/Timeout (sans équivalent Twitch officiel) restent en icône SVG
   dans un cercle coloré, pour rester visuellement distincts. */
.icon-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.icon-badge img {
    width: 18px;
    height: 18px;
}

.icon-badge svg {
    width: 15px;
    height: 15px;
}

/* Le cercle de fond ne s'applique qu'aux icônes SVG génériques (banni,
   timeout, via .icon-badge-fallback ajoutée en JS) — pas aux <img> des
   vraies images de badge Twitch, qui ont déjà leur propre design complet. */
.icon-badge.icon-badge-fallback {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border-strong);
    color: var(--c-text-muted);
}

.icon-badge-live {
    background: rgba(61, 220, 132, 0.12);
    border-color: rgba(61, 220, 132, 0.35);
    color: var(--c-green-live);
}

.icon-badge-warn {
    background: rgba(245, 166, 35, 0.12);
    border-color: rgba(245, 166, 35, 0.35);
    color: #f5a623;
}

.icon-badge-off {
    background: rgba(var(--c-secondary-rgb), 0.12);
    border-color: rgba(var(--c-secondary-rgb), 0.35);
    color: var(--c-red-glow);
}


/* .logo est partagé entre le header (dans la grille .header-inner) et le
   footer (dans .footer-brand, un simple bloc) : le style de marque de
   base (icône + nom alignés) doit s'appliquer aux deux, mais le
   placement en grille (grid-column/justify-self) ne doit viser QUE le
   header — sinon on risque de la contamination croisée entre les deux
   contextes pour un gain nul (ces propriétés sont de toute façon ignorées
   hors d'un parent en display:grid, mais autant ne pas les y laisser). */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--f-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--c-text);
}

.header-inner .logo {
    grid-column: 2;
    justify-self: center;
}

.logo .logo-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo .logo-under {
    color: var(--c-text-dim);
    font-weight: 400;
}

.logo .logo-red {
    color: var(--c-red-glow);
}

.logo-image {
    width: 4rem;
    object-fit: cover;
}

/* Arrondi optionnel (voir "Logo arrondi" dans /dashboard/parametres et
   SettingModel::get('site_logo_rounded') dans header.php/footer.php) :
   classe ajoutée seulement si le réglage est activé, plutôt qu'un
   border-radius par défaut qu'il faudrait retirer — plus simple à faire
   correspondre à une checkbox "cochée = comportement actif". */
.logo-image.is-rounded {
    border-radius: 50%;
}