/* ============================================================
   theme.css — Système de thème clair / sombre — Multimat.tv
   À inclure sur TOUTES les pages, APRÈS le CSS existant
   (style-index.css ou style-admin.css), pour que ces variables
   prennent le dessus :

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

:root,
[data-theme="dark"] {
    --bg-color: #0f1115;
    --card-bg: #1a1d24;
    --card-bg-alt: #1e2128;
    --text-main: #f1f1f1;
    --text-muted: #8b92a5;
    --accent: #7c5fe8;
    --accent-hover: #9178ed;
    --border-color: #2a2d35;
    --shadow-color: rgba(0, 0, 0, 0.35);
    --input-bg: #0a0c10;
    --overlay-bg: rgba(0, 0, 0, 0.75);
}

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

/* 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 { background: #fff; border: 1px solid var(--border-color); }
[data-theme="light"] .btn-frame,
[data-theme="light"] .btn-speed,
[data-theme="light"] .edit-input,
[data-theme="light"] .note-input-zone,
[data-theme="light"] .note-input-zone textarea,
[data-theme="light"] .report-meta input,
[data-theme="light"] #youtube-player {
    background: var(--input-bg);
    color: var(--text-main);
    border-color: var(--border-color);
}
[data-theme="light"] .help-content,
[data-theme="light"] .modal-content {
    background: var(--card-bg);
    color: var(--text-main);
}

/* Formulaires admin (style-admin.css force ces couleurs en !important) */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select,
[data-theme="light"] select {
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

/* Cartes admin (événements, tapis, avis) — fond blanc translucide illisible en clair */
[data-theme="light"] .stream-item,
[data-theme="light"] .event-list-item,
[data-theme="light"] .stream-item-row,
[data-theme="light"] .feedback-item {
    background: var(--card-bg-alt) !important;
    border-color: var(--border-color) !important;
}
[data-theme="light"] .stream-info strong,
[data-theme="light"] .stream-info-box strong,
[data-theme="light"] .feedback-user,
[data-theme="light"] .event-list-item .event-label {
    color: var(--text-main);
}
[data-theme="light"] .stream-info span,
[data-theme="light"] .stream-info-box span,
[data-theme="light"] .input-label {
    color: var(--text-muted);
}

/* Outil coaching : lien vidéo + liste des séquences */
[data-theme="light"] .coach-input-group input,
[data-theme="light"] .playlist-item {
    background: var(--input-bg);
    color: var(--text-main);
    border-color: 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(124, 95, 232, 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; }
