/* =========================================================
   GLAM ESSENCE - EXACT ORIGINAL LOOK & FEEL
   Reference: http://139.180.214.45/glam/dashboard.php
   This is the extracted original CSS plus SPA additions
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Jost:wght@300;400;500;600;700&display=swap');

/* ── Exact original CSS variables & rules below ── */

:root {
    --sidebar-width: 255px;
    --topbar-height: 58px;
    --spd: 0.28s;
    --ease: cubic-bezier(0.4,0,0.2,1);
    --brand:       #7b1c36;
    --brand-dark:  #5a1227;
    --brand-mid:   #9d2a47;
    --brand-soft:  #fdf2f5;
    --gold:        #c9a96e;
    --gold-light:  #e8d5b0;
    --sb-bg:      #1a0a10;
    --sb-hover:   #2a1220;
    --sb-active:  #3d1a28;
    --sb-text:    #f0d8de;
    --sb-muted:   #a07585;
    --sb-border:  #2e141f;
    --sb-accent:  var(--brand);
    --c-main:      #7b1c36;
    --c-sales:     #10b981;
    --c-products:  #c9a96e;
    --c-purchases: #f59e0b;
    --c-customers: #e05c78;
    --c-expenses:  #ec4899;
    --c-reports:   #06b6d4;
    --c-admin:     #9d2a47;
}

/* ── Override Bootstrap reboot link rule ── */
a:not([href]):not([class]),
a:not([href]):not([class]):hover {
    color: unset !important;
    text-decoration: none;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Jost', 'Segoe UI', sans-serif;
    background: #f7f0f2;
    overflow-x: hidden;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--sb-bg);
    overflow-y: auto; overflow-x: hidden;
    z-index: 1000;
    transition: margin-left var(--spd) var(--ease), box-shadow var(--spd) var(--ease);
    box-shadow: 3px 0 20px rgba(0,0,0,0.25);
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); box-shadow: none; }
@media (max-width: 768px) {
    .sidebar { margin-left: calc(-1 * var(--sidebar-width)); box-shadow: none; }
    .sidebar.mobile-show { margin-left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #3d1a28; border-radius: 3px; }

.sidebar-header {
    display: flex; align-items: center; gap: 11px;
    padding: 18px 15px; position: sticky; top: 0;
    background: var(--brand-dark); z-index: 2;
    border-bottom: 1px solid rgba(201,169,110,0.2);
}
.sidebar-header::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--brand-mid), var(--gold));
}
.sb-logo {
    width: 36px; height: 36px;
    background: rgba(201,169,110,0.15); border: 1px solid rgba(201,169,110,0.35);
    border-radius: 9px; display: grid; place-items: center;
    font-size: 1.05rem; color: var(--gold); flex-shrink: 0;
}
.sidebar-header h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem; font-weight: 700; color: #fff;
    line-height: 1.2; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: 0.02em;
}
.sidebar-header small {
    font-size: 0.66rem; color: var(--gold);
    display: block; margin-top: 2px;
    font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
}

.sidebar-menu { padding: 8px 0 60px; }
.menu-section { border-bottom: 1px solid var(--sb-border); }
.menu-section:last-child { border-bottom: none; }

.section-toggle {
    display: flex; align-items: center; padding: 10px 15px;
    cursor: pointer; user-select: none;
    transition: background var(--spd); gap: 9px;
}
.section-toggle:hover { background: var(--sb-hover); }

