/* ============================================
   Inventory Management System
   Premium Admin Dashboard Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --theme-color: #4f46e5;
    --theme-dark: #4338ca;
    --theme-darker: #3730a3;
    --theme-light: #eef2ff;
    --theme-rgb: 79, 70, 229;
    --accent: #7c3aed;
    --accent-rgb: 124, 58, 237;
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: var(--theme-color);
    --topbar-height: 60px;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
    --card-shadow-hover: 0 20px 25px -5px rgba(0,0,0,.06), 0 8px 10px -6px rgba(0,0,0,.04);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #06b6d4;
    --info-bg: #ecfeff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all .25s cubic-bezier(.4,0,.2,1);
    --transition-fast: all .15s cubic-bezier(.4,0,.2,1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.07), 0 8px 10px -6px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text-secondary);
    font-size: .875rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.wrapper { display: flex; min-height: 100vh; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.sidebar-header {
    padding: 1.375rem 1.25rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.06);
    position: relative;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 1.25rem;
    right: 1.25rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--theme-rgb),.4), transparent);
}

.sidebar-header i { color: var(--theme-color); filter: drop-shadow(0 0 8px rgba(var(--theme-rgb),.4)); }
.sidebar-header h5 {
    font-size: .8125rem;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: .02em;
    margin: 0;
}
.sidebar-logo { max-width: 100px; max-height: 40px; object-fit: contain; }

.sidebar-nav {
    list-style: none;
    padding: .625rem 0;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5625rem 1rem;
    margin: 1px .625rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.sidebar-nav li a:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,.06);
}

.sidebar-nav li.active a {
    color: #fff;
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    box-shadow: 0 4px 12px rgba(var(--theme-rgb),.35),
                inset 0 1px 0 rgba(255,255,255,.12);
    font-weight: 600;
}

.sidebar-nav li a i {
    font-size: 1.0625rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   TOP NAVBAR
   ============================================ */
.top-navbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(226,232,240,.6);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.sidebar-toggle {
    color: var(--text-secondary);
    padding: .375rem;
    margin-right: .75rem;
    border: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    background: none;
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--theme-light); }

.page-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.01em;
    margin: 0;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8125rem;
    box-shadow: 0 2px 8px rgba(var(--theme-rgb),.3);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    padding: 1.5rem;
    flex: 1;
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--theme-color), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: rgba(var(--theme-rgb),.15);
}

.stat-card:hover::before { opacity: 1; }

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -.02em;
    margin-top: .25rem;
}

.stat-card .stat-label {
    font-size: .6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: .75rem 1.25rem;
}

.card-header h5, .card-header h6 {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.01em;
    margin: 0;
}

.card-body { padding: 1.25rem; }

/* ============================================
   TABLES
   ============================================ */
.table { --bs-table-bg: transparent; margin-bottom: 0; }

.table th {
    font-weight: 600;
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: .625rem 1rem;
    white-space: nowrap;
    background: #f8fafc;
}

