/* BugTracker admin shell */

:root {
    --bt-sidebar-bg: #0f172a;
    --bt-sidebar-width: 264px;
    --bt-accent: #4f46e5;
    --bt-accent-hover: #4338ca;
    --bt-accent-soft: #eef2ff;
    --bt-ink: #0f172a;
    --bt-muted: #64748b;
    --bt-border: #e2e8f0;
    --bt-surface: #f1f5f9;
}

body.admin-body,
body.guest-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--bt-ink);
    background: var(--bt-surface);
}

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

.admin-sidebar {
    width: var(--bt-sidebar-width);
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-bottom: 1px solid var(--bt-border);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-page-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }

.admin-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.admin-content { padding: 28px; max-width: 1320px; width: 100%; }

/* ------------------------------------------------------------------ */
/* Sidebar                                                              */
/* ------------------------------------------------------------------ */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bt-sidebar-bg);
    color: #cbd5e1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 20px 18px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.sidebar-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--bt-accent);
    color: #fff;
    font-size: 1rem;
    flex: none;
}

.sidebar-nav { flex: 1; padding: 6px 12px; overflow-y: auto; }

.sidebar-section {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #475569;
    padding: 16px 10px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-link i { font-size: 1.02rem; width: 20px; text-align: center; flex: none; }

.sidebar-link:hover { background: rgba(148, 163, 184, 0.12); color: #fff; }

.sidebar-link.active { background: var(--bt-accent); color: #fff; }

.sidebar-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 99px;
    padding: 2px 8px;
    line-height: 1.4;
}

.sidebar-link.active .sidebar-badge { background: rgba(255, 255, 255, 0.25); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
    color: #f1f5f9;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role { color: #64748b; font-size: 0.72rem; }

.sidebar-logout {
    margin-left: auto;
    background: none;
    border: 0;
    color: #64748b;
    font-size: 1.05rem;
    padding: 6px;
    border-radius: 7px;
}

.sidebar-logout:hover { color: #fff; background: rgba(148, 163, 184, 0.15); }

.admin-sidebar-offcanvas { background: var(--bt-sidebar-bg); width: var(--bt-sidebar-width) !important; }

/* ------------------------------------------------------------------ */
/* Cards, tiles, tables                                                 */
/* ------------------------------------------------------------------ */
.card { border: 1px solid var(--bt-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }

.card-header.bg-white { border-bottom-color: var(--bt-border); border-radius: 12px 12px 0 0 !important; }

.stat-tile { display: flex; align-items: center; gap: 14px; padding: 18px; }

.stat-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex: none;
}

.stat-tile-icon.tint-indigo { background: #eef2ff; color: #4338ca; }
.stat-tile-icon.tint-sky { background: #e0f2fe; color: #0369a1; }
.stat-tile-icon.tint-amber { background: #fef3c7; color: #b45309; }
.stat-tile-icon.tint-emerald { background: #d1fae5; color: #047857; }
.stat-tile-icon.tint-slate { background: #e2e8f0; color: #334155; }

.stat-tile-value { font-size: 1.65rem; font-weight: 600; line-height: 1.1; color: var(--bt-ink); }

.stat-tile-label { color: var(--bt-muted); font-size: 0.82rem; margin-top: 2px; }

.table { --bs-table-hover-bg: #f8fafc; }

.table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bt-muted);
    border-bottom-width: 1px;
    background: #f8fafc;
    white-space: nowrap;
}

.table td { vertical-align: middle; }

.table .numeric { font-variant-numeric: tabular-nums; }

/* Status badges — always paired with their text label */
.badge.status-new { background: #e0f2fe; color: #0369a1; }
.badge.status-in_progress { background: #fef3c7; color: #b45309; }
.badge.status-resolved { background: #d1fae5; color: #047857; }
.badge.status-unknown { background: #e2e8f0; color: #334155; }

.badge.widget-on { background: #d1fae5; color: #047857; }
.badge.widget-off { background: #fee2e2; color: #b91c1c; }
.badge.widget-ondemand { background: #e0e7ff; color: #3730a3; }
.badge.widget-pin { background: #fef3c7; color: #92400e; }

/* ------------------------------------------------------------------ */
/* Buttons & forms                                                      */
/* ------------------------------------------------------------------ */
.btn-primary {
    --bs-btn-bg: var(--bt-accent);
    --bs-btn-border-color: var(--bt-accent);
    --bs-btn-hover-bg: var(--bt-accent-hover);
    --bs-btn-hover-border-color: var(--bt-accent-hover);
    --bs-btn-active-bg: var(--bt-accent-hover);
    --bs-btn-active-border-color: var(--bt-accent-hover);
    --bs-btn-disabled-bg: #a5b4fc;
    --bs-btn-disabled-border-color: #a5b4fc;
}

.btn-outline-primary {
    --bs-btn-color: var(--bt-accent);
    --bs-btn-border-color: #c7d2fe;
    --bs-btn-hover-bg: var(--bt-accent);
    --bs-btn-hover-border-color: var(--bt-accent);
    --bs-btn-active-bg: var(--bt-accent-hover);
    --bs-btn-active-border-color: var(--bt-accent-hover);
}

.form-control:focus, .form-select:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12);
}

.form-check-input:checked { background-color: var(--bt-accent); border-color: var(--bt-accent); }

.nav-pills .nav-link { color: var(--bt-muted); font-weight: 600; font-size: 0.88rem; }

.nav-pills .nav-link.active { background: var(--bt-accent); }

.page-link { color: var(--bt-accent); }

.pagination .page-item.active .page-link { background: var(--bt-accent); border-color: var(--bt-accent); }

/* ------------------------------------------------------------------ */
/* Code / snippet boxes                                                 */
/* ------------------------------------------------------------------ */
.snippet-box {
    background: #0f172a;
    color: #a5f3fc;
    border-radius: 10px;
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-viewer {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    max-height: 70vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.console-table code { font-size: 0.78rem; color: #b91c1c; white-space: pre-wrap; word-break: break-word; }

.console-type {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 2px 7px;
    white-space: nowrap;
}

.console-type.t-error, .console-type.t-uncaught { background: #fee2e2; color: #b91c1c; }
.console-type.t-warn { background: #fef3c7; color: #b45309; }
.console-type.t-resource { background: #e0f2fe; color: #0369a1; }
.console-type.t-rejection { background: #fce7f3; color: #be185d; }
.console-type.t-other { background: #e2e8f0; color: #334155; }

.screenshot-frame {
    border: 1px solid var(--bt-border);
    border-radius: 10px;
    overflow: hidden;
    background:
        conic-gradient(#f8fafc 90deg, #eef2f7 90deg 180deg, #f8fafc 180deg 270deg, #eef2f7 270deg) 0 0 / 24px 24px;
}

.screenshot-frame img { display: block; width: 100%; height: auto; cursor: zoom-in; }

.meta-list { font-size: 0.86rem; }

.meta-list dt { color: var(--bt-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }

.meta-list dd { margin-bottom: 10px; word-break: break-word; }

.response-bubble { background: var(--bt-accent-soft); border: 1px solid #e0e7ff; border-radius: 10px; padding: 12px 14px; }

.response-bubble .author { font-weight: 700; font-size: 0.83rem; color: #3730a3; }

.response-bubble .time { color: var(--bt-muted); font-size: 0.74rem; }

.response-bubble p { margin: 6px 0 0; white-space: pre-wrap; font-size: 0.9rem; }

.response-bubble.from-reporter { background: #f0fdf4; border-color: #bbf7d0; }

.response-bubble.from-reporter .author { color: #166534; }

.badge.reporter-badge { background: #dcfce7; color: #166534; }

/* ------------------------------------------------------------------ */
/* Tree (sub-admins)                                                    */
/* ------------------------------------------------------------------ */
.tree-children { border-left: 2px solid var(--bt-border); margin-left: 1.35rem; padding-left: 1.35rem; }

/* ------------------------------------------------------------------ */
/* Empty states                                                         */
/* ------------------------------------------------------------------ */
.empty-state { text-align: center; padding: 46px 20px; color: var(--bt-muted); }

.empty-state i { font-size: 2.2rem; display: block; margin-bottom: 10px; color: #94a3b8; }

/* ------------------------------------------------------------------ */
/* Guest (auth) pages                                                   */
/* ------------------------------------------------------------------ */
body.guest-body {
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(79, 70, 229, 0.14), transparent 60%),
        radial-gradient(800px 420px at -10% 110%, rgba(14, 165, 233, 0.12), transparent 60%),
        var(--bt-surface);
}

.guest-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--bt-accent);
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.guest-card { border: 1px solid var(--bt-border); border-radius: 14px; box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08); }

@media (max-width: 991.98px) {
    .admin-content { padding: 18px; }
    .admin-topbar { padding: 12px 18px; }
}
