/* ============================================
   SELLERHYPE - GLOBAL STYLES (BINANCE UPGRADE)
   ============================================ */

/* ============================================
   Z-INDEX LAYERS (Standardized)
   ============================================
   Top Bar:           50
   Sidebar Overlay:   45
   Desktop Sidebar:   40
   Dropdowns:         30
   Modals:            1000
   Toast:             10001
   Loading Overlay:   10001
   Confirm Dialog:    10002
   ============================================ */

/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap');

/* ============================================
   ANTI-FOUC - CRITICAL FOR THEME STABILITY
   ============================================ */

/* Prevent FOUC - hide content until theme is applied */
html:not(.theme-ready) body {
    opacity: 0 !important;
}

html.theme-ready body {
    opacity: 1 !important;
    transition: opacity 0.15s ease-in;
}

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
}

/* Ensure smooth theme transitions */
* {
    transition: var(--theme-transition, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease);
}

/* ============================================
   THEME VARIABLES
   ============================================ */

:root {
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-gradient-end: #7c3aed;
    --success-color: #10b981;
    --success-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --warning-dark: #b45309;
    --info-color: #3b82f6;
    --whatsapp-color: #25D366;
}

/* Light Theme (Default) */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --bg-input: #ffffff;
    --bg-modal: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
    --active-bg: #8b5cf6;
    --active-text: #ffffff;
    --dropdown-bg: #ffffff;
    --dropdown-text: #1e293b;
    --dropdown-hover: #f1f5f9;
    --dropdown-border: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --logo-text: #0f172a;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-header: #1e293b;
    --bg-input: #0f172a;
    --bg-modal: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --hover-bg: #334155;
    --active-bg: #8b5cf6;
    --active-text: #ffffff;
    --dropdown-bg: #1e293b;
    --dropdown-text: #f1f5f9;
    --dropdown-hover: #334155;
    --dropdown-border: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --logo-text: #f1f5f9;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ============================================
   THEME TOGGLE BUTTON - FIXED
   ============================================ */