.table td {
    vertical-align: middle;
    font-size: .8125rem;
    color: var(--text-secondary);
    padding: .625rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr { transition: var(--transition-fast); }
.table-hover tbody tr:hover { background: rgba(var(--theme-rgb),.02); }
.table tbody tr:last-child td { border-bottom: none; }

.table a {
    color: var(--theme-color);
    text-decoration: none;
    font-weight: 600;
}
.table a:hover { color: var(--theme-dark); text-decoration: underline; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 600;
    font-size: .6875rem;
    padding: .3em .625em;
    border-radius: 6px;
    letter-spacing: .02em;
}

.badge-stock-low { background: #fef3c7; color: #92400e; }
.badge-stock-out { background: #fee2e2; color: #991b1b; }
.badge-stock-ok  { background: #dcfce7; color: #166534; }

/* ============================================
   FORMS
   ============================================ */
.form-label {
    font-weight: 600;
    font-size: .8125rem;
    color: var(--text-secondary);
    margin-bottom: .375rem;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    font-size: .8125rem;
    padding: .5rem .875rem;
    transition: var(--transition-fast);
    color: var(--text-primary);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb),.1);
    background: #fff;
}

.form-control::placeholder { color: #cbd5e1; }

.form-control-sm, .form-select-sm {
    padding: .375rem .75rem;
    font-size: .8125rem;
}

.input-group-text {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    border-width: 1.5px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .875rem;
}

.form-check-input:checked {
    background-color: var(--theme-color);
    border-color: var(--theme-color);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 600;
    font-size: .8125rem;
    border-radius: var(--radius-sm);
    padding: .4375rem .875rem;
    transition: var(--transition-fast);
    letter-spacing: .01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
}

.btn-sm {
    padding: .3125rem .625rem;
    font-size: .75rem;
    border-radius: 6px;
}

.btn-theme,
.btn-primary {
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    color: #fff;
    border: none;
    box-shadow: 0 2px 4px rgba(var(--theme-rgb),.25);
}

.btn-theme:hover, .btn-theme:focus,
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--theme-dark), #6d28d9);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--theme-rgb),.35);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: rgba(var(--theme-rgb),.3);
    color: var(--theme-color);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--theme-color);
    border-color: var(--theme-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--theme-rgb),.25);
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

.btn-outline-danger { border-color: rgba(239,68,68,.3); color: var(--danger); }
.btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.25);
}

.btn-outline-info { border-color: rgba(6,182,212,.3); color: var(--info); }
.btn-outline-info:hover {
    background: var(--info);
    border-color: var(--info);
    color: #fff;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 2px 4px rgba(16,185,129,.25);
}
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 2px 4px rgba(239,68,68,.25);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-action {
    padding: .25rem .4375rem;
    font-size: .75rem;
    border-radius: 6px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem .75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    transition: var(--transition);
    min-height: 88px;
    gap: .5rem;
    cursor: pointer;
}

.quick-action-btn:hover {
    border-color: rgba(var(--theme-rgb),.3);
    color: var(--theme-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    background: var(--theme-light);
}

.quick-action-btn i { font-size: 1.5rem; transition: var(--transition); }
.quick-action-btn:hover i { transform: scale(1.1); }
.quick-action-btn small { font-weight: 600; font-size: .75rem; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius-sm);
    font-size: .8125rem;
    font-weight: 500;
    border: none;
    padding: .75rem 1rem;
}

.alert-success { background: var(--success-bg); color: #065f46; border-left: 3px solid var(--success); }
.alert-danger  { background: var(--danger-bg); color: #991b1b; border-left: 3px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-left: 3px solid var(--warning); }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    padding: .75rem 1.5rem;
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination .page-link {
    border-radius: var(--radius-sm);
    margin: 0 2px;
    font-size: .8125rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: .375rem .75rem;
    transition: var(--transition-fast);
}

.pagination .page-link:hover {
    background: var(--theme-light);
    border-color: rgba(var(--theme-rgb),.2);
    color: var(--theme-color);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    border-color: var(--theme-color);
    box-shadow: 0 2px 4px rgba(var(--theme-rgb),.25);
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    padding: .375rem;
    font-size: .8125rem;
    animation: dropdownFade .15s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    border-radius: 6px;
    padding: .4375rem .75rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.dropdown-item:hover { background: var(--theme-light); color: var(--theme-color); }

/* ============================================
   MODAL
   ============================================ */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 25px 50px rgba(0,0,0,.12);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.125rem 1.5rem;
}

.modal-title { font-weight: 700; font-size: .9375rem; color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 1rem 1.5rem; }

.modal-backdrop { backdrop-filter: blur(4px); }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--theme-rgb),.15) 0%, transparent 70%);
    top: -200px; right: -200px;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb),.1) 0%, transparent 70%);
    bottom: -200px; left: -200px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
    position: relative;
    z-index: 1;
}

.login-card h2 {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.625rem;
    letter-spacing: -.02em;
    margin: 0;
}

.login-card .form-control {
    padding: .625rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
}

