:root {
    --bg: #05070d;
    --bg-elevated: #0a0e18;
    --panel: #10141f;
    --panel-light: #161c2c;
    --border: #232a3d;
    --accent: #4c6fff;
    --accent-light: #7c94ff;
    --accent-glow: rgba(76, 111, 255, 0.35);
    --text: #eef1f8;
    --text-muted: #8b93a7;
    --success: #34d399;
    --danger: #f87171;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Verdana, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}
.logo { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
.main-nav a:hover, .main-nav a.active { color: var(--text); text-decoration: none; }

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
    position: relative;
}

/* Glow d'ambiance façon hero SaaS */
body::before {
    content: "";
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.site-header, .main-content, .site-footer { position: relative; z-index: 1; }

/* Panels / cartes */
.panel-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-title {
    padding: 10px 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Accueil : barre d'infos live */
.stream-headerbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    margin-bottom: 10px;
}
.stream-headerbar-left { display: flex; align-items: center; gap: 10px; }
.stream-duration { color: var(--text-muted); font-size: 0.85rem; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.live-dot.on { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.live-dot.off { background: var(--text-muted); }
.viewers { color: var(--text-muted); font-size: 0.85rem; }

.stream-meta { margin-bottom: 18px; }
.info-title { font-weight: 700; font-size: 1.05rem; }
.info-game { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

/* Accueil : lecteur + chat, hauteur explicite pour que rien ne se superpose */
.stream-row {
    display: flex;
    gap: 18px;
    align-items: stretch;
    height: 540px;
}
.player-box {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}
.chat-box {
    flex: 0 0 360px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
#player-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
#chat-frame {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    min-height: 0;
}
@media (max-width: 960px) {
    .stream-row { flex-direction: column; height: auto; }
    .player-box { flex-basis: auto; aspect-ratio: 16/9; }
    .chat-box { flex-basis: 480px; height: 480px; }
}

.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }

/* Boutons / formulaires (admin + accueil) */
.btn {
    display: inline-block;
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(76, 111, 255, 0.35);
}
.btn:hover { background: var(--accent-light); text-decoration: none; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: none; }

.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 0.85rem; color: var(--text-muted); }
.form-row input, .form-row select, .form-row textarea {
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    font-family: inherit;
}
.form-row textarea { min-height: 90px; resize: vertical; }

/* Admin */
.admin-body { background: var(--bg); }
.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 30px 24px 60px; }
.admin-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
}
.admin-box h1, .admin-box h2 { color: var(--text); }
.admin-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}
.admin-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.admin-logo {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    white-space: nowrap;
}
.admin-logo:hover { text-decoration: none; color: var(--text); }
.admin-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}
.admin-nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 999px;
    white-space: nowrap;
}
.admin-nav-link:hover { background: var(--panel-light); color: var(--text); text-decoration: none; }
.admin-nav-link.active { background: var(--accent); color: #fff; }
.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.admin-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-user-name { font-size: 0.85rem; color: var(--text); font-weight: 600; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 999px; }

@media (max-width: 760px) {
    .admin-header-inner { flex-wrap: wrap; }
    .admin-nav { order: 3; width: 100%; }
    .admin-user-name { display: none; }
}

table.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
table.admin-table th, table.admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    font-size: 0.9rem;
}
table.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem; }
.flash.success { background: rgba(52, 211, 153, 0.12); border: 1px solid var(--success); color: var(--success); }
.flash.error { background: rgba(248, 113, 113, 0.12); border: 1px solid var(--danger); color: var(--danger); }

.badge-type {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--accent-light);
}

.widget-fieldset {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 6px;
}

.preview-panel {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 18px;
}
.preview-panel-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.preview-frame {
    width: 100%;
    height: 140px;
    border: 0;
    border-radius: 10px;
    background-color: #1a2033;
    background-image:
        linear-gradient(45deg, #232a3d 25%, transparent 25%),
        linear-gradient(-45deg, #232a3d 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #232a3d 75%),
        linear-gradient(-45deg, transparent 75%, #232a3d 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.current-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.current-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

/* Dashboard : catégories à gauche */
.dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.dashboard-sidebar {
    flex: 0 0 220px;
}
.dashboard-main {
    flex: 1 1 auto;
    min-width: 0;
}
.sidebar-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}
.category-list a:hover { background: var(--panel-light); text-decoration: none; }
.category-list a.active { background: var(--panel-light); color: var(--text); }
.category-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 1px 8px;
}
.category-list a.active .category-count { color: var(--accent-light); }

.category-item { display: flex; align-items: center; gap: 4px; }
.category-item a:first-child { flex: 1 1 auto; min-width: 0; }
.category-add {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 !important;
}
.category-add:hover { background: var(--accent); color: #fff; text-decoration: none; }

.type-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--accent-light);
}

@media (max-width: 720px) {
    .dashboard-layout { flex-direction: column; }
    .dashboard-sidebar { flex-basis: auto; width: 100%; }
    .category-list { flex-direction: row; flex-wrap: wrap; }
}

.copy-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.copy-url-row input {
    flex: 1;
    background: var(--panel-light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.78rem;
}

.site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}
