/* BuzzBanter.Admin theme - a sidebar + topbar admin shell (layout/pattern referenced from a
   mystery-shopping dashboard example: sidebar nav, stat tiles, filter/card panels, colored
   progress bars) but in BuzzBanter's own teal/violet brand palette - the same identity
   BuzzBanter.Web already carries, so the whole product family reads as one system. */

:root {
    --admin-bg: #f4f6f8;
    --admin-surface: #ffffff;
    --admin-border: #e6e9ee;
    --admin-text: #1f2937;
    --admin-text-muted: #6b7280;
    --admin-primary: #0e7c90;
    --admin-primary-dark: #095c6c;
    --admin-primary-rgb: 14, 124, 144;
    --admin-accent: #7c6fe0;
    --admin-accent-rgb: 124, 111, 224;
    --admin-success: #1a9c6a;
    --admin-warning: #d99a2b;
    --admin-danger: #d1483f;
    --admin-sidebar-width: 240px;
    --admin-radius: 14px;
    --admin-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body.admin-body {
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* ---- Shell: fixed sidebar + topbar, scrollable content area ---- */

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

.admin-sidebar {
    width: var(--admin-sidebar-width);
    flex-shrink: 0;
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    text-decoration: none;
    color: inherit;
}

.admin-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.admin-brand-text { line-height: 1.1; }
.admin-brand-text strong { display: block; font-size: 0.98rem; font-weight: 800; }
.admin-brand-text span { display: block; font-size: 0.68rem; color: var(--admin-text-muted); letter-spacing: 0.06em; text-transform: uppercase; }

.admin-nav-label {
    padding: 14px 20px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--admin-text-muted);
    text-transform: uppercase;
}

.admin-nav { flex: 1; padding: 0 12px; }

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--admin-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.12s ease, color 0.12s ease;
}

.admin-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }

.admin-nav-link:hover { background: var(--admin-bg); color: var(--admin-text); }

.admin-nav-link.active {
    background: rgba(var(--admin-primary-rgb), 0.1);
    color: var(--admin-primary-dark);
    font-weight: 700;
}
.admin-nav-link.active svg { opacity: 1; }

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.admin-topbar-title { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--admin-text); }
.admin-topbar-title svg { width: 20px; height: 20px; color: var(--admin-primary); }

.admin-user-menu { display: flex; align-items: center; gap: 10px; }

.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--admin-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.admin-main { flex: 1; min-width: 0; }
.admin-content { padding: 28px; max-width: 1280px; }

/* ---- Page header ---- */

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}

.admin-page-header h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.admin-page-header p { color: var(--admin-text-muted); margin: 0; font-size: 0.92rem; }

/* ---- Cards ---- */

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

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.admin-card-header h2 { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.admin-card-header h2 svg { width: 18px; height: 18px; color: var(--admin-primary); }

/* ---- Stat tiles ---- */

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

.admin-stat-tile {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-stat-tile .label { color: var(--admin-text-muted); font-size: 0.82rem; margin-bottom: 6px; }
.admin-stat-tile .value { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.admin-stat-tile .icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.admin-stat-tile .icon svg { width: 20px; height: 20px; }

.tile-primary .icon { background: rgba(var(--admin-primary-rgb), 0.12); color: var(--admin-primary-dark); }
.tile-accent .icon { background: rgba(var(--admin-accent-rgb), 0.14); color: var(--admin-accent); }
.tile-success .icon { background: rgba(26, 156, 106, 0.14); color: var(--admin-success); }
.tile-warning .icon { background: rgba(217, 154, 43, 0.14); color: var(--admin-warning); }

/* ---- Badges ---- */

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.admin-badge-neutral { background: var(--admin-bg); color: var(--admin-text-muted); }
.admin-badge-success { background: rgba(26, 156, 106, 0.12); color: var(--admin-success); }
.admin-badge-warning { background: rgba(217, 154, 43, 0.12); color: var(--admin-warning); }
.admin-badge-danger { background: rgba(209, 72, 63, 0.12); color: var(--admin-danger); }
.admin-badge-accent { background: rgba(var(--admin-accent-rgb), 0.12); color: var(--admin-accent); }

/* ---- Table ---- */

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--admin-text-muted);
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--admin-border);
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--admin-border); font-size: 0.9rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--admin-bg); }

/* ---- Buttons (layered on top of Bootstrap's, not replacing) ---- */

.admin-btn-primary {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: #fff;
}
.admin-btn-primary:hover { background: var(--admin-primary-dark); border-color: var(--admin-primary-dark); color: #fff; }

/* ---- Empty state ---- */

.admin-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--admin-text-muted);
}
.admin-empty svg { width: 40px; height: 40px; opacity: 0.35; margin-bottom: 10px; }

/* ---- Login page ---- */

.admin-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef6f7 0%, var(--admin-bg) 60%);
}
.admin-login-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    padding: 36px 34px;
    width: 100%;
    max-width: 380px;
}

/* ---- Branching flow diagram ---- */

.flow-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1.5px solid;
    vertical-align: middle;
    margin-right: 2px;
}

.flow-diagram-wrap {
    padding: 12px 4px;
}

/* Cytoscape needs an explicitly-sized container - unlike Mermaid's SVG, it doesn't size itself
   to its content, so flow-graph-editor.js sets this element's height in JS once the actual graph
   is laid out and its true size is known (a long, mostly-linear survey produces a tall diagram -
   letting the page scroll to see all of it, the same as the old Mermaid version did, reads far
   better than force-shrinking everything to fit one fixed-height box). This starting height is
   just what's visible before that JS runs. */
#flow-graph {
    width: 100%;
    height: 480px;
    background: #fbfbfd;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.flow-diagram-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* ---- Responsive ---- */

@media (max-width: 860px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 18px; }
}