.login-card .btn-primary {
    padding: .625rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    border: none;
    box-shadow: 0 4px 12px rgba(var(--theme-rgb),.35);
    font-size: .875rem;
}

.login-card .btn-primary:hover {
    background: linear-gradient(135deg, var(--theme-dark), #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--theme-rgb),.45);
}

/* ============================================
   INVOICE PRINT
   ============================================ */
.invoice-print {
    max-width: 210mm;
    margin: 0 auto;
    padding: 20mm;
    background: #fff;
    font-family: 'Plus Jakarta Sans', Arial, sans-serif;
}

.invoice-print .invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.invoice-print table { width: 100%; border-collapse: collapse; }
.invoice-print table th { background: #f8fafc; padding: .5rem; font-size: .85rem; text-align: left; }
.invoice-print table td { padding: .5rem; border-bottom: 1px solid #e2e8f0; }

.invoice-totals { margin-left: auto; width: 300px; }
.invoice-totals td { padding: .35rem .5rem; }
.invoice-totals .grand-total td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--text-primary); }

/* ============================================
   MISC
   ============================================ */
.cursor-pointer { cursor: pointer; }
.text-theme { color: var(--theme-color) !important; }

.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; opacity: .6; }

.section-heading {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .375rem;
}

.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }

/* ============================================
   NAV TABS
   ============================================ */
.nav-tabs { border-bottom: 2px solid var(--border-color); }

.nav-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .8125rem;
    padding: .5rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition-fast);
}

.nav-tabs .nav-link:hover { color: var(--theme-color); border-color: transparent; }

.nav-tabs .nav-link.active {
    color: var(--theme-color);
    border-bottom-color: var(--theme-color);
    background: transparent;
}

/* ============================================
   LIST GROUP
   ============================================ */
.list-group-item {
    border-color: var(--border-color);
    padding: .75rem 1.25rem;
    font-size: .8125rem;
}

/* ============================================
   REPORT CARDS
   ============================================ */
.report-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

.report-card:hover {
    border-color: rgba(var(--theme-rgb),.3);
    color: var(--theme-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--theme-light);
}

.report-card .report-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.report-card .report-title {
    font-weight: 600;
    font-size: .875rem;
    color: var(--text-primary);
}

