/* ==========================================================================
   Fichier : admin/inc/regie.css — Design « Régie » (clair par défaut)
   Mode sombre : classe .regie-dark sur <html> (bouton lune / soleil)
   ========================================================================== */

:root {
    --rg-bg: #F6F4FB;
    --rg-side: #FFFFFF;
    --rg-surface: #FFFFFF;
    --rg-surface-2: #EEEAFA;
    --rg-input: #F6F4FB;
    --rg-line: rgba(23, 18, 58, 0.10);
    --rg-line-strong: rgba(23, 18, 58, 0.18);
    --rg-text: #17123A;
    --rg-muted: #5E5880;
    --rg-orange: #FF7A1A;
    --rg-on-orange: #1A0D02;
    --rg-link: #C2510A;
    --rg-violet: #6A4BE0;
    --rg-violet-soft: rgba(106, 75, 224, 0.12);
    --rg-good: #0E8A57;
    --rg-good-soft: rgba(14, 138, 87, 0.10);
    --rg-warn: #A8630B;
    --rg-warn-soft: rgba(168, 99, 11, 0.10);
    --rg-alert: #D7353B;
    --rg-alert-soft: rgba(215, 53, 59, 0.08);
    --rg-live: #C7306F;
    --rg-live-soft: rgba(199, 48, 111, 0.10);
    --rg-shadow: 0 1px 3px rgba(23, 18, 58, 0.06), 0 1px 2px rgba(23, 18, 58, 0.04);
    --rg-radius: 16px;
    --rg-radius-sm: 10px;

    /* Alias pour les pages existantes (navettes.php…) */
    --bg-color: var(--rg-bg);
    --surface: var(--rg-surface);
    --surface-hover: var(--rg-surface-2);
    --text-dark: var(--rg-text);
    --text-muted: var(--rg-muted);
    --border-color: var(--rg-line);
    --primary: var(--rg-violet);
    --primary-light: var(--rg-violet-soft);
    --input-bg: var(--rg-input);
    --input-border: var(--rg-line-strong);
    --danger: var(--rg-alert);
    --success: var(--rg-good);
    --warning: var(--rg-warn);
    --radius-lg: var(--rg-radius);
    --radius-md: var(--rg-radius-sm);
    --shadow-sm: var(--rg-shadow);
    --shadow-md: var(--rg-shadow);
    --transition: all 0.15s ease;
    --shadow-hover: 0 6px 18px rgba(23, 18, 58, 0.10);
    --shadow-lg: 0 20px 50px rgba(15, 12, 36, 0.18);
    --brand: var(--rg-link);
    --app-theme: var(--rg-orange);
    --status-good: var(--rg-good);
    --status-alert: var(--rg-alert);
    --status-current: var(--rg-alert);
    --status-cancelled: var(--rg-muted);
    --status-nouveau: var(--rg-alert);
    --status-encours: var(--rg-warn);
    --status-traite: var(--rg-good);
    --status-faux: var(--rg-muted);
    --status-success: var(--rg-good);
    --status-success-bg: var(--rg-good-soft);
    --status-warning: var(--rg-warn);
    --status-warning-bg: var(--rg-warn-soft);
    --status-error: var(--rg-alert);
    --status-error-bg: var(--rg-alert-soft);
    --table-bg: transparent;
    --table-header: var(--rg-surface-2);
    --table-hover: var(--rg-bg);
    --table-row-even: transparent;
}

