/* ====== LOCAL FONTS - Offline Support ====== */
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/Tajawal-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/Tajawal-Medium.ttf') format('truetype');
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/Tajawal-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/Tajawal-ExtraBold.ttf') format('truetype');
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('/fonts/Tajawal-ExtraBold.ttf') format('truetype');
}
/* ====== END LOCAL FONTS ====== */

:root {
    --primary: #6366f1; /* Premium Indigo */
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%); /* Indigo to Pink */
    
    --secondary: #0ea5e9;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #f43f5e; /* Rose */
    --danger-light: rgba(244, 63, 94, 0.15);
    
    --bg-color: #ffffff; /* White background */
    --text-heading: #000000; /* Black */
    --text-main: #000000; /* Black */
    --text-muted: #333333; /* Dark Gray */
    --text-color: #000000; /* Black */
    --border-color: rgba(0, 0, 0, 0.2); 
    
    --glass-bg: #ffffff; /* Solid White */
    --glass-border: rgba(0, 0, 0, 0.15); 
    --glass-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Animation */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite alternate;
}

.bg-shape-1 {
    width: 600px;
    height: 600px;
    background: rgba(99, 102, 241, 0.12); /* Indigo aurora */
    top: -150px;
    right: -150px;
    filter: blur(100px);
}

.bg-shape-2 {
    width: 700px;
    height: 700px;
    background: rgba(236, 72, 153, 0.1); /* Pink aurora */
    bottom: -200px;
    left: -150px;
    animation-delay: -5s;
    filter: blur(120px);
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Glassmorphism Utilities */
.glass-container, .glass-panel, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-card {
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 15px 45px 0 rgba(99, 102, 241, 0.2), 0 0 15px rgba(99, 102, 241, 0.1) inset;
    border-color: rgba(99, 102, 241, 0.3);
}

/* Typography & Colors */
.text-gradient {
    color: #000000;
}
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.bg-primary-light { background: var(--primary-light); }
.bg-success-light { background: var(--success-light); }
.bg-warning-light { background: var(--warning-light); }
.bg-danger-light { background: var(--danger-light); }

/* Layout State Management */
.active-section { display: flex !important; }
.hidden-section { display: none !important; }

/* Login Section */
#login-section {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo-area { margin-bottom: 30px; }
.logo-area i { font-size: 3.5rem; margin-bottom: 15px; color: var(--primary); text-shadow: 0 0 20px var(--primary-light); }
.logo-area h2 { font-weight: 800; font-size: 2.2rem; color: var(--text-heading); letter-spacing: -0.5px; }
.logo-area p { color: var(--text-muted); font-size: 1.1rem; }

.input-group {
    position: relative;
    margin-bottom: 20px;
}
.input-group i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-group input {
    width: 100%;
    padding: 16px 45px 16px 20px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: #ffffff;
    color: #000000;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.input-group input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 2px 4px rgba(0,0,0,0.05);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: none;
    background: var(--primary-gradient);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    width: auto;
}

.error-msg {
    color: var(--danger);
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-radius: 0 24px 24px 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.sidebar-header i { font-size: 2.2rem; color: #000000; }
.sidebar-header h2 { font-weight: 800; color: var(--text-heading); font-size: 1.6rem; letter-spacing: -0.5px; }

.user-info {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.user-details h3 { font-size: 1.1rem; margin-bottom: 2px; }
.user-role { font-size: 0.85rem; color: var(--text-muted); }

.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 5px;
    transition: var(--transition);
    font-weight: 500;
}
.nav-item i { width: 20px; text-align: center; font-size: 1.1rem; }
.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-heading);
    transform: translateX(-5px);
}
.nav-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    font-weight: 700;
}

.logout-btn {
    margin: 20px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--danger);
    background: transparent;
    color: var(--danger);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.top-header {
    border-radius: 16px;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.header-title h1 { font-size: 1.8rem; font-weight: 800; color: var(--text-heading); letter-spacing: -0.5px; }

.header-actions {
    display: flex;
    gap: 15px;
}
.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-heading); transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Views Container */
.views-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}
.views-container::-webkit-scrollbar { width: 6px; }
.views-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }

.view-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.view-panel.active-view { display: block; }

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

@keyframes ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(15deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.ring-anim {
    display: inline-block;
    animation: ring 2s infinite;
    transform-origin: top center;
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.stat-info h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-heading); text-shadow: 0 2px 10px rgba(0,0,0,0.2); }

/* Utilities */
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; flex-direction: column; }
.full-height { min-height: 400px; height: 100%; }
.text-center { text-align: center; }

