/* ============================================================
   theme.css — Design system Multimat.tv (V3)
   Système de thème clair / sombre + jeu de tokens (couleurs,
   rayons, ombres) utilisé par TOUT le CSS du site.

   À inclure APRÈS le CSS existant (style-index.css ou
   style-admin.css), pour que ces variables prennent le dessus :

   <link rel="stylesheet" href="/assets/css/style-index.css">
   <link rel="stylesheet" href="/assets/css/theme.css">

   V3 : style-index.css et style-admin.css ont été entièrement
   retokénisés (plus aucune couleur codée en dur) — la plupart des
   anciens correctifs [data-theme="light"] ci-dessous ont donc pu
   être supprimés, les composants s'adaptent maintenant tout seuls.
   ============================================================ */

:root,
[data-theme="dark"] {
    /* ── Surfaces & texte (existant, inchangé) ── */
    --bg-color: #0f1115;
    --card-bg: #1a1d24;
    --card-bg-alt: #1e2128;
    --text-main: #f1f1f1;
    --text-muted: #8b92a5;
    --accent: #7c5fe8;
    --accent-hover: #9178ed;
    --accent-rgb: 124, 95, 232;
    --border-color: #2a2d35;
    --shadow-color: rgba(0, 0, 0, 0.35);
    --input-bg: #0a0c10;
    --overlay-bg: rgba(0, 0, 0, 0.75);

    /* ── Nouveaux tokens sémantiques (V3) ── */
    --color-warm: #ff7a59;           /* corail — CTA/highlights secondaires */
    --color-warm-hover: #ff9278;
    --color-danger: #ff4757;
    --color-danger-hover: #ff6b81;
    --danger-rgb: 255, 71, 87;
    --color-success: #28a745;
    --success-rgb: 40, 167, 69;
    --color-warning: #f5c518;        /* favoris, notes */
    --warning-rgb: 245, 197, 24;
    --color-rec: #ff0000;            /* bouton clip/enregistrement coaching */
    --color-rec-hover: #cc0000;
    --rec-rgb: 255, 0, 0;

    /* Surface "creusée" translucide (remplace les innombrables
       rgba(255,255,255,0.03/0.05/0.06) et rgba(0,0,0,0.2/0.3)
       disséminés dans l'ancien CSS — même intention partout :
       une zone visuellement différenciée à l'intérieur d'une carte) */
    --surface-hover: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(26, 29, 36, 0.95);

    /* ── Rayons ── */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 50px;

    /* ── Ombres ── */
    --shadow-sm: 0 4px 15px var(--shadow-color);
    --shadow-md: 0 8px 30px var(--shadow-color);
    --shadow-glow-accent: 0 0 30px rgba(var(--accent-rgb), 0.3);
}

[data-theme="light"] {
    --bg-color: #f4f5f8;
    --card-bg: #ffffff;
    --card-bg-alt: #edeef3;
    --text-main: #1a1d24;
    --text-muted: #5c6273;
    --accent: #7c5fe8;
    --accent-hover: #6a4cd8;
    --accent-rgb: 124, 95, 232;
    --border-color: #e2e4ea;
    --shadow-color: rgba(20, 20, 40, 0.08);
    --input-bg: #ffffff;
    --overlay-bg: rgba(15, 17, 21, 0.55);

    --color-warm: #ff7a59;
    --color-warm-hover: #e8663f;
    --color-danger: #e0364a;
    --color-danger-hover: #ff6b81;
    --danger-rgb: 224, 54, 74;
    --color-success: #1f8838;
    --success-rgb: 31, 136, 56;
    --color-warning: #c99400;
    --warning-rgb: 201, 148, 0;
    --color-rec: #e0364a;
    --color-rec-hover: #c22e40;
    --rec-rgb: 224, 54, 74;

    --surface-hover: rgba(15, 17, 25, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.9);

    --shadow-sm: 0 4px 15px var(--shadow-color);
    --shadow-md: 0 8px 30px var(--shadow-color);
    --shadow-glow-accent: 0 0 30px rgba(var(--accent-rgb), 0.15);
}

/* Petites choses qui ne passent pas par des variables dans le CSS existant */
[data-theme="light"] body { background-color: var(--bg-color); }
[data-theme="light"] .logo-wrapper { border: 1px solid var(--border-color); }

/* ── Corrections de mise en page (ajouts v2 : compte + thème dans le header) ──
   Le header contient maintenant plus d'éléments à droite qu'à l'origine.
   Ces règles évitent tout débordement/chevauchement, sans toucher au
   fichier CSS d'origine (chargé avant celui-ci). */
.header {
    flex-wrap: wrap;
    row-gap: 8px;
}
.event-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    padding: 0 10px;
}
.header > div:last-child {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 6px;
}
.header a[href="account.php"] {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
@media (max-width: 768px) {
    .header > div:last-child {
        justify-content: center;
        width: 100%;
    }
    .event-title {
        text-align: center;
        white-space: normal;
    }
}

/* Transition douce lors du changement de thème (pas sur tout, pour rester léger) */
body, .card, .header, .sidebar, .mat-card, .coaching-card, .feedback-card,
input, textarea, select, button {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ── Bouton toggle thème ──────────────────────────────────
   Marquage attendu :
   <button class="theme-toggle" onclick="toggleTheme()" title="Changer de thème" aria-label="Changer de thème">
       <i class="dripicons-brightness-max icon-sun"></i>
       <i class="dripicons-brightness-low icon-moon"></i>
   </button>
   ------------------------------------------------------------ */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.push-toggle.is-active { color: var(--accent); border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }

/* En mode sombre on affiche l'icône soleil (= cliquer pour passer en clair) */
[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
/* En mode clair on affiche l'icône lune (= cliquer pour repasser en sombre) */
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }

/* ── Accessibilité clavier : indicateur de focus ──────────
   Ne s'affiche qu'à la navigation clavier (:focus-visible), jamais au
   clic souris — évite le contour disgracieux au clic tout en gardant
   un repère net pour qui navigue au Tab. Les inputs avaient déjà un
   focus (changement de border-color) : on garde ce comportement et on
   ajoute juste l'anneau, cohérent avec le reste. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── Micro-interactions au clic ───────────────────────────
   Léger "enfoncement" au clic sur les éléments cliquables, en plus des
   effets :hover déjà en place (translateY, changement de couleur...).
   Placé ici (theme.css charge en dernier) pour prendre le dessus sur le
   translateY(-2px) au survol quand le clic et le survol coexistent. */
button:active,
.btn-save:active,
.btn-primary:active,
.btn-retirer:active,
.btn-frame:active,
.btn-speed:active,
.btn-clip:active,
.btn-clip-action:active,
.theme-toggle:active,
.view-toggle-btn:active,
.event-list-item:active,
.mat-card:active,
.partner-card:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}