html.regie-dark {
    --rg-bg: #0F0C24;
    --rg-side: #151133;
    --rg-surface: #1C1740;
    --rg-surface-2: #251E52;
    --rg-input: #0F0C24;
    --rg-line: rgba(255, 255, 255, 0.08);
    --rg-line-strong: rgba(255, 255, 255, 0.16);
    --rg-text: #F4F1FF;
    --rg-muted: #A49DCB;
    --rg-link: #FFB37A;
    --rg-violet: #8B6CFF;
    --rg-violet-soft: rgba(139, 108, 255, 0.16);
    --rg-good: #3DDC97;
    --rg-good-soft: rgba(61, 220, 151, 0.12);
    --rg-warn: #FFB020;
    --rg-warn-soft: rgba(255, 176, 32, 0.14);
    --rg-alert: #FF5A5F;
    --rg-alert-soft: rgba(255, 90, 95, 0.12);
    --rg-live: #FF6FA8;
    --rg-live-soft: rgba(255, 111, 168, 0.14);
    --rg-shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.regie {
    background: var(--rg-bg);
    color: var(--rg-text);
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
body.regie a { color: var(--rg-link); }
body.regie button { cursor: pointer; font-family: inherit; }
.rg-num { font-variant-numeric: tabular-nums; }
.rg-h { font-family: 'Bricolage Grotesque', 'Manrope', sans-serif; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- Barre latérale ---------- */
.rg-side {
    position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 40;
    background: var(--rg-side); border-right: 1px solid var(--rg-line);
    display: flex; flex-direction: column; gap: 20px; padding: 18px 14px; overflow-y: auto;
}
.rg-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.rg-brand img { width: 44px; height: 44px; }
.rg-brand div { display: flex; flex-direction: column; flex-grow: 1; }
.rg-brand strong { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 17px; }
.rg-brand span { font-size: 12px; font-weight: 700; color: var(--rg-muted); }
.rg-nav { display: flex; flex-direction: column; gap: 18px; }
.rg-group { display: flex; flex-direction: column; gap: 2px; }
.rg-group-title { padding: 0 10px 6px; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--rg-muted); }
body.regie .rg-link {
    position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px;
    border-radius: var(--rg-radius-sm); text-decoration: none; font-weight: 700; color: var(--rg-muted);
}
body.regie .rg-link:hover { background: var(--rg-surface-2); color: var(--rg-text); }
body.regie .rg-link.active { background: var(--rg-surface-2); color: var(--rg-text); }
.rg-link.active::before { content: ""; position: absolute; left: -14px; top: 10px; width: 4px; height: 20px; border-radius: 2px; background: var(--rg-orange); }
.rg-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rg-alert); color: #fff; font-style: normal; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.rg-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--rg-bg); border: 1px solid var(--rg-line); }
.rg-user div { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.rg-user strong { font-size: 13px; }
.rg-user span { font-size: 11px; font-weight: 700; color: var(--rg-muted); }
.rg-avatar { width: 34px; height: 34px; border-radius: 17px; background: var(--rg-violet); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Zone principale ---------- */
.rg-main { margin-left: 256px; min-height: 100vh; display: flex; flex-direction: column; }
.rg-top {
    position: sticky; top: 0; z-index: 30; min-height: 72px; padding: 0 28px; display: flex; align-items: center; gap: 16px;
    background: color-mix(in srgb, var(--rg-bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rg-line);
}
.rg-title { display: flex; flex-direction: column; }
.rg-title span { font-size: 12px; font-weight: 700; color: var(--rg-muted); }
.rg-title h1 { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 24px; line-height: 1.1; }
.rg-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rg-content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Composants ---------- */
.rg-icon-btn {
    width: 40px; height: 40px; border-radius: var(--rg-radius-sm); border: 1px solid var(--rg-line);
    background: var(--rg-surface); color: var(--rg-text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
body.regie a.rg-icon-btn { color: var(--rg-muted); }
.rg-when-dark { display: none; }
html.regie-dark .rg-when-dark { display: inline-flex; }
html.regie-dark .rg-when-light { display: none; }

.rg-btn, body.regie a.rg-btn {
    height: 40px; padding: 0 16px; border-radius: var(--rg-radius-sm); border: 1px solid transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 800; font-size: 13px; text-decoration: none; white-space: nowrap;
}
.rg-btn-primary { background: var(--rg-orange); color: var(--rg-on-orange) !important; }
.rg-btn-primary:hover { filter: brightness(0.95); }
.rg-btn-ghost { background: var(--rg-surface); color: var(--rg-text) !important; border-color: var(--rg-line-strong); }
.rg-btn-ghost:hover { background: var(--rg-surface-2); }
.rg-btn-danger { background: transparent; color: var(--rg-alert) !important; border-color: color-mix(in srgb, var(--rg-alert) 45%, transparent); }

.rg-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: 11px; white-space: nowrap; background: var(--rg-surface-2); color: var(--rg-text); }
.rg-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rg-status { margin-left: 8px; }
.rg-status-live { background: var(--rg-good-soft); color: var(--rg-good); }
.rg-status-soon { background: var(--rg-violet-soft); color: var(--rg-violet); }
.rg-status-off  { background: var(--rg-surface-2); color: var(--rg-muted); }
.rg-pill-live { background: var(--rg-live-soft); color: var(--rg-live); }
.rg-pill-warn { background: var(--rg-warn-soft); color: var(--rg-warn); }
.rg-pill-good { background: var(--rg-good-soft); color: var(--rg-good); }
.rg-pill-alert { background: var(--rg-alert-soft); color: var(--rg-alert); }
.rg-pill-muted { background: var(--rg-surface-2); color: var(--rg-muted); }

.rg-card { background: var(--rg-surface); border: 1px solid var(--rg-line); border-radius: var(--rg-radius); box-shadow: var(--rg-shadow); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rg-card-head h2, .rg-section-title { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 18px; }
.rg-label { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--rg-muted); }
.rg-muted { color: var(--rg-muted); }
.rg-row { display: flex; gap: 16px; }
.rg-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rg-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rg-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.rg-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--rg-muted); }
.rg-input, .rg-field input, .rg-field textarea, .rg-field select {
    height: 40px; border-radius: var(--rg-radius-sm); border: 1px solid var(--rg-line-strong); background: var(--rg-input);
    color: var(--rg-text); padding: 0 12px; font-family: inherit; font-size: 14px; font-weight: 600; width: 100%;
}
.rg-field textarea { height: auto; min-height: 70px; padding: 10px 12px; resize: vertical; }
.rg-input:focus, .rg-field input:focus, .rg-field textarea:focus { outline: none; border-color: var(--rg-violet); box-shadow: 0 0 0 3px var(--rg-violet-soft); }

.rg-alert-box { padding: 12px 16px; border-radius: var(--rg-radius-sm); font-weight: 700; }
.rg-alert-box.ok { background: var(--rg-good-soft); color: var(--rg-good); }
.rg-alert-box.err { background: var(--rg-alert-soft); color: var(--rg-alert); }

/* KPI */
.rg-kpi { flex: 1; background: var(--rg-surface); border: 1px solid var(--rg-line); border-radius: var(--rg-radius); box-shadow: var(--rg-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rg-kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--rg-muted); }
.rg-kpi-value { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.rg-kpi small { font-size: 12px; font-weight: 700; color: var(--rg-muted); }
.rg-kpi.alert { background: var(--rg-alert-soft); border-color: color-mix(in srgb, var(--rg-alert) 40%, transparent); }
.rg-kpi.alert .rg-kpi-top, .rg-kpi.alert .rg-kpi-value, body.regie .rg-kpi.alert a { color: var(--rg-alert); }

/* Scènes */
.rg-scene { border-top: 3px solid var(--scene, var(--rg-orange)); gap: 8px; }
.rg-scene-name { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.rg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--scene, var(--rg-orange)); }
.rg-scene-artist { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 20px; line-height: 1.15; }
.rg-scene-artist.dim { color: var(--rg-muted); }
.rg-progress { height: 6px; border-radius: 3px; background: var(--rg-surface-2); overflow: hidden; }
.rg-progress span { display: block; height: 6px; border-radius: 3px; background: var(--scene, var(--rg-orange)); }
.rg-scene-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--rg-line); font-size: 12px; font-weight: 700; color: var(--rg-muted); }
.rg-scene-foot b { color: var(--rg-text); }

/* Buvette */
.rg-buv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rg-buv input { position: absolute; opacity: 0; pointer-events: none; }
.rg-buv label {
    min-height: 46px; border-radius: var(--rg-radius-sm); border: 1px solid var(--rg-line-strong); background: var(--rg-input);
    color: var(--rg-muted); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-align: center; padding: 4px 6px;
}
.rg-buv label i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.rg-buv input:checked + label { border: 2px solid var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }
.rg-buv input:focus-visible + label { box-shadow: 0 0 0 3px var(--rg-violet-soft); }

/* Listes */
.rg-list { display: flex; flex-direction: column; }
.rg-list-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--rg-line); }
.rg-list-item:first-child { border-top: 0; }
.rg-list-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--rg-surface-2); color: var(--rg-orange); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rg-list-main { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rg-list-main strong { font-size: 13px; }
.rg-list-main span { font-size: 12px; color: var(--rg-muted); font-weight: 600; }
.rg-list-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; font-weight: 700; color: var(--rg-muted); white-space: nowrap; }