.report-card .report-desc {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .125rem;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .sidebar, .top-navbar, .app-footer, .no-print { display: none !important; }
    .content { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
    body { background: #fff; }
    .card { border: none; box-shadow: none; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .content { margin-left: 0; }
    .main-content { padding: 1rem; }
    .top-navbar { padding: 0 1rem; }
    .stat-card .stat-value { font-size: 1.25rem; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1035;
        backdrop-filter: blur(4px);
    }
    .sidebar-overlay.show { display: block; }
}

@media (max-width: 575.98px) {
    .main-content { padding: .75rem; }
    .stat-card { padding: .875rem; }
    .stat-card .stat-value { font-size: 1.125rem; }
    .quick-action-btn { min-height: 72px; padding: .75rem .5rem; }
    .card-body { padding: 1rem; }
    .login-card { padding: 2rem 1.5rem; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: rgba(var(--theme-rgb),.15);
    color: var(--theme-dark);
}

/* ============================================
   ANIMATION UTILITY
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp .35s ease both; }

.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .1s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .2s; }

/* ============================================
   DARK MODE
   ============================================ */
body.dark-mode {
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-shadow: 0 1px 3px rgba(0,0,0,.2);
    --card-shadow-hover: 0 10px 15px rgba(0,0,0,.3);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-md: 0 4px 6px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.3);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.3);
}

body.dark-mode .top-navbar {
    background: rgba(30,41,59,.85);
    border-bottom-color: #334155;
}

body.dark-mode .table th { background: #1e293b; color: #94a3b8; border-bottom-color: #334155; }
body.dark-mode .table td { border-bottom-color: #1e293b; }
body.dark-mode .table-hover tbody tr:hover { background: rgba(99,102,241,.05); }
body.dark-mode .bg-light { background: #1e293b !important; }
body.dark-mode .form-control, body.dark-mode .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
body.dark-mode .form-control:focus, body.dark-mode .form-select:focus {
    background: #0f172a;
    border-color: var(--theme-color);
}
body.dark-mode .input-group-text { background: #1e293b; border-color: #334155; color: #64748b; }
body.dark-mode .dropdown-menu { background: #1e293b; border-color: #334155; }
body.dark-mode .dropdown-item { color: #cbd5e1; }
body.dark-mode .dropdown-item:hover { background: rgba(99,102,241,.1); color: var(--theme-color); }
body.dark-mode .modal-content { background: #1e293b; }
body.dark-mode .modal-header, body.dark-mode .modal-footer { border-color: #334155; }
body.dark-mode .nav-tabs { border-bottom-color: #334155; }
body.dark-mode .nav-tabs .nav-link { color: #64748b; }
body.dark-mode .app-footer { background: #1e293b; border-top-color: #334155; }
body.dark-mode .alert-info { background: rgba(59,130,246,.1); color: #93c5fd; }
body.dark-mode .alert-success { background: rgba(16,185,129,.1); color: #6ee7b7; }
body.dark-mode .alert-danger { background: rgba(239,68,68,.1); color: #fca5a5; }
body.dark-mode .alert-warning { background: rgba(245,158,11,.1); color: #fcd34d; }
body.dark-mode .btn-outline-secondary { border-color: #475569; color: #94a3b8; }
body.dark-mode .btn-outline-secondary:hover { background: #334155; color: #f1f5f9; border-color: #475569; }
body.dark-mode .quick-action-btn { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body.dark-mode .quick-action-btn:hover { border-color: rgba(var(--theme-rgb),.4); background: rgba(var(--theme-rgb),.08); }
body.dark-mode .report-card { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body.dark-mode .report-card:hover { background: rgba(var(--theme-rgb),.08); border-color: rgba(var(--theme-rgb),.3); }
body.dark-mode .stat-card:hover { border-color: rgba(var(--theme-rgb),.3); }
body.dark-mode code { background: rgba(var(--theme-rgb),.1); color: var(--theme-color); }
body.dark-mode .table-bordered > :not(caption) > * > * { border-color: #334155; }
body.dark-mode .table-dark { background: #0f172a; }

/* ============================================
   QUOTATION MODULE — Premium Styles
   ============================================ */
.q-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }

.q-stat {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    display: flex;
    align-items: center;
    gap: .875rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.q-stat::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    border-radius: 0 3px 3px 0;
}
.q-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.q-stat--draft::after { background: var(--warning); }
.q-stat--sent::after { background: var(--theme-color); }
.q-stat--accepted::after { background: var(--success); }
.q-stat--total::after { background: linear-gradient(180deg, var(--theme-color), var(--accent)); }
.q-stat .q-stat__icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}
.q-stat .q-stat__value {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -.02em;
}
.q-stat .q-stat__label {
    font-size: .6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.q-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.q-header-bar .q-title {
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.q-header-bar .q-title i {
    color: var(--theme-color);
    font-size: 1.25rem;
}

.q-empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
}
.q-empty-state .q-empty-icon {
    width: 80px; height: 80px;
    border-radius: 20px;
    background: var(--theme-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 2rem;
    color: var(--theme-color);
}
.q-empty-state h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: .375rem;
}
.q-empty-state p { color: var(--text-muted); font-size: .8125rem; margin-bottom: 1rem; }

.q-form-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
}
.q-form-section:hover { box-shadow: var(--shadow-md); }
.q-form-section__head {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(var(--theme-rgb),.03), transparent);
}
.q-form-section__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9375rem;
    flex-shrink: 0;
}
.q-form-section__title {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.01em;
}
.q-form-section__subtitle {
    font-size: .6875rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.q-form-section__body { padding: 1.25rem; }

.q-pdf-drop {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    background: rgba(var(--theme-rgb),.01);
}
.q-pdf-drop:hover,
.q-pdf-drop.dragover {
    border-color: var(--theme-color);
    background: rgba(var(--theme-rgb),.04);
}
.q-pdf-drop .q-pdf-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .75rem;
    font-size: 1.5rem;
}
.q-pdf-drop h6 {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: .25rem;
}
.q-pdf-drop p { font-size: .75rem; color: var(--text-muted); margin: 0; }

.q-items-table {
    border-radius: 0;
}
.q-items-table thead th {
    background: linear-gradient(135deg, var(--theme-color), var(--accent)) !important;
    color: #fff !important;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .625rem .75rem;
    border: none !important;
    white-space: nowrap;
}
.q-items-table tbody td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.q-items-table tbody tr { transition: var(--transition-fast); }
.q-items-table tbody tr:hover { background: rgba(var(--theme-rgb),.02); }

/* Card-based item rows for create/edit */
.q-item-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    margin-bottom: .75rem;
    transition: var(--transition);
    position: relative;
}
.q-item-card:hover {
    border-color: rgba(var(--theme-rgb),.2);
    box-shadow: var(--shadow-sm);
}
.q-item-card:last-child { margin-bottom: 0; }
.q-item-card .q-item-num {
    position: absolute;
    top: -.5rem;
    left: 1rem;
    background: linear-gradient(135deg, var(--theme-color), var(--accent));
    color: #fff;
    font-size: .625rem;
    font-weight: 800;
    padding: .15rem .5rem;
    border-radius: 4px;
    letter-spacing: .04em;
    line-height: 1.4;
}
.q-item-card .q-item-remove {
    position: absolute;
    top: .5rem;
    right: .5rem;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1.5px solid rgba(239,68,68,.2);
    background: transparent;
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: .7rem;
    padding: 0;
}
.q-item-card .q-item-remove:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    transform: scale(1.05);
}
.q-item-card .q-item-fields {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: .625rem;
}
.q-item-card .q-item-fields--bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .625rem;
    margin-top: .625rem;
}
.q-item-card .q-item-total-box {
    background: linear-gradient(135deg, rgba(var(--theme-rgb),.06), rgba(var(--accent-rgb),.04));
    border: 1.5px solid rgba(var(--theme-rgb),.12);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.q-item-card .q-item-total-label {
    font-size: .5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}
.q-item-card .q-item-total-value {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--theme-color);
    letter-spacing: -.01em;
    line-height: 1.3;
}
.q-item-field-group {
    display: flex;
    flex-direction: column;
}
.q-item-field-group label {
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: .25rem;
}
.q-item-field-group .form-control,
.q-item-field-group .form-select {
    border-radius: var(--radius-sm);
    font-size: .8125rem;
    padding: .4375rem .75rem;
}
.q-item-field-group textarea.form-control {
    font-size: .8125rem;
    line-height: 1.5;
}
.q-items-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: rgba(var(--theme-rgb),.02);
}
.q-items-summary .q-items-count {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.q-items-summary .q-items-subtotal {
    font-size: .9375rem;
    font-weight: 800;
    color: var(--theme-color);
}

@media (max-width: 767.98px) {
    .q-item-card .q-item-fields { grid-template-columns: 1fr; }
    .q-item-card .q-item-fields--bottom { grid-template-columns: 1fr 1fr; }
}

body.dark-mode .q-item-card { background: var(--card-bg); border-color: #334155; }
body.dark-mode .q-item-card:hover { border-color: rgba(var(--theme-rgb),.3); }
body.dark-mode .q-item-card .q-item-total-box { background: rgba(var(--theme-rgb),.08); border-color: rgba(var(--theme-rgb),.2); }

.q-totals-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: #fff;
}
.q-totals-card .q-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4375rem 0;
    font-size: .8125rem;
}
.q-totals-card .q-totals-row.q-grand {
    border-top: 1px solid rgba(255,255,255,.15);
    padding-top: .75rem;
    margin-top: .375rem;
    font-size: 1.125rem;
    font-weight: 800;
}
.q-totals-card .q-totals-row .q-totals-label { color: rgba(255,255,255,.7); }
.q-totals-card .q-totals-row .q-totals-value { font-weight: 700; }
.q-totals-card .q-totals-row.q-grand .q-totals-label { color: #fff; }
.q-totals-card .q-totals-row.q-grand .q-totals-value { color: #818cf8; }

.q-totals-card .q-words {
    margin-top: .75rem;
    padding-top: .625rem;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .6875rem;
    color: rgba(255,255,255,.5);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.q-totals-card .q-words strong {
    color: rgba(255,255,255,.85);
    display: block;
    margin-top: .25rem;
    font-size: .75rem;
}

.q-view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-color);
}
.q-view-header__num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.02em;
    line-height: 1.2;
}
.q-view-header__badge {
    font-size: .6875rem;
    font-weight: 700;
    padding: .375rem .875rem;
    border-radius: 20px;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.q-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.q-info-box {
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    padding: 1.125rem;
}
.q-info-box__title {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .375rem;
}
.q-info-box__title i { color: var(--theme-color); }
.q-info-box__name {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: .25rem;
}
.q-info-box__text {
    font-size: .8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.q-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}
.q-meta-item {
    background: var(--body-bg);
    border-radius: var(--radius-sm);
    padding: .75rem;
    text-align: center;
}
.q-meta-item__label {
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: .25rem;
}
.q-meta-item__value {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 767.98px) {
    .q-stats-row { grid-template-columns: repeat(2, 1fr); }
    .q-info-grid { grid-template-columns: 1fr; }
    .q-meta-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Product Picker Autocomplete */
.q-product-picker { position: relative; }
.q-product-picker .product-search {
    border: 2px dashed var(--border-color);
    background: var(--body-bg);
    transition: all .2s;
    padding-left: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.344.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: .75rem center;
    background-size: .875rem;
}
.q-product-picker .product-search:focus {
    border-style: solid;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb),.12);
}
.q-product-dropdown {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    z-index: 1050;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}
.q-product-dropdown.show { display: block; }
.q-product-dropdown__cat {
    padding: .5rem .875rem .25rem;
    font-size: .625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--theme-color);
    background: rgba(var(--theme-rgb),.04);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}
.q-product-dropdown__item {
    padding: .5rem .875rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(var(--theme-rgb),.04);
    transition: background .15s;
}
.q-product-dropdown__item:hover {
    background: rgba(var(--theme-rgb),.08);
}
.q-product-dropdown__name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.q-product-dropdown__name mark {
    background: rgba(var(--theme-rgb),.2);
    color: var(--theme-color);
    border-radius: 2px;
    padding: 0 1px;
}
.q-product-dropdown__meta {
    font-size: .6875rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    align-items: center;
}
.q-product-dropdown__sku {
    background: var(--body-bg);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'Fira Code', monospace;
    font-weight: 600;
    font-size: .625rem;
}
.q-product-dropdown__specs {
    opacity: .7;
    font-size: .625rem;
}
.q-product-dropdown__empty {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .8125rem;
}
.q-product-dropdown::-webkit-scrollbar { width: 5px; }
.q-product-dropdown::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

body.dark-mode .q-form-section__head { background: linear-gradient(135deg, rgba(var(--theme-rgb),.06), transparent); }
body.dark-mode .q-pdf-drop { background: rgba(var(--theme-rgb),.03); border-color: #334155; }
body.dark-mode .q-pdf-drop:hover { border-color: var(--theme-color); background: rgba(var(--theme-rgb),.06); }
body.dark-mode .q-info-box { background: #0f172a; }
body.dark-mode .q-meta-item { background: #0f172a; }
body.dark-mode .q-stat { background: var(--card-bg); }
body.dark-mode .q-empty-state .q-empty-icon { background: rgba(var(--theme-rgb),.15); }
body.dark-mode .q-product-dropdown { background: #1e293b; border-color: #334155; }
body.dark-mode .q-product-dropdown__cat { background: rgba(var(--theme-rgb),.08); }
body.dark-mode .q-product-dropdown__sku { background: #0f172a; }