.theme-toggle-btn {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.theme-toggle-btn:hover {
    background: transparent !important;
    color: var(--accent-color);
}

.theme-toggle-btn:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* FIXED: Theme Toggle Icon Visibility - NO BLINK */
[data-theme="light"] .theme-toggle-icon.fa-moon,
[data-theme="light"] .theme-toggle-btn .fa-moon {
    display: inline-block !important;
}

[data-theme="light"] .theme-toggle-icon.fa-sun,
[data-theme="light"] .theme-toggle-btn .fa-sun {
    display: none !important;
}

[data-theme="dark"] .theme-toggle-icon.fa-moon,
[data-theme="dark"] .theme-toggle-btn .fa-moon {
    display: none !important;
}

[data-theme="dark"] .theme-toggle-icon.fa-sun,
[data-theme="dark"] .theme-toggle-btn .fa-sun {
    display: inline-block !important;
}

/* ============================================
   SIDEBAR SYSTEM - FIXED SCROLL
   ============================================ */

.desktop-sidebar {
    width: 16rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 40;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.desktop-sidebar .sidebar-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.desktop-sidebar .sidebar-logo i {
    font-size: 28px;
    color: var(--accent-color);
    margin-right: 10px;
}

.desktop-sidebar .sidebar-logo span {
    font-size: 20px;
    font-weight: 700;
    color: var(--logo-text);
}

.desktop-sidebar .sidebar-panel-label {
    flex-shrink: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 8px 16px 4px;
}

/* FIXED: Desktop sidebar scroll with max-height */
.desktop-sidebar .sidebar-nav {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding-bottom: 20px;
    max-height: calc(100vh - 130px);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.desktop-sidebar .sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.desktop-sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.desktop-sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.desktop-sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.main-content {
    margin-left: 16rem;
    width: calc(100% - 16rem);
    min-height: 100vh;
    transition: margin-left 0.3s ease, background-color 0.2s ease;
}

/* Collapsed sidebar */
html.sidebar-collapsed .desktop-sidebar {
    width: 4rem;
}

html.sidebar-collapsed .desktop-sidebar .nav-item span,
html.sidebar-collapsed .desktop-sidebar .sidebar-logo span,
html.sidebar-collapsed .desktop-sidebar .sidebar-panel-label,
html.sidebar-collapsed .desktop-sidebar .nav-submenu {
    display: none;
}

html.sidebar-collapsed .desktop-sidebar .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
}

html.sidebar-collapsed .desktop-sidebar .nav-item i {
    margin: 0;
    font-size: 1.25rem;
}

html.sidebar-collapsed .desktop-sidebar .sidebar-logo {
    justify-content: center;
}

html.sidebar-collapsed .desktop-sidebar .sidebar-logo i {
    margin-right: 0;
}

html.sidebar-collapsed .main-content {
    margin-left: 4rem;
    width: calc(100% - 4rem);
}

html.sidebar-collapsed .app-footer {
    margin-left: 4rem;
    width: calc(100% - 4rem);
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.2s;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.sidebar-toggle-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

@media (max-width: 767px) {
    .desktop-sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .app-footer {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ============================================
   NAVIGATION ITEMS
   ============================================ */

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 4px 12px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: transparent;
    color: var(--accent-color) !important;
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item .fa-chevron-down {
    transition: transform 0.2s ease;
    margin-left: auto;
}

/* ============================================
   SUB-MENU STYLES
   ============================================ */

.nav-parent {
    position: relative;
}

.nav-submenu {
    margin-left: 1rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.nav-submenu.hidden {
    display: none;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    margin: 2px 0;
    margin-left: 0.5rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.nav-subitem:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-subitem.active {
    background: transparent;
    color: var(--accent-color) !important;
    font-weight: 600;
}

.nav-subitem i {
    width: 20px;
    font-size: 0.75rem;
    text-align: center;
}

/* ============================================
   MOBILE SIDEBAR - FIXED SCROLL
   ============================================ */

#mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

/* FIXED: Mobile sidebar header stays fixed at top */
#mobile-sidebar .mobile-sidebar-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 2;
}

#mobile-sidebar .mobile-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

#mobile-sidebar .mobile-sidebar-logo i {
    font-size: 28px;
    color: var(--accent-color);
}

#mobile-sidebar .mobile-sidebar-logo span {
    font-size: 20px;
    font-weight: 700;
    color: var(--logo-text);
}

#mobile-sidebar .mobile-sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0 8px;
    min-height: 44px;
    min-width: 44px;
}

#mobile-sidebar .mobile-sidebar-close:hover {
    color: var(--text-primary);
}

/* FIXED: Mobile sidebar content scrolls with max-height */
#mobile-sidebar .mobile-sidebar-content {
    flex: 1;
    overflow-y: auto !important;
    padding: 0 8px 20px;
    max-height: calc(100vh - 70px);
    -webkit-overflow-scrolling: touch;
}

#mobile-sidebar.show {
    transform: translateX(0);
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    cursor: pointer;
    display: none;
}

#sidebar-overlay.show {
    display: block;
}

/* ============================================
   TOP BAR / HEADER
   ============================================ */

.top-bar {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    padding: 16px 24px;
}

.top-bar .fa-user-circle {
    font-size: 28px;
    color: var(--text-primary);
    background: transparent !important;
}

.top-bar button {
    background: transparent !important;
}

.top-bar button:hover {
    background: transparent !important;
    color: var(--accent-color);
}

/* ============================================
   APP FOOTER
   ============================================ */

