/* =============================================================================
   VCU — base design system
   Light background, wine/burgundy primary. Not a generic Bootstrap look:
   custom spacing scale, custom card/badge/button components, restrained
   color palette. Extended in later phases as more surfaces are built.
   ============================================================================= */

:root {
    --color-primary: #7A1F3D;        /* wine/burgundy */
    --color-primary-dark: #5C1730;
    --color-primary-light: #F4E6EB;  /* tint for badges/hover backgrounds */
    --color-bg: #F5F4F6;             /* app content background — light neutral gray, not bone-white */
    --color-surface: #FFFFFF;
    --color-border: #E8E1E3;
    --color-text: #241417;
    --color-text-muted: #7A6B6F;
    --color-success: #1E7A46;
    --color-success-bg: #E7F5EC;
    --color-warning: #9A6B00;
    --color-warning-bg: #FBF1DA;
    --color-danger: #B3261E;
    --color-danger-bg: #FBEAE9;

    /* Sidebar — solid dark wine, not white. Distinct from --color-primary
       so the sidebar can be a deeper, more saturated shade while buttons/
       links elsewhere stay on the lighter --color-primary. */
    --sidebar-bg: #6B1730;
    --sidebar-bg-active: #841E3C;
    --sidebar-text: rgba(255,255,255,0.72);
    --sidebar-text-active: #FFFFFF;
    --sidebar-icon: rgba(255,255,255,0.55);

    /* Icon-badge tints — circular icon backgrounds on stat/wallet cards */
    --badge-rose-bg: #FBE7EE; --badge-rose-fg: #C2185B;
    --badge-green-bg: #E3F6EA; --badge-green-fg: #1E7A46;
    --badge-blue-bg: #E7F0FE; --badge-blue-fg: #1D5FC2;
    --badge-amber-bg: #FDF0DC; --badge-amber-fg: #B9750A;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;

    --shadow-card: 0 1px 2px rgba(36, 20, 23, 0.06), 0 4px 16px rgba(36, 20, 23, 0.06);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* belt-and-braces: no component should cause page-level horizontal scroll on mobile */
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--space-3); font-weight: 650; letter-spacing: -0.01em; }

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ---- App shell ---- */
.app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0;
}
.app-header .brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary);
}

/* ---- Cards ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
}
.card + .card { margin-top: var(--space-4); }
.card-title { font-size: 1.05rem; margin-bottom: var(--space-3); }

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.auth-card { width: 100%; max-width: 420px; }

/* ---- Split auth layout — wine panel + white form panel ---- */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
}
.auth-split-brand {
    background: linear-gradient(160deg, var(--color-primary) 0%, var(--sidebar-bg) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-6) var(--space-5);
}
.auth-split-brand .auth-split-icon {
    width: 84px; height: 84px; border-radius: 50%;
    background: rgba(255,255,255,0.14);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: var(--space-4);
}
.auth-split-brand .auth-split-icon i { width: 38px; height: 38px; color: #fff; }
.auth-split-brand h1 { color: #fff; font-size: 1.5rem; margin-bottom: var(--space-2); }
.auth-split-brand p { color: rgba(255,255,255,0.78); max-width: 30ch; font-size: 0.92rem; line-height: 1.55; }
.auth-split-form {
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-4);
    background: var(--color-surface);
}
.auth-split-form-inner { width: 100%; max-width: 380px; }
.auth-split-logo {
    display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--color-primary);
    margin-bottom: var(--space-5); font-size: 1rem;
}
.auth-split-logo i { width: 20px; height: 20px; }

@media (max-width: 860px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-split-brand { padding: var(--space-5); min-height: 200px; }
    .auth-split-brand .auth-split-icon { width: 56px; height: 56px; margin-bottom: var(--space-2); }
    .auth-split-brand .auth-split-icon i { width: 26px; height: 26px; }
    .auth-split-brand h1 { font-size: 1.2rem; }
}