.rg-empty { padding: 18px; text-align: center; color: var(--rg-muted); font-weight: 700; }

/* ---------- Mobile ---------- */
.rg-only-mobile { display: none !important; }
.rg-overlay { display: none; }
@media (max-width: 1100px) {
    .rg-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rg-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rg-row { flex-wrap: wrap; }
    .rg-row > .rg-kpi { flex: 1 1 calc(50% - 8px); }
}
@media (max-width: 900px) {
    .rg-only-mobile { display: inline-flex !important; }
    .rg-hide-mobile { display: none !important; }
    .rg-side { transform: translateX(-100%); transition: transform 0.2s ease; width: 280px; box-shadow: 0 0 40px rgba(0,0,0,0.25); }
    body.rg-menu-open .rg-side { transform: none; }
    body.rg-menu-open .rg-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15,12,36,0.45); }
    .rg-main { margin-left: 0; }
    .rg-top { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
    .rg-status { order: 5; margin-left: 0; }
    .rg-content { padding: 16px; }
    .rg-grid-2, .rg-grid-3, .rg-grid-4 { grid-template-columns: 1fr; }
}

/* Correctifs liens-boutons */
body.regie a.rg-btn-ghost { background: var(--rg-surface); border-color: var(--rg-line-strong); }
body.regie a.rg-btn-ghost:hover { background: var(--rg-surface-2); }
body.regie a.rg-btn-danger { border-color: color-mix(in srgb, var(--rg-alert) 45%, transparent); }
@media (max-width: 900px) { .rg-kpi-value { font-size: 28px; } }

/* Page publique (planning des équipes) : pas de barre latérale */
body.rg-public .rg-main { margin-left: 0; }

/* Groupe « Consultation » séparé des outils d'administration */
.rg-group-sep { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--rg-line); }

/* Sous-menus dépliables (ex. Notifications push) */
.rg-sub > summary { list-style: none; cursor: pointer; }
.rg-sub > summary::-webkit-details-marker { display: none; }
.rg-sub .rg-caret { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; opacity: .6; }
.rg-sub[open] .rg-caret { transform: rotate(45deg); }
.rg-sub-items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 18px; padding-left: 8px; border-left: 2px solid var(--rg-line); }
.rg-sublink { font-size: 13.5px; padding-top: 7px; padding-bottom: 7px; }
.rg-sub-active { color: var(--rg-text); }
