/* =============================================================================
   Retail Software — Professional admin theme
   ============================================================================= */
:root {
    /* Brand / accent */
    --primary: #4f46e5;          /* indigo-600 */
    --primary-dark: #4338ca;     /* indigo-700 */
    --primary-soft: #eef2ff;     /* indigo-50  */
    --primary-rgb: 79, 70, 229;

    /* Surfaces */
    --content-bg: #f1f5f9;       /* slate-100 */
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --border-soft: #eef1f5;

    /* Sidebar */
    --sidebar-w: 260px;
    --sidebar-bg: #0f172a;       /* slate-900 */
    --sidebar-fg: #94a3b8;       /* slate-400 */
    --sidebar-fg-hover: #e2e8f0;
    --sidebar-active-bg: rgba(99, 102, 241, .18);
    --sidebar-heading: #64748b;

    /* Text */
    --text: #0f172a;
    --text-muted: #64748b;

    --topbar-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 6px 16px rgba(16, 24, 40, .08);
    --shadow-lg: 0 20px 40px rgba(16, 24, 40, .18);

    --bs-primary-rgb: 79, 70, 229;
}

html, body { height: 100%; }

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

a { text-decoration: none; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    flex-shrink: 0;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    transition: transform .22s ease;
    z-index: 1030;
    border-right: 1px solid rgba(255, 255, 255, .04);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 1.25rem;
    height: var(--topbar-h);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 1;
}

.sidebar-brand .brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), .45);
}

.sidebar-heading {
    padding: 1.1rem 1.35rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--sidebar-heading);
}

.sidebar-nav { padding: .5rem .6rem 1.5rem; list-style: none; margin: 0; }
.sidebar-nav .nav-item { margin: 1px 0; }

.sidebar-nav .nav-link {
    color: var(--sidebar-fg);
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .58rem .75rem;
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, .05);
    color: var(--sidebar-fg-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-nav .sidebar-group .chevron {
    font-size: .7rem;
    transition: transform .2s ease;
    opacity: .8;
}
.sidebar-nav .sidebar-group.collapsed .chevron { transform: rotate(-90deg); }

.sidebar-subnav {
    list-style: none;
    margin: .15rem 0 .25rem;
    padding: 0 0 0 .35rem;
    position: relative;
}
.sidebar-subnav::before {
    content: "";
    position: absolute;
    left: 1.15rem;
    top: .2rem;
    bottom: .2rem;
    width: 1px;
    background: rgba(255, 255, 255, .08);
}
.sidebar-subnav .nav-link { padding-left: 2.1rem; font-size: .87rem; }
.sidebar-subnav .nav-link .bi { font-size: .9rem; }

/* ---------- Main area ---------- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-toggle {
    font-size: 1.3rem;
    color: var(--text-muted);
    padding: .2rem .4rem;
    display: none;
}

.topbar-title { font-weight: 650; font-size: 1.02rem; color: var(--text); }

.topbar-right { margin-left: auto; }

.user-menu {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--text);
    padding: .3rem .5rem .3rem .35rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease;
}
.user-menu:hover { background: #f8fafc; border-color: var(--border); color: var(--text); }

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-weight: 600;
    font-size: .82rem;
    flex-shrink: 0;
}
.user-meta { line-height: 1.15; text-align: left; }
.user-meta .u-name { font-weight: 600; font-size: .85rem; }
.user-meta .u-role { font-size: .72rem; color: var(--text-muted); }

.content { padding: 1.5rem; flex: 1; }

.app-footer {
    padding: .85rem 1.5rem;
    color: var(--text-muted);
    font-size: .82rem;
    border-top: 1px solid var(--border);
    background: #fff;
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.35rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    letter-spacing: -.01em;
}
.page-header .subtitle { color: var(--text-muted); font-size: .88rem; margin-top: .1rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    padding: .9rem 1.1rem;
    font-weight: 600;
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 1.25rem; }
.card-footer { background: #fff; border-top: 1px solid var(--border-soft); }

/* ---------- Dashboard stat cards ---------- */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    transition: box-shadow .18s ease, transform .18s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-badge {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: .82rem; color: var(--text-muted); margin-top: .3rem; }

.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-green  { background: #ecfdf5; color: #059669; }
.badge-amber  { background: #fffbeb; color: #d97706; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(var(--primary-rgb), .3);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover, .btn-outline-primary:active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}
.btn-check:checked + .btn-outline-primary { background: var(--primary); border-color: var(--primary); }
.text-primary { color: var(--primary) !important; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ---------- Tables ---------- */
.table { margin-bottom: 0; color: var(--text); }
.table > thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table > tbody > tr > td { padding: .8rem 1rem; border-color: var(--border-soft); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: #f8fafc; }
.card > .table-responsive { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }

/* ---------- Badges / status ---------- */
.badge { font-weight: 600; padding: .38em .7em; border-radius: 999px; font-size: .72rem; }
.badge.bg-success { background: #ecfdf5 !important; color: #059669 !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #64748b !important; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: #334155; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: #d7dce3;
    padding: .5rem .75rem;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .15);
}
.input-group-text { background: #f8fafc; border-color: #d7dce3; color: var(--text-muted); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .9rem; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--primary-soft); color: #3730a3; border-color: #c7d2fe; }

.list-group-item-action:hover { background: #f8fafc; }

/* ---------- Apparel swatch / variant grid ---------- */
.swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,.15);
    vertical-align: middle;
}
.swatch-sm { width: 14px; height: 14px; border-radius: 4px; }

.pick-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick-grid .form-check {
    margin: 0;
    padding: .35rem .7rem .35rem 2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
}
.pick-grid .form-check-input:checked ~ .form-check-label { font-weight: 600; color: var(--primary); }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 15% 10%, rgba(124, 58, 237, .35), transparent 55%),
        radial-gradient(1000px 500px at 90% 90%, rgba(37, 99, 235, .35), transparent 55%),
        linear-gradient(135deg, #0f172a, #1e293b);
    padding: 1rem;
}
.login-wrap { width: 100%; max-width: 410px; }
.login-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 2.35rem 2.15rem;
}
.login-logo {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 1.8rem;
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), .45);
}
.login-card h1 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: .2rem; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.6rem; }
.login-card .btn-primary { padding: .6rem; font-weight: 600; }

/* ---------- POS ---------- */
.pos-search { position: relative; }
.pos-results {
    position: absolute;
    z-index: 1050;
    left: 0; right: 0;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    margin-top: 2px;
}
.pos-results:empty { display: none; }
.pos-pay { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.pos-grand { font-size: 1.1rem; }
#posGrand { font-size: 1.3rem; color: var(--primary); }

/* Receipt (POS complete + print) */
.receipt {
    max-width: 340px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.receipt-table th { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); }
.receipt-table td { font-size: .82rem; }

/* Searchable Select Combobox */
.searchable-item:hover {
    background-color: #f1f5f9 !important;
    color: var(--primary) !important;
}
.searchable-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25) !important;
}

/* Hover Elevation Animation */
.hover-elevate {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.hover-elevate:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
}

@media print {
    .sidebar, .topbar, .app-footer, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .receipt { border: none; max-width: 100%; }
    body { background: #fff; }
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .topbar-toggle { display: inline-block; }
}
