/*
 * Loaded directly by the browser — no build step (Phase 2). Bootstrap 5
 * provides the component layer; this file is the admin shell (sidebar,
 * topbar, status pills) plus dark-mode token overrides layered on top
 * of Bootstrap 5.3's native data-bs-theme mechanism.
 */

:root {
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --sidebar-bg: #14181f;
    --sidebar-ink: #c7ccd6;
    --sidebar-ink-active: #ffffff;
    --sidebar-accent: #e8a33d;
    --live: #c0392b;
    --live-bg: #fbeae8;
    --ok: #2e7d4f;
    --ok-bg: #e6f3ea;
}

[data-bs-theme="dark"] {
    --live-bg: #3a1e1c;
    --ok-bg: #123522;
}

body {
    background-color: var(--bs-tertiary-bg);
}

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

/* ---------- sidebar ---------- */
.admin-sidebar {
    width: var(--sidebar-width);
    flex: none;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.2rem;
    font-weight: 700;
    color: #fff;
    font-size: 1.02rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sidebar-accent);
    box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.25);
    flex: none;
}

.admin-sidebar-nav {
    padding: 0.75rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.admin-nav-group-label {
    padding: 0.9rem 0.75rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(199, 204, 214, 0.45);
}

.admin-nav-group-label:first-child {
    padding-top: 0.3rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.4rem;
    color: var(--sidebar-ink);
    text-decoration: none;
    font-size: 0.89rem;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.admin-nav-icon {
    flex: none;
    width: 17px;
    height: 17px;
    opacity: 0.85;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-ink-active);
}

.admin-nav-link.active {
    background: rgba(232, 163, 61, 0.14);
    color: var(--sidebar-ink-active);
}

.admin-nav-link.active .admin-nav-icon {
    color: var(--sidebar-accent);
    opacity: 1;
}

/* ---------- main / topbar ---------- */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: var(--topbar-height);
    flex: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-sidebar-toggle {
    background: none;
    border: none;
    color: var(--bs-body-color);
    padding: 0.25rem;
}

.admin-topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.admin-topbar-status {
    align-items: center;
    gap: 0.5rem;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}

/* ---------- breadcrumbs ---------- */
.admin-breadcrumb {
    margin-bottom: 1rem;
}

.admin-breadcrumb .breadcrumb {
    margin-bottom: 0;
    font-size: 0.82rem;
}

.admin-breadcrumb .breadcrumb-item a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.admin-breadcrumb .breadcrumb-item a:hover {
    color: var(--bs-body-color);
    text-decoration: underline;
}

.admin-breadcrumb .breadcrumb-item.active {
    color: var(--bs-body-color);
    font-weight: 500;
}

/* ---------- empty states ---------- */
.admin-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: 0.6rem;
    color: var(--bs-secondary-color);
}

.admin-empty-state svg {
    opacity: 0.4;
    margin-bottom: 0.25rem;
}

/* ---------- status pills (tally-lamp semantics) ---------- */
.status-pill {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.28rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}

.status-pill-live {
    background: var(--live-bg);
    color: var(--live);
}

.status-pill-idle {
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

.status-pill-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.status-pill-down {
    background: var(--live-bg);
    color: var(--live);
}

/* ---------- theme toggle icon swap ---------- */
#themeToggle .theme-icon-dark {
    display: none;
}

[data-bs-theme="dark"] #themeToggle .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] #themeToggle .theme-icon-dark {
    display: inline-block;
}

/* ---------- stat cards ---------- */
.stat-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    padding: 1rem 1.15rem;
    background: var(--bs-body-bg);
}

.stat-card .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 0.15rem;
}

.stat-card-icon {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.stat-card-icon-wrap {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 163, 61, 0.13);
    color: var(--sidebar-accent);
}

.stat-card-icon-wrap svg {
    width: 20px;
    height: 20px;
}

/* ---------- responsive sidebar ---------- */
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }
}

/* ---------- drag and drop (playlist items) ---------- */
.draggable-item {
    cursor: grab;
}

.draggable-item.dragging {
    opacity: 0.4;
}

.draggable-item.drag-over {
    border-top: 2px solid var(--bs-primary);
}