.app-footer {
    margin-left: 16rem;
    width: calc(100% - 16rem);
    padding: 20px 24px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.footer-content {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.footer-content p {
    margin: 0;
}

/* ============================================
   SCROLLBARS
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.dropdown-menu, 
#user-dropdown,
.user-dropdown {
    background-color: var(--dropdown-bg) !important;
    border: 1px solid var(--dropdown-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px var(--shadow-color) !important;
}

.dropdown-menu a, 
#user-dropdown a,
.user-dropdown a,
.dropdown-menu button, 
#user-dropdown button,
.user-dropdown button {
    color: var(--dropdown-text) !important;
    background: transparent !important;
}

.dropdown-menu a:hover, 
#user-dropdown a:hover,
.user-dropdown a:hover,
.dropdown-menu button:hover, 
#user-dropdown button:hover,
.user-dropdown button:hover {
    background-color: var(--dropdown-hover) !important;
}

/* ============================================
   VERIFICATION STATUS BADGES
   ============================================ */

.verification-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.verification-verified { background: #10b98120; color: #10b981; }
.verification-pending { background: #f59e0b20; color: #b45309; }
.verification-rejected { background: #ef444420; color: #dc2626; }
.verification-not-started { background: #6b728020; color: #6b7280; }

/* ============================================
   VERIFICATION ICONS
   ============================================ */

.verification-icon {
    color: var(--text-muted);
    font-size: 12px;
    transition: color 0.2s;
}

.verification-icon.verified { color: #10b981 !important; }
.verification-icon.pending { color: #b45309 !important; }
.verification-icon.rejected { color: #dc2626 !important; }

/* ============================================
   THREE-DOT MENU
   ============================================ */

.three-dot-menu { position: relative; }

.menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 18px;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 30;
    min-width: 48px;
    display: none;
    overflow: hidden;
}

.menu-dropdown.show { display: block; }

.menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    color: var(--text-primary);
    font-size: 16px;
    min-height: 44px;
}

.menu-item:hover { background: var(--hover-bg); }
.menu-item.text-red-500 { color: #ef4444; }
.menu-item.text-green-500 { color: #10b981; }
.menu-item.text-blue-500 { color: #3b82f6; }
.menu-item.text-yellow-500 { color: #f59e0b; }
.menu-item.text-purple-500 { color: #8b5cf6; }

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-pending { background: #f59e0b20; color: #b45309; }
.status-approved, .status-active, .status-verified { background: #10b98120; color: #059669; }
.status-completed, .status-paid { background: #10b98120; color: #059669; }
.status-cancelled, .status-suspended, .status-rejected, .status-expired { background: #ef444420; color: #dc2626; }
.status-in-progress, .status-dispatched { background: #3b82f620; color: #2563eb; }
.status-ready { background: #3b82f620; color: #2563eb; }
.status-postponed { background: #f59e0b20; color: #b45309; }
.status-active-custom { background: rgba(16, 185, 129, 0.13); color: var(--success-dark, #059669); }
.status-inactive-custom { background: rgba(107, 114, 128, 0.13); color: #6b7280; }

/* Priority Badges */
.priority-urgent { background: #ef4444; color: white; padding: 2px 8px; border-radius: 20px; font-size: 10px; }
.priority-high { background: #f59e0b; color: white; padding: 2px 8px; border-radius: 20px; font-size: 10px; }
.priority-normal { background: #3b82f6; color: white; padding: 2px 8px; border-radius: 20px; font-size: 10px; }
.priority-low { background: #6b7280; color: white; padding: 2px 8px; border-radius: 20px; font-size: 10px; }

/* ============================================
   PAYMENT STATUS BADGES
   ============================================ */

.payment-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.payment-paid { background: #10b98120; color: #059669; }
.payment-pending { background: #f59e0b20; color: #b45309; }
.payment-overdue { background: #ef444420; color: #dc2626; }

.pending-badge {
    background: #f59e0b20;
    color: #b45309;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   BUTTONS - BINANCE STYLE
   ============================================ */

.btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color, #8b5cf6), var(--accent-hover, #7c3aed));
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary, #334155);
    color: var(--text-primary, white);
    border: 1px solid var(--border-color, #334155);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color, #ef4444), var(--danger-dark, #dc2626));
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color, #10b981), var(--success-dark, #059669));
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color, #f59e0b), #d97706);
    color: white;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

.btn-whatsapp {
    background: linear-gradient(135deg, var(--whatsapp-color, #25D366), #128C7E);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
}

/* Small Button Variants */
.btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-sm:hover { background: var(--hover-bg); }
.btn-sm-success { background: #10b981; color: white; border: none; }
.btn-sm-success:hover { background: #059669; }
.btn-sm-warning { background: #f59e0b; color: white; border: none; }
.btn-sm-warning:hover { background: #d97706; }
.btn-sm-danger { background: #ef4444; color: white; border: none; }
.btn-sm-danger:hover { background: #dc2626; }

/* ============================================
   FORM INPUTS
   ============================================ */

input, select, textarea, .form-input, .form-select {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

input::placeholder, textarea::placeholder { color: var(--text-muted) !important; }

input:focus, select:focus, textarea:focus, .form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   LABEL COLOR FIXES
   ============================================ */

[data-theme="light"] .form-label,
[data-theme="light"] .info-label,
[data-theme="light"] .summary-label,
[data-theme="light"] .text-gray-500,
[data-theme="light"] p.text-xs { color: #0f172a !important; }

[data-theme="dark"] .form-label,
[data-theme="dark"] .info-label,
[data-theme="dark"] .summary-label,
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] p.text-xs { color: #cbd5e1 !important; }

/* ============================================
   TABLES
   ============================================ */

table { width: 100%; border-collapse: collapse; }

th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    font-weight: 600;
}

td {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
}

tr:hover td { background-color: var(--hover-bg); }

/* ============================================
   CARDS - BINANCE 3D STYLE
   ============================================ */

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, var(--accent-color), transparent 70%);
    opacity: 0;
    border-radius: 50%;
    transform: translate(30%, -30%);
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.2);
}

.stat-card:hover::before {
    opacity: 0.08;
}

.card, .section-card, .info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 1rem;
    padding: 1rem;
    transition: box-shadow 0.3s ease;
}

.card:hover, .section-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.supplier-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
}

.supplier-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

/* ============================================
   SUPPLIER STATS
   ============================================ */

.supplier-stat-value { font-weight: 700; font-size: 16px; color: var(--text-primary); }
.supplier-stat-value.pending { color: var(--warning-dark, #b45309); }
.supplier-stat-value.paid { color: var(--success-dark, #059669); }
.supplier-stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* ============================================
   LEDGER & PROFIT
   ============================================ */

.ledger-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.ledger-stat { background: var(--bg-tertiary); border-radius: 12px; padding: 14px; text-align: center; }
.ledger-stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.ledger-stat-value.pending { color: var(--warning-dark, #b45309); }
.ledger-stat-value.paid { color: var(--success-dark, #059669); }
.ledger-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 4px; }

.profit-summary { background: rgba(16, 185, 129, 0.1); border-radius: 10px; padding: 12px; margin-top: 12px; }
.profit-row { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-primary); }
.profit-total { font-weight: 700; font-size: 16px; color: #059669; border-top: 1px solid var(--border-color); margin-top: 6px; padding-top: 10px; }

/* ============================================
   PAGINATION
   ============================================ */

.pagination-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 44px;
}

.pagination-btn:hover, .pagination-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* ============================================
   TOAST - BINANCE STYLE (injected by utils.js)
   ============================================ */

/* Toast styles are dynamically injected by utils.js showToast() */

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden { display: none; }
.text-purple-500 { color: #8b5cf6; }
.text-red-500 { color: #ef4444; }
.text-green-500 { color: #10b981; }
.text-yellow-500 { color: #f59e0b; }
.text-blue-500 { color: #3b82f6; }
.bg-purple-500 { background-color: #8b5cf6; }
.border-purple-500 { border-color: #8b5cf6; }

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

/* ============================================
   FILTER CHIPS
   ============================================ */

.filter-chip {
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover, #7c3aed));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.filter-chip:hover:not(.active) {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

/* ============================================
   MODAL
   ============================================ */

.modal, .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content, .modal-container {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* ============================================
   BACKGROUND UTILITIES
   ============================================ */

.bg-card { background-color: var(--bg-card); }
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.bg-input { background-color: var(--bg-input); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.border-color { border-color: var(--border-color); }
.hover-bg:hover { background-color: var(--hover-bg); }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 56px; color: var(--text-muted); margin-bottom: 16px; opacity: 0.5; }

/* ============================================
   VIEW TOGGLE
   ============================================ */

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.view-toggle-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    min-height: 44px;
}

.view-toggle-btn.active {
    background: var(--accent-color);
    color: white;
}

.view-toggle-btn:hover:not(.active) {
    background: var(--hover-bg);
}

/* ============================================
   SEARCH INPUT
   ============================================ */

.search-input-wrapper { position: relative; flex: 1; min-width: 200px; }
.search-input-wrapper i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input-wrapper input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
}

/* ============================================
   MOBILE RESPONSIVE FIXES
   ============================================ */

@media (max-width: 768px) {
    .ledger-summary { grid-template-columns: 1fr; }
    .menu-dropdown { right: auto; left: 0; }
    .app-footer { padding: 16px; }
    
    /* FIXED: Minimum touch targets for mobile (Apple HIG) */
    .btn, button, .nav-item, .filter-chip, .pagination-btn,
    .view-toggle-btn, .menu-item, .action-btn {
        min-height: 44px;
    }
    
    /* FIXED: Prevent iOS auto-zoom on input focus */
    input, select, textarea, .form-input, .form-select, .form-textarea {
        font-size: 16px !important;
    }
    
    /* Improve scrollable areas on mobile */
    .table-container, .orders-table-container, .preview-table-wrapper {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
}

   /* ============================================
   NOTIFICATION BELL DROPDOWN (FACEBOOK-STYLE) - COMPACT
   ============================================ */

/* Bell Button */
.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.notification-bell-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.notification-bell-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.notification-bell-btn .badge.hidden {
    display: none;
}

/* Dropdown Panel */
.notification-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.3);
    z-index: 55;
    overflow: hidden;
    animation: notifSlideDown 0.2s ease;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

@keyframes notifSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dropdown Header */
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.notif-dropdown-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-dropdown-header h3 .unread-count {
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 600;
}

.notif-dropdown-header .mark-all-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.notif-dropdown-header .mark-all-btn:hover {
    background: var(--hover-bg);
}

/* Notification List */
.notif-dropdown-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 2px;
}

.notif-dropdown-list::-webkit-scrollbar {
    width: 4px;
}

.notif-dropdown-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Notification Item */
.notif-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
    margin-bottom: 1px;
}

.notif-dropdown-item:hover {
    background: var(--hover-bg);
}

.notif-dropdown-item.unread {
    background: rgba(139, 92, 246, 0.04);
    border-left: 2px solid var(--accent-color);
}

.notif-dropdown-item.unread:hover {
    background: rgba(139, 92, 246, 0.08);
}

.notif-dropdown-item .notif-icon-small {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.notif-dropdown-item .notif-icon-small.order { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.notif-dropdown-item .notif-icon-small.payout { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.notif-dropdown-item .notif-icon-small.commission { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.notif-dropdown-item .notif-icon-small.system { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.notif-dropdown-item .notif-icon-small.rank { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.notif-dropdown-item .notif-icon-small.referral { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.notif-dropdown-item .notif-icon-small.bank { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.notif-dropdown-item .notif-content {
    flex: 1;
    min-width: 0;
}

.notif-dropdown-item .notif-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
    line-height: 1.3;
}

.notif-dropdown-item .notif-message {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-dropdown-item .notif-time {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-dropdown-item .unread-dot-small {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-color);
    flex-shrink: 0;
    margin-top: 4px;
}

/* Dropdown Footer */
.notif-dropdown-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notif-dropdown-footer a {
    color: var(--accent-color);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.notif-dropdown-footer a:hover {
    background: var(--hover-bg);
}

/* Empty State */
.notif-dropdown-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
}

.notif-dropdown-empty i {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.5;
    display: block;
}

.notif-dropdown-empty p {
    font-size: 12px;
    margin: 0;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .notification-bell-btn {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
    
    .notification-dropdown {
        position: fixed;
        top: 56px;
        left: 50px;
        right: 50px;
        width: auto;
        max-width: none;
        max-height: 60vh;
        border-radius: 14px;
    }
    
    .notif-dropdown-list {
        max-height: calc(60vh - 100px);
    }
}