/* Tables */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}
.modern-table th {
    padding: 18px 15px;
    text-align: right;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--glass-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modern-table td {
    padding: 16px 15px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    color: var(--text-main);
}
.modern-table tr td:first-child { border-radius: 0 12px 12px 0; }
.modern-table tr td:last-child { border-radius: 12px 0 0 12px; }
.modern-table tr:hover td { background: rgba(0, 0, 0, 0.06); color: var(--text-heading); transform: scale(1.01); }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; }
    .sidebar { width: 100%; border-radius: 0 0 24px 24px; padding: 10px; }
    .sidebar-nav { display: flex; overflow-x: auto; padding: 10px 0; }
    .nav-item { margin: 0 5px; white-space: nowrap; }
    .top-header { flex-direction: column; gap: 15px; text-align: center; }
}

/* Print Styles for Barcodes */
#print-area { display: none; }

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
    }
    
    @page { margin: 0; }
    .thermal-receipt, .repair-print-container {
        width: 100%;
        max-width: 80mm !important; /* Default to 80mm */
        margin: 0 auto !important;
        padding: 5px !important;
        box-sizing: border-box;
    }
    .thermal-receipt *, .repair-print-container * {
        font-size: 13px; /* Ensure readability */
    }
    .thermal-receipt h2, .repair-print-container h2 { font-size: 1.2rem; }
    .thermal-receipt .total-row, .repair-print-container .total-row { border-top: 2px solid #000; font-weight: bold; }
    
    #print-area:not(.layout-thermal):not(.layout-a4-3x8):not(.layout-a4-4x10) {
        display: flex; 
        flex-wrap: wrap; 
        gap: 10px; 
    }
    #print-area.layout-thermal {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
    }
    #print-area.layout-a4-3x8 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        padding: 10mm;
        box-sizing: border-box;
        width: 210mm;
    }
    #print-area.layout-a4-4x10 {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        padding: 10mm;
        box-sizing: border-box;
        width: 210mm;
    }
    
    .barcode-label {
        width: 5cm;
        height: 3cm;
        border: 1px dashed #ccc;
        padding: 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        page-break-inside: avoid;
        text-align: center;
        box-sizing: border-box;
        font-family: Arial, sans-serif;
        background: white;
    }
    .barcode-label.label-5x3 { width: 5cm; height: 3cm; }
    .barcode-label.label-4x2.5 { width: 4cm; height: 2.5cm; }
    .barcode-label.label-3.5x2 { width: 3.5cm; height: 2cm; }
    
    #print-area.layout-thermal .barcode-label {
        page-break-after: always;
        border: none;
    }
    
    .bl-shop { font-size: 11px; font-weight: bold; }
    .bl-name { font-size: 10px; margin-bottom: 2px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bl-price { font-size: 12px; font-weight: bold; margin-top: 2px; }
    .barcode-label svg { max-width: 100%; height: auto; }
    
    /* Thermal Receipt Styles */
    .thermal-receipt {
        width: 80mm;
        margin: 0 auto;
        padding: 5mm;
        font-family: 'Courier New', Courier, monospace;
        color: black;
        background: white;
        text-align: center;
        font-size: 12px;
    }
    .thermal-receipt h2 { font-size: 18px; margin-bottom: 5px; }
    .thermal-receipt p { margin: 3px 0; }
    .thermal-receipt .divider { border-top: 1px dashed black; margin: 10px 0; }
    .thermal-receipt table { width: 100%; border-collapse: collapse; text-align: right; }
    .thermal-receipt th, .thermal-receipt td { padding: 4px 0; border-bottom: 1px dashed #ccc; }
    .thermal-receipt .total-row { font-weight: bold; font-size: 14px; margin-top: 10px; }
    
    @page { margin: 0; }
}

/* Custom Styles for Supplier Debts, Badges, and Charts */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
}
.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.badge-danger {
    background-color: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
}
.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.active-row {
    background: rgba(99, 102, 241, 0.15) !important;
    border-left: 4px solid var(--primary);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.font-weight-bold {
    font-weight: bold;
}

.text-success { color: #10b981; }
.text-danger { color: #f43f5e; }
.text-warning { color: #f59e0b; }
.text-primary { color: var(--primary); }

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Explicit style overrides for drop downs to fix white-on-white text */
select {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid var(--glass-border) !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    outline: none !important;
    font-family: 'Tajawal', sans-serif !important;
    cursor: pointer;
}

select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Explicit input style rules to ensure typing visibility on all systems */
input, textarea {
    color: #000000 !important;
    background-color: #ffffff !important;
    border: 1px solid var(--glass-border) !important;
}

input::placeholder, textarea::placeholder {
    color: #555555 !important;
    opacity: 0.8 !important;
}

/* Chrome/Safari Autofill Styles Overrides to prevent light background with white text */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-text-fill-color: #000000 !important;
    -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Prevent pointer event intercepting on icons inside input groups */
.input-group i {
    pointer-events: none !important;
}

/* Date Pickers styling and behavior support */
input[type="date"] {
    cursor: pointer;
}

/* Professional Themes Definition */

/* Theme: Indigo Glass (Default) - using root styles */
body.theme-indigo {
    --primary: #6366f1;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --secondary: #0ea5e9;
    --bg-color: #ffffff;
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-heading: #000000;
    --text-main: #000000;
    --text-muted: #333333;
    --text-color: #000000; 
}

/* Theme: Midnight Blue */
body.theme-midnight {
    --primary: #2563eb;
    --primary-light: rgba(37, 99, 235, 0.15);
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --secondary: #06b6d4;
    --bg-color: #ffffff;
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-heading: #000000;
    --text-main: #000000;
    --text-muted: #333333;
    --text-color: #000000; 
}

/* Theme: Emerald Mint */
body.theme-emerald {
    --primary: #059669;
    --primary-light: rgba(5, 150, 105, 0.15);
    --primary-gradient: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    --secondary: #14b8a6;
    --bg-color: #ffffff;
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-heading: #000000;
    --text-main: #000000;
    --text-muted: #333333;
    --text-color: #000000; 
}

/* Theme: Warm Amber */
body.theme-amber {
    --primary: #d97706;
    --primary-light: rgba(217, 119, 6, 0.15);
    --primary-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
    --secondary: #f97316;
    --bg-color: #ffffff;
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-heading: #000000;
    --text-main: #000000;
    --text-muted: #333333;
    --text-color: #000000; 
}

/* Theme: Premium Rose */
body.theme-rose {
    --primary: #db2777;
    --primary-light: rgba(219, 39, 119, 0.15);
    --primary-gradient: linear-gradient(135deg, #db2777 0%, #c084fc 100%);
    --secondary: #a855f7;
    --bg-color: #ffffff;
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-heading: #000000;
    --text-main: #000000;
    --text-muted: #333333;
    --text-color: #000000; 
}

/* Theme active visual indicator inside dropdown */
.theme-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Custom Button Styles */
.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    cursor: pointer;
    transition: var(--transition);
}
.btn-danger:hover {
    background: #e11d48 !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.3);
}

/* ==========================================
   PREMIUM DARK MODE & VISUAL UPGRADES
   ========================================== */

/* Dark Mode Variables - Specificity Hack to override theme styles */
body.dark-mode {
    --bg-color: #080c14 !important;
    --text-heading: #f8fafc !important;
    --text-main: #f1f5f9 !important;
    --text-muted: #94a3b8 !important;
    --text-color: #f1f5f9 !important;
    --border-color: rgba(255, 255, 255, 0.08) !important;
    --glass-bg: rgba(13, 20, 38, 0.45) !important;
    --glass-border: rgba(255, 255, 255, 0.08) !important;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4) !important;
}

/* Scrollbar customizations in dark mode */
body.dark-mode::-webkit-scrollbar {
    width: 8px;
    background-color: #080c14;
}
body.dark-mode::-webkit-scrollbar-thumb {
    background-color: #1e293b;
    border-radius: 4px;
    border: 2px solid #080c14;
}
body.dark-mode .sidebar-nav::-webkit-scrollbar,
body.dark-mode .views-container::-webkit-scrollbar {
    width: 5px;
}
body.dark-mode .sidebar-nav::-webkit-scrollbar-thumb,
body.dark-mode .views-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Aurora background subtle adjustments */
body.dark-mode .bg-shape-1 {
    background: rgba(99, 102, 241, 0.06) !important;
}
body.dark-mode .bg-shape-2 {
    background: rgba(236, 72, 153, 0.04) !important;
}

/* Sidebar navigation item overrides in dark mode */
body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #ffffff !important;
}
body.dark-mode .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
body.dark-mode .user-info {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Table overrides in dark mode */
body.dark-mode .modern-table th {
    color: #94a3b8 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode .modern-table td {
    background: rgba(255, 255, 255, 0.015) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}
body.dark-mode .modern-table tr:hover td {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

/* Inputs, Textareas, and Dropdowns in dark mode */
body.dark-mode input, 
body.dark-mode textarea,
body.dark-mode select {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
body.dark-mode select option {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}
body.dark-mode input::placeholder, 
body.dark-mode textarea::placeholder {
    color: #64748b !important;
}
body.dark-mode input:-webkit-autofill,
body.dark-mode input:-webkit-autofill:hover, 
body.dark-mode input:-webkit-autofill:focus, 
body.dark-mode input:-webkit-autofill:active {
    -webkit-text-fill-color: #f1f5f9 !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
}

/* Focus and hover enhancements on input fields */
input:focus, textarea:focus, select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

/* Premium modal visual enhancements */
.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}
.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Staggered card transition delay and animations */
.stats-grid .glass-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}
.stats-grid .glass-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}
body.dark-mode .stats-grid .glass-card:hover {
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
}

/* Barcode print buttons in tables style corrections */
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
}
body.dark-mode .icon-btn {
    background: rgba(255, 255, 255, 0.02);
}
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1);
}

