/* Scoped white/sky-blue admin theme — overrides brand vars only within .admin-theme,
   leaving the player-facing red/cream theme in style.css untouched. */
body.admin-theme {
    --brand: #0ea5e9;
    --brand-dark: #0284c7;
    --brand-light: #7dd3fc;
    --brand-rgb: 14, 165, 233;
    --cream: #f7fafc;
    --surface: #ffffff;
    --ink: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --win: #16a34a;
    --win-bg: #e7f7ec;
    --accent-soft: #e0f2fe;
    --accent-soft-rgb: 14, 165, 233;
    --table-header-bg: #f1f5f9;
    --table-hover-bg: #f8fafc;
    --input-bg: #ffffff;
    --brand-accent-2: #0284c7;
    --disabled-bg: #e5e7eb;
    --disabled-text: #9ca3af;
}

.admin-wrap { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 232px;
    flex-shrink: 0;
    background: #111827;
    color: #fff;
    padding: 18px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 20px 22px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
}
.admin-sidebar .brand .icon { width: 20px; height: 20px; color: var(--brand-light); }
.admin-sidebar .nav-section-label {
    padding: 4px 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #8b93a1;
    margin-top: 10px;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #c7cdd6;
    font-size: 14px;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.admin-sidebar a .icon { width: 18px; height: 18px; }
.admin-sidebar a.active { background: rgba(var(--accent-soft-rgb), 0.18); color: #fff; border-left-color: var(--brand); }
.admin-sidebar a:hover:not(.active) { background: rgba(255,255,255,0.06); color: #fff; }
.admin-sidebar a.sub-link { padding-left: 32px; font-size: 13px; }
.admin-sidebar a.disabled-link { opacity: 0.55; cursor: not-allowed; }
.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 20px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: #c7cdd6;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.nav-group-toggle .icon { width: 18px; height: 18px; }
.nav-group-toggle:hover, .nav-group-toggle.active { background: rgba(255,255,255,0.06); color: #fff; }
.nav-group-toggle:focus-visible { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.3); }
.nav-group-toggle.active { border-left-color: var(--brand); }
.nav-group-chevron { margin-left: auto; display: flex; transition: transform 150ms var(--ease); }
.nav-group-chevron .icon { width: 16px; height: 16px; }
.nav-group-chevron.open { transform: rotate(90deg); }
.nav-submenu { max-height: 0; overflow: hidden; }
.nav-submenu.open { max-height: 200px; }

.admin-main { flex: 1; padding: 28px 32px; background: var(--cream); min-width: 0; }
.admin-main h2 { font-size: 22px; margin-bottom: 4px; }
.admin-page-subtitle { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card .stat-icon .icon { width: 20px; height: 20px; }
.stat-card .num { font-family: 'Fredoka', sans-serif; font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-card .label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

/* Lets multiple cards sit side by side on wide screens instead of stacking
   narrowly down the page with empty space beside them; wraps to 1 column
   automatically once the viewport can't fit two at their min width. */
.admin-cards-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.admin-cards-row > .admin-card { flex: 1 1 380px; margin-bottom: 0; }

/* 2-up field layout inside a form card (e.g. open/close time side by side). */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 560px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; text-align: left; }
table.admin-table th { background: var(--table-header-bg); font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table tr:hover td { background: var(--table-hover-bg); }

.pill-status { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.pill-status.good { background: var(--win-bg); color: var(--win); }
.pill-status.bad { background: var(--lose-bg); color: var(--danger-text); }
.pill-status.neutral { background: var(--accent-soft); color: var(--brand-dark); }
.pill-status .icon { width: 12px; height: 12px; }

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--brand);
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color 150ms var(--ease);
}
.action-link:hover { background: var(--accent-soft); }
.action-link.danger { color: var(--danger-text); }
.action-link.danger:hover { background: var(--lose-bg); }
.action-link .icon { width: 13px; height: 13px; }

.admin-table-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.disabled-panel {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--card-radius);
    padding: 40px 24px;
    text-align: center;
    color: var(--muted);
}
.disabled-panel .icon { width: 36px; height: 36px; color: var(--muted); margin-bottom: 12px; }
.disabled-panel .title { font-family: 'Fredoka', sans-serif; font-weight: 600; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.disabled-panel .subtitle { font-size: 13.5px; max-width: 440px; margin: 0 auto; line-height: 1.5; }

.num-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    margin-top: 16px;
}
.num-cell {
    border-radius: 10px;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--surface);
}
.num-cell .n { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); }
.num-cell .v { font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.num-cell.zero { opacity: 0.55; }
.num-cell.low { background: var(--accent-soft); border-color: var(--accent-soft); }
.num-cell.low .v { color: var(--brand-dark); }
.num-cell.mid { background: rgba(217, 165, 32, 0.18); border-color: rgba(217, 165, 32, 0.4); }
.num-cell.mid .v { color: #92650f; }
.num-cell.high { background: rgba(217, 165, 32, 0.38); border-color: var(--gold); }
.num-cell.high .n, .num-cell.high .v { color: #7a5206; }
.num-cell.top { background: var(--danger-text); border-color: var(--danger-text); }
.num-cell.top .n, .num-cell.top .v { color: #fff; }

.demo-banner {
    background: #fef3c7;
    border: 1px solid #f5c542;
    color: #7a5b06;
    padding: 12px 16px;
    border-radius: var(--control-radius);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.demo-banner .icon { width: 16px; height: 16px; flex-shrink: 0; }

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.toggle-switch .track {
    width: 40px; height: 22px;
    border-radius: 999px;
    background: var(--border);
    position: relative;
    transition: background-color 150ms var(--ease);
}
.toggle-switch .track.on { background: var(--brand); }
.toggle-switch .track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 150ms var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch .track.on::after { transform: translateX(18px); }

/* ---------- Mobile: sidebar becomes an off-canvas drawer, same pattern as the player app ---------- */
.admin-mobile-topbar { display: none; }
.admin-sidebar-overlay { display: none; }

@media (max-width: 760px) {
    .admin-mobile-topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        padding: 0 16px;
        background: #111827;
        color: #fff;
        position: sticky;
        top: 0;
        z-index: 25;
        font-family: 'Fredoka', sans-serif;
        font-weight: 600;
        font-size: 15px;
    }
    .admin-menu-btn {
        background: rgba(255,255,255,0.1);
        border: none;
        color: #fff;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        padding: 0;
    }
    .admin-menu-btn .icon { width: 18px; height: 18px; }

    .admin-wrap { display: block; }
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        max-width: 82vw;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 260ms var(--ease);
        z-index: 30;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 220ms var(--ease);
        z-index: 29;
    }
    .admin-sidebar-overlay.open { opacity: 1; pointer-events: auto; }

    .admin-main { padding: 20px 16px; }
    .table-wrap { overflow-x: auto; }
    .admin-cards-row { flex-direction: column; }
}