/* ---- Forms ---- */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}
.form-group { margin-bottom: var(--space-3); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: var(--space-1); }
.form-error { font-size: 0.8rem; color: var(--color-danger); margin-top: var(--space-1); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---- Badges (status pills) ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-neutral { background: var(--color-primary-light); color: var(--color-primary); }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table-responsive table { min-width: 560px; } /* forces horizontal scroll on narrow screens instead of squishing columns illegibly */
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---- Utility ---- */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

@media (max-width: 640px) {
    .card { padding: var(--space-4); border-radius: var(--radius-md); }
}

/* ---- Layout utilities used across dashboard/admin forms ---- */
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
@media (max-width: 560px) {
    .form-row { flex-direction: column; gap: var(--space-3); }
}

/* ---- Admin shell ---- */
.admin-body { background: var(--color-bg); }
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}
.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar-brand i { width: 20px; height: 20px; color: #fff; }
.admin-nav { padding: var(--space-3) var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 999px;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
}
.admin-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.admin-nav a.is-active { background: var(--sidebar-bg-active); color: var(--sidebar-text-active); }
.admin-nav a i { width: 18px; height: 18px; color: var(--sidebar-icon); flex-shrink: 0; }
.admin-nav a:hover i, .admin-nav a.is-active i { color: #fff; }
.admin-nav a.is-disabled { color: rgba(255,255,255,0.35); cursor: default; }
.admin-nav a.is-disabled:hover { background: none; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.admin-page-title { font-weight: 650; font-size: 1.1rem; overflow-wrap: anywhere; }
.admin-topbar-user { display: flex; align-items: center; gap: 14px; }
.admin-topbar-user i { width: 18px; height: 18px; vertical-align: middle; }
.admin-content { padding: var(--space-5); max-width: 1120px; }

.filter-bar { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.filter-bar .form-control { max-width: 220px; }

.pagination { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-size: 0.85rem;
}
.pagination .is-current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    padding: var(--space-4); display: flex; align-items: center; gap: 14px;
}
.stat-card .stat-label { font-size: 0.78rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; margin-top: 3px; }

/* ---- Mobile sidebar drawer (admin + dashboard shells) ----
   Below 900px, the sidebar becomes an off-canvas drawer: hidden by
   translateX(-100%) by default, slid in via .is-open (toggled by JS —
   see assets/js/app.js's initSidebarToggle()), with a dimmed backdrop
   behind it. The hamburger button itself is hidden above 900px, where
   the sidebar reverts to its normal in-flow, always-visible column. */
.sidebar-toggle { display: none; }
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(18,10,14,0.45);
    z-index: 40;
}
.sidebar-backdrop.is-open { display: block; }

@media (max-width: 900px) {
    .sidebar-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; border-radius: var(--radius-sm);
        border: 1px solid var(--color-border); background: var(--color-surface);
        color: var(--color-text); cursor: pointer;
    }
    .sidebar-toggle i { width: 19px; height: 19px; }

    .admin-sidebar, .dash-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; width: 248px;
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 50;
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }
    .admin-sidebar.is-open, .dash-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 20px 0 40px rgba(18,10,14,0.25);
    }
    /* Full label text stays visible in the open drawer — no icon-only
       collapse on mobile, since the drawer already reclaims the screen
       width a permanently-docked icon rail was trying to save. */
    .admin-sidebar-brand span, .dash-sidebar-brand span { display: inline; }
    .admin-nav a span, .dash-nav a span, .dash-nav-badge { display: inline; }
    .admin-nav a, .dash-nav a { font-size: 0.9rem; gap: 10px; }

    .admin-content, .dash-content { padding: var(--space-3); }
    .admin-topbar, .dash-topbar { padding: var(--space-3); }
    .dash-wallet-chip span:not(.lp-mono) { display: none; }
}
@media (max-width: 560px) {
    .dash-wallet-chip { padding: 6px 10px; font-size: 0.78rem; }
}

/* ---- Customer dashboard shell ---- */
.dash-body { background: var(--color-bg); }
.dash-shell { display: flex; min-height: 100vh; }

