/* ============================================
   CANARDOVERLAY - Admin Dashboard Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --ulule: #98cc00;     /* Vert Ulule OFFICIEL — même vert que ticker/badges inline (l'ancien #5cb85c ne correspondait à rien) */
    --twitch: #9146ff;    /* Violet — abonnés Twitch */
    --mahalo: #fca5a5;    /* Rouge clair — abonnés Mahalo (site web + magazine papier) */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================
   Header
   ============================================ */

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================
   Navigation
   ============================================ */

.nav {
    display: flex;
    flex-wrap: wrap; /* petits écrans : les onglets passent à la ligne au lieu de déborder */
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
}

.nav-link {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--bg-card);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* ============================================
   Section
   ============================================ */

.section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    overflow-x: auto; /* tables larges : scroll dans la section, jamais la page entière */
}

.section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Cards (kermesse.html / chat-overlay.html) — même traitement visuel que .section.
   Ces pages utilisaient .card/.main sans qu'aucune règle n'existe : blocs sans fond. */
.card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 1.25rem;
}

/* ============================================
   Status Grid
   ============================================ */

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 0.375rem;
}

.status-label {
    font-weight: 500;
}

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success {
    background: var(--success);
    color: white;
}

.status-error {
    background: var(--error);
    color: white;
}

.status-info {
    background: var(--primary);
    color: white;
}

/* ============================================
   Actions Grid
   ============================================ */

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ============================================
   Users Table
   ============================================ */

.filters {
    display: flex;
    flex-wrap: wrap; /* petits écrans : recherche + selects empilables */
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text);
    font-size: 1rem;
}

.filter-select {
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text);
    font-size: 1rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--bg-card);
}

.users-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.users-table td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.users-table tr:hover {
    background: var(--bg-card);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-ulule {
    background: var(--ulule);
    color: #1f2d00; /* texte sombre : le blanc était illisible sur le vert clair */
}

.badge-twitch {
    background: var(--twitch);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-mahalo {
    background: var(--mahalo);
    color: #7f1d1d;
}

.user-amount, .user-pseudo {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.text-muted {
    color: var(--text-muted);
}

.loading, .empty, .error {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.error {
    color: var(--error);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary);
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
}

.btn-secondary {
    background: var(--bg-card);
}

.btn-danger {
    background: var(--error);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border);
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-input {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text);
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
}

/* ============================================
   Color Picker (overlay admin)
   ============================================ */
input[type="color"] {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: var(--bg-card);
    cursor: pointer;
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   Aperçus d'overlay + éditeur de direction artistique
   ============================================ */
/* Motif inauguré par /admin/titraille.html et repris par les pages bandeau
   abos, overlay chat, kermesse et campagne : l'iframe charge la VRAIE Browser
   Source en 1920x1080 et se met à l'échelle de son conteneur, damier derrière
   pour lire la transparence exactement comme OBS la composera. */

.preview-box {
    position: relative; width: 100%; aspect-ratio: 16 / 9;
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
    background-color: #1a2233;
    background-image:
        linear-gradient(45deg, #223 25%, transparent 25%),
        linear-gradient(-45deg, #223 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #223 75%),
        linear-gradient(-45deg, transparent 75%, #223 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
}
/* Fond d'émission : pour juger des contrastes sur une vraie image plutôt que
   sur un damier (un texte blanc à ombre légère passe sur le damier et se perd
   sur un ciel clair). */
.preview-box.on-photo {
    background-image: url('/emission-capture.png');
    background-size: cover; background-position: center;
}
.preview-box iframe {
    position: absolute; top: 0; left: 0;
    width: 1920px; height: 1080px;
    transform-origin: top left; border: 0; pointer-events: none;
}
.preview-toolbar {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; margin: 12px 0 10px;
}

.da-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.da-sub {
    margin-top: 1.4rem; font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field input[type=number], .field input[type=text], .field select {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 7px 10px; font-size: 0.9rem;
}
.field input[type=color] {
    width: 100%; height: 36px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.field.inline { flex-direction: row; align-items: center; gap: 9px; }
.field.inline label { text-transform: none; letter-spacing: 0; font-size: 0.88rem; color: var(--text); }
.range-row { display: flex; align-items: center; gap: 8px; }

/* Une LIGNE PAR NIVEAU : animation, nombre, taille, essai. Le tableau est la
   pièce centrale du réglage des particules — c'est lui qui dit l'ampleur de la
   fête pour chaque palier, et on doit pouvoir comparer les quatre d'un coup
   d'œil, donc en lignes alignées plutôt qu'en blocs empilés. */
.pa-niveaux { display: flex; flex-direction: column; gap: 10px; }
.pa-niv {
    display: grid;
    grid-template-columns: minmax(150px, 1.4fr) minmax(120px, 1fr) 90px 90px auto;
    gap: 12px; align-items: end;
    padding: 10px 12px;
    border: 1px solid var(--border, #253046);
    border-radius: 8px;
}
.pa-niv-nom { font-size: 0.9rem; line-height: 1.35; align-self: center; }
.pa-niv-nom span { color: var(--text-muted); font-size: 0.78rem; }
.pa-niv button { white-space: nowrap; }
/* Sous 760 px la ligne devient un bloc : quatre colonnes de 90 px ne tiennent
   pas, et un tableau qui déborde ne se règle plus du tout. */
@media (max-width: 760px) {
    .pa-niv { grid-template-columns: 1fr 1fr; }
    .pa-niv-nom { grid-column: 1 / -1; }
    .pa-niv button { grid-column: 1 / -1; }
}
.range-row input[type=range] { flex: 1; }
.range-row output {
    font-variant-numeric: tabular-nums; color: var(--text-muted);
    font-size: 0.85rem; min-width: 52px; text-align: right;
}
.hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================================
   COPIER UNE URL — partagé par les pages d'overlay
   ============================================ */
[data-copy] { cursor: copy; }
a[data-copy] { border-bottom: 1px dashed rgba(99, 102, 241, 0.5); }
a[data-copy]:hover { text-decoration: none; border-bottom-style: solid; }
code[data-copy]:hover { text-decoration: underline; }
.ouvrir { color: var(--text-muted); text-decoration: none; font-size: 0.95em; margin-left: 4px; }
.ouvrir:hover { color: var(--primary); }

/* Confirmation flottante : aucun décalage de mise en page, et le même retour
   pour tous les boutons de copie de l'admin. */
#da-toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 50;
    background: var(--success); color: #052e16;
    font-weight: 700; font-size: 0.9rem;
    padding: 11px 20px; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
#da-toast.show { opacity: 1; transform: none; }
#da-toast.err { background: var(--error); color: #fff; }

/* ============================================
   BANDEAU DE LIENS D'OVERLAY — partagé
   ============================================ */
/* Était dupliqué en inline dans kermesse.html et campaign.html ; sorti ici pour
   que toutes les pages d'overlay partagent le même motif. Les copies inline de
   ces deux pages restent en place et donnent le même rendu. */
.overlay-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 10px 16px;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.overlay-links span { color: var(--text-muted); }
.overlay-links a { color: #6366f1; text-decoration: none; font-weight: 500; }
.overlay-links a:hover { text-decoration: underline; }