/* ==========================================
   PREMIUM UI UPGRADES v2.5
   ========================================== */

/* Global smooth theme transition */
body {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s ease !important;
}

/* Dark mode background deep color */
body.dark-mode {
    background-color: #080c14 !important;
    color: #f1f5f9 !important;
}

/* Smooth sidebar background transition */
body.dark-mode .sidebar {
    background: rgba(8, 12, 20, 0.85) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Active nav item animated left border indicator */
.nav-item {
    position: relative;
    overflow: hidden;
}
.nav-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 60%;
    background: var(--primary-gradient);
    border-radius: 4px 0 0 4px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

/* Nav item hover glow effect */
.nav-item:hover {
    background: rgba(255,255,255,0.05) !important;
    color: var(--text-heading) !important;
    transform: translateX(-4px) !important;
}
body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Top header enhanced dark mode */
body.dark-mode .top-header {
    background: rgba(8, 12, 20, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Dark mode toggle button premium style */
#dark-mode-toggle {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
#dark-mode-toggle:hover {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-3px) rotate(15deg) !important;
}

/* View panels staggered fade-in animation */
.view-panel.active-view {
    animation: slideInUp 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Stats cards stagger fade-in */
.stats-grid .glass-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .glass-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .glass-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .glass-card:nth-child(4) { animation-delay: 0.2s; }

/* Dark mode glass card upgrade */
body.dark-mode .glass-card {
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode .glass-panel {
    background: rgba(8, 12, 20, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Modal slide-in effect dark mode */
body.dark-mode .modal-content {
    background: rgba(12, 18, 35, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6) !important;
}

/* Enhanced input focus ring in dark mode */
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
    outline: none !important;
}

/* Table row hover dark mode refined */
body.dark-mode .modern-table tr:hover td {
    background: rgba(99, 102, 241, 0.06) !important;
    color: #f8fafc !important;
}

/* Premium scrollbar for views-container */
.views-container::-webkit-scrollbar {
    width: 5px;
}
.views-container::-webkit-scrollbar-track {
    background: transparent;
}
.views-container::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}
.views-container::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* Dark mode improved badge colors */
body.dark-mode .badge-success {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}
body.dark-mode .badge-danger {
    background-color: rgba(244, 63, 94, 0.2) !important;
    color: #fb7185 !important;
}
body.dark-mode .badge-warning {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
}

/* Logout button dark mode override */
body.dark-mode .logout-btn {
    border-color: rgba(244, 63, 94, 0.5) !important;
    color: #fb7185 !important;
}
body.dark-mode .logout-btn:hover {
    background: rgba(244, 63, 94, 0.15) !important;
}

/* Sidebar shop name dark mode text */
body.dark-mode .sidebar-header h2,
body.dark-mode .user-details h3 {
    color: #f8fafc !important;
}
body.dark-mode .user-role {
    color: #94a3b8 !important;
}

/* Stat value contrast boost in dark mode */
body.dark-mode .stat-value {
    color: #f8fafc !important;
    text-shadow: 0 2px 15px rgba(99, 102, 241, 0.4) !important;
}
body.dark-mode .stat-info h3 {
    color: #94a3b8 !important;
}


/* ====== MOBILE RESPONSIVENESS (PWA) ====== */
@media (max-width: 768px) {
    #mobile-menu-container { display: inline-block !important; }
    
    /* RTL Sidebar Fix */
    .sidebar {
        position: fixed;
        right: -320px;
        left: auto;
        top: 0;
        height: 100vh;
        width: 280px;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 9999;
        transition: right 0.3s ease;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.sidebar-open {
        right: 0;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    #header-datetime-badge { display: none !important; }
    #license-header-info { flex-direction: column; align-items: flex-start; gap: 5px; }
    
    /* Force ALL inline grids (like .dashboard-grid) to stack vertically */
    div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .pos-container {
        flex-direction: column;
        height: auto;
    }
    
    .pos-cart {
        order: -1;
        max-height: 400px;
        margin-bottom: 20px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    }
    
    /* Make tables horizontally scrollable */
    .glass-card {
        overflow-x: auto;
    }
    
    table.modern-table {
        min-width: 700px;
    }
    
    /* Modals Fix */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        padding: 15px !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
    }
    
    .input-group input, .form-group input, .form-group select {
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
}