.dash-sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}
.dash-sidebar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-4); font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dash-sidebar-brand i { width: 20px; height: 20px; color: #fff; }
.dash-nav { padding: var(--space-3) var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.dash-nav a {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 999px;
    color: var(--sidebar-text); font-size: 0.9rem; font-weight: 500;
}
.dash-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.dash-nav a.is-active { background: var(--sidebar-bg-active); color: var(--sidebar-text-active); }
.dash-nav a i { width: 18px; height: 18px; color: var(--sidebar-icon); flex-shrink: 0; }
.dash-nav a:hover i, .dash-nav a.is-active i { color: #fff; }
.dash-nav a.is-disabled { color: rgba(255,255,255,0.35); cursor: default; }
.dash-nav a.is-disabled:hover { background: none; color: rgba(255,255,255,0.35); }
.dash-nav-badge {
    margin-left: auto; background: #fff; color: var(--sidebar-bg); font-size: 0.68rem; font-weight: 700;
    padding: 1px 6px; border-radius: 999px; line-height: 1.4;
}

.dash-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-5); background: var(--color-surface);
    border-bottom: 1px solid var(--color-border); gap: var(--space-3); flex-wrap: wrap;
}
.dash-page-title { font-weight: 650; font-size: 1.1rem; overflow-wrap: anywhere; }
.dash-topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.dash-wallet-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--color-primary-light); color: var(--color-primary);
    padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: 0.85rem;
}
.dash-wallet-chip i { width: 15px; height: 15px; }
.dash-wallet-chip-commission { background: #FBF1DA; color: #9A6B00; }

.dash-bell { position: relative; display: inline-flex; color: var(--color-text-muted); }
.dash-bell i { width: 20px; height: 20px; }
.dash-bell-dot {
    position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
    background: var(--color-danger); border-radius: 50%; border: 2px solid var(--color-surface);
}
.dash-user-menu { display: flex; align-items: center; gap: 12px; }
.dash-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
}
.dash-user-menu a i { width: 18px; height: 18px; vertical-align: middle; }

.dash-content { padding: var(--space-5); max-width: 1120px; }

/* ---- Icon badge — circular tinted icon used on stat/wallet cards ---- */
.icon-badge {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.icon-badge i { width: 20px; height: 20px; }
.icon-badge-rose  { background: var(--badge-rose-bg);  color: var(--badge-rose-fg); }
.icon-badge-green { background: var(--badge-green-bg); color: var(--badge-green-fg); }
.icon-badge-blue  { background: var(--badge-blue-bg);  color: var(--badge-blue-fg); }
.icon-badge-amber { background: var(--badge-amber-bg); color: var(--badge-amber-fg); }

/* ---- Dashboard widgets ---- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-bottom: var(--space-4); }
.dash-grid-uneven { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (max-width: 860px) {
    .dash-grid-2, .dash-grid-uneven { grid-template-columns: 1fr; }
}
.dash-widget {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    padding: var(--space-4); display: flex; align-items: center; gap: 14px;
}
.dash-widget-label { font-size: 0.78rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.dash-widget-value { font-size: 1.4rem; font-weight: 700; margin-top: 3px; }
.dash-widget-sub { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }

.dash-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.dash-quick-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 18px 10px; border-radius: var(--radius-md); border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); font-size: 0.82rem; font-weight: 550; text-align: center;
}
.dash-quick-tile i { width: 22px; height: 22px; color: var(--color-primary); }
.dash-quick-tile.is-disabled { color: var(--color-text-muted); cursor: default; opacity: 0.7; }
.dash-quick-tile.is-disabled i { color: var(--color-text-muted); }
.dash-quick-tile .dash-soon { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-text-muted); }

.dash-list-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--color-border); gap: 12px; }
.dash-list-item:first-child { border-top: none; }
.dash-empty { padding: 28px 0; text-align: center; color: var(--color-text-muted); font-size: 0.88rem; }
.dash-empty i { width: 28px; height: 28px; color: var(--color-border); margin-bottom: 8px; }

.dash-notif-item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--color-border); }
.dash-notif-item:first-child { border-top: none; }
.dash-notif-item.is-unread { background: var(--color-primary-light); margin: 0 -16px; padding: 14px 16px; border-radius: var(--radius-sm); border-top: none; }
.dash-notif-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--color-bg); display: flex; align-items: center; justify-content: center; color: var(--color-primary); flex-shrink: 0; }
.dash-notif-icon i { width: 16px; height: 16px; }

.dash-referral-box { display: flex; align-items: center; gap: 10px; background: var(--color-bg); border: 1px dashed var(--color-border); border-radius: var(--radius-sm); padding: 12px 14px; }
.dash-referral-box code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 600; }