.section-toggle-icon {
    width: 28px; height: 28px; border-radius: 7px;
    display: grid; place-items: center;
    font-size: 0.9rem; flex-shrink: 0;
    transition: background var(--spd);
}
.sec-main      .section-toggle-icon { background: rgba(123,28,54,0.4);  color: #f0a0b8; }
.sec-sales     .section-toggle-icon { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.sec-products  .section-toggle-icon { background: rgba(201,169,110,0.15); color: var(--gold); }
.sec-purchases .section-toggle-icon { background: rgba(245,158,11,0.15); color: #fcd34d; }
.sec-customers .section-toggle-icon { background: rgba(224,92,120,0.15); color: #fca5a5; }
.sec-expenses  .section-toggle-icon { background: rgba(236,72,153,0.15); color: #f9a8d4; }
.sec-reports   .section-toggle-icon { background: rgba(6,182,212,0.15);  color: #67e8f9; }
.sec-admin     .section-toggle-icon { background: rgba(201,169,110,0.12); color: var(--gold-light); }

.section-toggle-label {
    flex: 1; font-size: 0.82rem; font-weight: 500;
    color: var(--sb-muted); letter-spacing: 0.01em;
}
.menu-section.open .section-toggle-label { color: #ffffff; }

.section-caret {
    font-size: 0.65rem; color: rgba(201,169,110,0.6);
    transition: transform var(--spd) var(--ease); flex-shrink: 0;
}
.menu-section.open .section-caret { transform: rotate(90deg); color: var(--gold); }

.menu-section.open > .section-toggle { background: rgba(123,28,54,0.25); }
.sec-main.open      > .section-toggle { border-left: 3px solid var(--gold); }
.sec-sales.open     > .section-toggle { border-left: 3px solid #059669; }
.sec-products.open  > .section-toggle { border-left: 3px solid var(--gold); }
.sec-purchases.open > .section-toggle { border-left: 3px solid #d97706; }
.sec-customers.open > .section-toggle { border-left: 3px solid #e05c78; }
.sec-expenses.open  > .section-toggle { border-left: 3px solid #db2777; }
.sec-reports.open   > .section-toggle { border-left: 3px solid #0891b2; }
.sec-admin.open     > .section-toggle { border-left: 3px solid var(--gold); }

.section-links {
    max-height: 0; overflow: hidden;
    background: rgba(0,0,0,0.3);
    transition: max-height 0.32s var(--ease);
}
.menu-section.open .section-links { max-height: 500px; }

.section-links a,
.section-links a:not([href]),
.section-links a:not([href]):not([class]) {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 15px 9px 52px;
    font-size: 0.84rem; font-weight: 400;
    color: #d8c2ca !important; text-decoration: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background var(--spd), color var(--spd), border-color var(--spd);
}
.section-links a i,
.section-links a:not([href]) i { font-size: 0.875rem; flex-shrink: 0; width: 16px; text-align: center; color: rgba(201,169,110,0.75) !important; }
.section-links a:hover,
.section-links a:not([href]):hover,
.section-links a:not([href]):not([class]):hover  { background: var(--sb-hover); color: #ffffff !important; }
.section-links a:hover i,
.section-links a:not([href]):hover i { color: var(--gold) !important; }
.section-links a.active,
.section-links a.active:not([href]) { background: rgba(123,28,54,0.45); color: #ffffff !important; font-weight: 600; border-left: 3px solid var(--gold); }
.section-links a.active i,
.section-links a.active:not([href]) i { color: var(--gold) !important; }

.nav-badge {
    margin-left: auto; background: rgba(201,169,110,0.2); color: var(--gold);
    border-radius: 10px; font-size: 0.65rem; font-weight: 700;
    padding: 1px 6px; flex-shrink: 0;
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width); min-height: 100vh;
    background: #f7f0f2;
    transition: margin-left var(--spd) var(--ease);
}
.main-content.expanded { margin-left: 0; }
@media (max-width: 768px) { .main-content { margin-left: 0 !important; } }

/* ── Top Bar ── */
.top-bar {
    height: var(--topbar-height); background: var(--brand);
    padding: 0 18px; display: flex; align-items: center;
    justify-content: space-between; gap: 15px;
    border-bottom: 2px solid var(--brand-dark);
    position: sticky; top: 0; z-index: 999;
    box-shadow: 0 2px 12px rgba(90,18,39,0.35);
}
.top-bar::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.menu-toggle {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85); border-radius: 8px;
    display: grid; place-items: center; font-size: 1.2rem;
    cursor: pointer; transition: background var(--spd), color var(--spd); flex-shrink: 0;
}
.menu-toggle:hover { background: rgba(255,255,255,0.2); color: #fff; }

.current-branch {
    min-width: 180px; background: rgba(255,255,255,0.12);
    padding: 6px 14px; border-radius: 30px;
    font-size: 0.85rem; font-weight: 500; color: white;
    text-align: center; flex-shrink: 0;
}
.current-branch i { margin-right: 6px; font-size: 0.9rem; }

.top-bar-brand { flex: 1; display: flex; align-items: center; gap: 10px; overflow: hidden; }
.top-bar-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700; font-size: 1.1rem; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.03em;
}
.top-bar-date {
    font-size: 0.68rem; color: rgba(255,255,255,0.45);
    font-weight: 400; margin-left: 10px; font-family: 'Jost', sans-serif;
}
@media (max-width: 480px) { .top-bar-date { display: none; } }

.user-info { display: flex; align-items: center; gap: 8px; }
.user-info .dropdown-toggle {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.92); font-family: 'Jost', inherit;
    font-weight: 500; font-size: 0.82rem; padding: 6px 13px;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    transition: background var(--spd), border-color var(--spd);
}
.user-info .dropdown-toggle:hover { background: rgba(255,255,255,0.18); border-color: rgba(201,169,110,0.4); }
.user-info .dropdown-toggle i { color: rgba(255,255,255,0.65); font-size: 1.05rem; }
.user-info .dropdown-toggle::after { display: none; }

.dropdown-menu {
    border: 1px solid #f0dde2; box-shadow: 0 10px 35px rgba(90,18,39,0.15);
    border-radius: 12px; padding: 6px 0; min-width: 205px; margin-top: 8px !important;
}
.dropdown-section-header {
    padding: 8px 14px 4px; font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--gold); font-weight: 700;
}
.dropdown-item {
    padding: 9px 16px; font-size: 0.865rem; color: #3d1220;
    font-family: 'Jost', inherit; display: flex; align-items: center; gap: 10px;
    transition: background var(--spd), padding-left var(--spd);
}
.dropdown-item i { width: 17px; color: #a07585; font-size: 0.92rem; flex-shrink: 0; }
.dropdown-item:hover { background: var(--brand-soft); padding-left: 20px; }
.dropdown-item:hover i { color: var(--brand); }
.dropdown-item.text-danger { color: #dc2626 !important; }
.dropdown-item.text-danger i { color: #ef4444; }
.dropdown-item.text-danger:hover { background: #fef2f2; padding-left: 20px; }
.dropdown-divider { border-color: #f0dde2; margin: 4px 0; }

.user-avatar {
    width: 24px; height: 24px;
    background: rgba(201,169,110,0.25); border: 1px solid rgba(201,169,110,0.5);
    border-radius: 50%; display: grid; place-items: center;
    font-size: 0.68rem; font-weight: 700; color: var(--gold); flex-shrink: 0;
}

/* ── Quick Stats ── */
.quick-stats {
    display: flex; flex-wrap: wrap; background: #fff;
    border-bottom: 1px solid #f0dde2; padding: 12px 20px; gap: 0;
}
.stat-item { flex: 1; min-width: 160px; text-align: center; padding: 6px 10px; border-right: 1px solid #f0dde2; }
.stat-item:last-child { border-right: none; }
.stat-item .label {
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--gold); font-weight: 700; margin-bottom: 2px;
}
.stat-item .value {
    font-size: 1.25rem; font-weight: 700; color: var(--brand); line-height: 1.2;
    font-family: 'Cormorant Garamond', serif;
}
.stat-item .value small {
    font-size: 0.65rem; color: #a07585; font-weight: 500; margin-left: 2px;
    font-family: 'Jost', sans-serif;
}
@media (max-width: 768px) {
    .stat-item { border-right: none; border-bottom: 1px solid #f0dde2; }
    .stat-item:last-child { border-bottom: none; }
    .current-branch { display: none; }
}

/* ── Page Content ── */
.page-content-inner { padding: 20px; }
@media (max-width: 576px) { .page-content-inner { padding: 14px; } }

.page-header {
    background: #fff; border: 1px solid #f0dde2; border-radius: 12px;
    padding: 16px 20px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 1px 6px rgba(90,18,39,0.06);
    border-top: 3px solid var(--brand);
}
.page-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem; font-weight: 700; color: var(--brand); margin: 0;
}

/* ── Spinner ── */
.spinner-overlay {
    position: fixed; inset: 0; background: rgba(247,240,242,0.85);
    backdrop-filter: blur(2px); display: none;
    justify-content: center; align-items: center; z-index: 9999;
}
.spinner-overlay.show { display: flex; }
.spinner-overlay .spinner-border { color: var(--brand) !important; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.35s var(--ease); }

.alert { border-radius: 10px; font-size: 0.875rem; }
.card { border-radius: 12px; border: 1px solid #f0dde2; box-shadow: 0 1px 6px rgba(90,18,39,0.05); }
.btn { border-radius: 8px; font-weight: 600; font-size: 0.875rem; font-family: 'Jost', inherit; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.table { font-size: 0.875rem; }
.table thead th {
    background: #fdf2f5; color: var(--brand-mid); font-weight: 700;
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
    border-bottom: 2px solid #f0dde2;
}

/* ── Dashboard-specific ── */
.dash-wrap { padding: 20px; }

.welcome-bar {
    background: linear-gradient(135deg, #1e293b 0%, #1d4ed8 100%);
    border-radius: 14px; padding: 22px 26px;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 14px; margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(29,78,216,0.2);
}
.welcome-bar h4 { color: #fff; font-weight: 800; font-size: 1.25rem; margin: 0; }
.welcome-bar p  { color: rgba(255,255,255,0.55); font-size: 0.82rem; margin: 3px 0 0; }
.welcome-bar .btn-light {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; font-weight: 600; font-size: 0.82rem;
    padding: 7px 16px; border-radius: 8px; transition: background 0.2s;
    text-decoration: none; cursor: pointer;
}
.welcome-bar .btn-light:hover { background: rgba(255,255,255,0.22); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px)  { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 20px; display: flex; align-items: flex-start; gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }

.stat-icon-wrap {
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0;
}
.si-green  { background: #d1fae5; color: #059669; }
.si-blue   { background: #dbeafe; color: #2563eb; }
.si-amber  { background: #fef3c7; color: #d97706; }
.si-red    { background: #fee2e2; color: #dc2626; }
.si-indigo { background: #ede9fe; color: #7c3aed; }
.si-cyan   { background: #cffafe; color: #0891b2; }
.si-pink   { background: #fce7f3; color: #db2777; }
.si-slate  { background: #f1f5f9; color: #475569; }

.stat-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #94a3b8; margin-bottom: 4px; }
.stat-value { font-size: 1.45rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
.stat-sub   { font-size: 0.75rem; color: #64748b; margin-top: 3px; }

.dash-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04); overflow: hidden; margin-bottom: 20px;
}
.dash-card-header {
    padding: 14px 18px; border-bottom: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
}
.dash-card-header h6 {
    font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; margin: 0;
    display: flex; align-items: center; gap: 7px;
}
.dash-card-header .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.dash-card .table { font-size: 0.835rem; margin: 0; }
.dash-card .table thead th {
    background: #f8fafc; color: #475569; font-weight: 700;
    font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0; padding: 10px 14px;
}
.dash-card .table tbody td { padding: 10px 14px; vertical-align: middle; border-color: #f1f5f9; }
.dash-card .table tbody tr:last-child td { border-bottom: none; }
.dash-card .table tbody tr:hover { background: #f8fafc; }

.badge-paid     { background: #d1fae5; color: #065f46; }
.badge-partial  { background: #fef3c7; color: #92400e; }
.badge-unpaid   { background: #fee2e2; color: #991b1b; }
.badge-overdue  { background: #fee2e2; color: #991b1b; }
.badge-outofstock { background: #fee2e2; color: #991b1b; }
.badge-lowstock { background: #fef3c7; color: #92400e; }

.status-pill {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700; text-transform: capitalize;
}
.pm-cash     { background: #d1fae5; color: #065f46; }
.pm-mobile   { background: #cffafe; color: #155e75; }
.pm-bank     { background: #dbeafe; color: #1e40af; }
.pm-card     { background: #fce7f3; color: #9d174d; }

.aging-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; padding: 16px; }
.aging-box { border-radius: 10px; padding: 16px 14px; text-align: center; }
.aging-box .label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.aging-box .value { font-size: 1.1rem; font-weight: 800; }
.aging-current { background: #f1f5f9; color: #0f172a; }
.aging-warn    { background: #fef3c7; color: #92400e; }
.aging-danger  { background: #fee2e2; color: #991b1b; }

.quick-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; padding: 16px; }
@media (max-width: 992px) { .quick-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px)  { .quick-grid { grid-template-columns: 1fr; } }

.quick-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 10px; border-radius: 10px;
    border: 1.5px solid #e2e8f0; background: #fff;
    font-size: 0.8rem; font-weight: 600; color: #1e293b;
    text-decoration: none; transition: all 0.2s; cursor: pointer;
}
.quick-btn i { font-size: 1.4rem; }
.quick-btn:hover { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59,130,246,0.15); }

.empty-state { padding: 24px; text-align: center; color: #94a3b8; font-size: 0.85rem; }
.empty-state i { font-size: 1.8rem; display: block; margin-bottom: 8px; color: #cbd5e1; }

.view-btn {
    font-size: 0.75rem; font-weight: 600; padding: 4px 12px;
    border-radius: 6px; border: 1px solid #e2e8f0; background: #fff;
    color: #475569; text-decoration: none; transition: all 0.15s; cursor: pointer;
}
.view-btn:hover { background: #f1f5f9; color: #0f172a; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 4px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 4px; }
@media (max-width: 900px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

/* ── SPA Login Overlay ── */
#loginOverlay {
    position: fixed; inset: 0; background: #1a0a10;
    z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: #fff; width: 420px; border-radius: 16px; padding: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4); text-align: center;
    border: 1px solid #f0dde2;
}
.login-card .form-label {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    color: var(--brand); letter-spacing: 0.05em;
}

/* ── SPA page-view toggle ── */
.page-view { display: none; }
.page-view.active { display: block; }
