/* ═══════════════════════════════════════════════════════
   Sevee Admin Portal — Professional Theme
   ═══════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #6366f1;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --topbar-height: 64px;
    --topbar-bg: #ffffff;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition: all .18s ease;
}

/* ── Reset / Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-main);
    background: var(--body-bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

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

/* ── Sidebar ─────────────────────────────────────────── */
.admin-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -.3px;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 400;
}

/* Nav sections */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
    padding: 12px 20px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
}

.sidebar-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #818cf8;
    border-radius: 0 3px 3px 0;
}

.sidebar-link .nav-icon {
    width: 20px;
    font-size: 16px;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-link .nav-badge {
    margin-left: auto;
    background: rgba(99,102,241,.25);
    color: #818cf8;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.06);
    margin: 8px 12px;
}

.sidebar-bottom {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--sidebar-text);
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
    line-height: 1;
}

.sidebar-logout-btn:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ── Sidebar user dropdown ───────────────────────────── */
.sidebar-user-wrap {
    position: relative;
}

.sidebar-user {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: var(--transition);
    gap: 10px;
}

.sidebar-user:hover,
.sidebar-user-wrap.menu-open .sidebar-user {
    background: rgba(255,255,255,.07);
}

.sidebar-user-chevron {
    font-size: 10px;
    color: var(--sidebar-text);
    opacity: .6;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-user-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1e2433;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 -8px 24px rgba(0,0,0,.35);
    z-index: 100;
}

.sidebar-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}

.sidebar-user-menu-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.sidebar-user-menu-danger:hover {
    background: rgba(239,68,68,.12);
    color: #f87171;
}

.sidebar-user-menu-divider {
    height: 1px;
    background: rgba(255,255,255,.07);
    margin: 2px 0;
}

/* ── Main content area ───────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Topbar ──────────────────────────────────────────── */
.admin-topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
}

.topbar-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

/* ── Page content ────────────────────────────────────── */
.admin-content {
    flex: 1;
    padding: 28px;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 16px 20px !important;
    font-weight: 600;
    color: var(--text-main);
}

.card-body { padding: 20px !important; }
.card-footer { border-top: 1px solid var(--border) !important; background: #f8fafc !important; }

/* ── Stat cards ──────────────────────────────────────── */
.stat-card {
    border-radius: var(--radius) !important;
    border: none !important;
    overflow: hidden;
    position: relative;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

/* ── Tables ──────────────────────────────────────────── */
.table {
    font-size: 13.5px;
    margin-bottom: 0;
}

.table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border) !important;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--text-main);
}

.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: #f8fafc; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(99,102,241,.3);
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-outline-secondary:hover { background: #f1f5f9; color: var(--text-main); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: .2px;
}

/* ── Forms ───────────────────────────────────────────── */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 9px 14px;
    color: var(--text-main);
    transition: var(--transition);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    outline: none;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.input-group-text {
    background: #f8fafc;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 12px 16px;
}
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger) !important; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--success) !important; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning) !important; }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info) !important; }

/* ── Page header ─────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h4 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -.4px;
}

.page-header .page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Spinners / Loading ──────────────────────────────── */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.spinner-border { width: 28px; height: 28px; border-width: 3px; color: var(--primary); }

/* ── Pagination ──────────────────────────────────────── */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 0 4px;
}
.pagination-info { font-size: 13px; color: var(--text-muted); }

/* ── Filter bar ──────────────────────────────────────── */
.filter-bar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; margin: 0; }

/* ── Login page ──────────────────────────────────────── */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,.15) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(129,140,248,.1) 0%, transparent 50%);
}

.login-card {
    width: 420px;
    background: rgba(255,255,255,.98);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,.4);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.login-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    padding: 32px 32px 28px;
    text-align: center;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 20px rgba(99,102,241,.45));
}

.login-title { font-size: 22px; font-weight: 800; color: #fff; margin: 0 0 4px; }
.login-subtitle { font-size: 13px; color: #94a3b8; margin: 0; }

.login-body { padding: 28px 32px 32px; }

.login-body .form-control {
    padding: 11px 14px;
    font-size: 14px;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Utilities ───────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary-soft { background: rgba(99,102,241,.1) !important; }
.bg-success-soft { background: rgba(16,185,129,.1) !important; }
.bg-warning-soft { background: rgba(245,158,11,.1) !important; }
.bg-danger-soft  { background: rgba(239,68,68,.1) !important; }
.bg-info-soft    { background: rgba(59,130,246,.1) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.rounded-xl { border-radius: var(--radius) !important; }

/* ── Tab bar ─────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}
.tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: color .15s, border-color .15s, background .15s;
}
.tab-btn:hover { background: #f1f5f9; color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── Blazor error UI ─────────────────────────────────── */
#blazor-error-ui {
    display: none;   /* Blazor.js shows this only when a real circuit error occurs */
    background: #fef2f2;
    border-top: 1px solid #fca5a5;
    color: #991b1b;
    padding: 12px 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    font-size: 13px;
    align-items: center;
    gap: 12px;
}
#blazor-error-ui .reload { color: var(--primary); font-weight: 600; }
#blazor-error-ui .dismiss { margin-left: auto; cursor: pointer; }

/* ── Responsive ──────────────────────────────────────── */

/* Mobile top bar — only shown on mobile */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.mobile-menu-btn {
    width: 40px; height: 40px;
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background .15s;
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,.08); }

.mobile-brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.mobile-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.3px;
}

.mobile-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {

    /* Show mobile topbar */
    .mobile-topbar { display: flex; }

    /* Sidebar: hidden by default, slides in when .sidebar-open */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 150;
    }
    .admin-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.5);
    }

    /* Overlay shown when sidebar is open */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 140;
        backdrop-filter: blur(2px);
    }

    /* Main content: no left margin, push down past topbar */
    .admin-main {
        margin-left: 0;
        padding-top: 56px;
    }

    .admin-content { padding: 16px; }

    /* Page header: allow wrapping */
    .page-header { flex-wrap: wrap; gap: 12px; }

    /* Login card fits small screens */
    .login-card { width: calc(100vw - 32px); max-width: 420px; }
    .login-header { padding: 24px 24px 20px; }
    .login-body   { padding: 20px 24px 24px; }

    /* Confirm dialog */
    .confirm-dialog { width: calc(100vw - 32px); max-width: 380px; }

    /* Tables: horizontal scroll */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Filter bar tighter */
    .filter-bar { padding: 10px 12px; }
}

@media (max-width: 480px) {

    /* Page header: stack vertically */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header > a.btn,
    .page-header > button.btn { width: 100%; text-align: center; }

    /* Smaller stat values */
    .stat-card .stat-value { font-size: 22px; }
}

/* ── Confirm dialog / modal backdrop ─────────────────── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    backdrop-filter: blur(2px);
}

.confirm-dialog {
    width: 380px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideUp .18s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Validation ──────────────────────────────────────── */
.valid.modified:not([type=checkbox]) { border-color: var(--success) !important; }
.invalid { border-color: var(--danger) !important; }
.validation-message { color: var(--danger); font-size: 12px; margin-top: 4px; display: block; }
