:root {
    --primary: #6d28d9;
    --primary-dark: #5b21b6;
    --primary-light: #8b5cf6;
    --secondary: #10b981;
    --secondary-dark: #0da271;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --dark-border: #334155;
    --dark-text: #f1f5f9;
    --dark-text-light: #cbd5e1;
    --dark-text-lighter: #94a3b8;
    --light-bg: #e5e7eb;
    --light-card: #ffffff;
    --light-border: #d1d5db;
    --light-text: #111827;
    --light-text-light: #1f2937;
    --light-text-lighter: #4b5563;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark-bg);
    color: var(--dark-text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 70px;
}

.container { width: 100%; margin: 0 auto; padding: 0 20px; }

/* ========== HEADER (شريط علوي بعرض كامل) ========== */
header {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    position: fixed; top: 0; left: 0;
    z-index: 1001;
    border-bottom: 1px solid rgba(109, 40, 217, 0.3);
    height: 70px; display: flex; align-items: center;
}
.navbar { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 100%; }
.logo { display: flex; align-items: center; font-size: 24px; font-weight: 700; color: var(--dark-text); text-decoration: none; transition: all 0.3s; }
.logo:hover { transform: translateY(-2px); }
.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-right: 12px; color: white; font-size: 20px; transition: all 0.3s;
}
.logo:hover .logo-icon { transform: rotate(-5deg); }

/* ========== content-area ========== */
.content-area {
    display: flex;
    flex: 1 0 auto;
    position: relative;
    align-items: flex-start; 
}
/* ========== SIDEBAR NAVIGATION ========== */
.sidebar {
    display: none;
    width: 250px;
    flex-shrink: 0;
    background: var(--dark-card);
    overflow-y: auto;
    padding: 20px 0;
    flex-direction: column;
    gap: 5px;
    border-right: 1px solid var(--dark-border);
    transition: width 0.3s ease, padding 0.3s ease;

    position: sticky;
    top: 70px;
    height: fit-content;
    max-height: calc(100vh - 70px);
}
.sidebar-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    color: var(--dark-text-light); text-decoration: none; transition: 0.2s;
}
.sidebar-item:hover, .sidebar-item.active { background: var(--primary); color: white; }

body.logged-in .sidebar {
    display: flex;
}


/* ========== MAIN CONTENT AREA ========== */
.main-content {
    flex: 1;                      /* يملأ كل المساحة المتبقية */
    padding: 30px 20px;
    overflow-y: auto;             /* تمرير المحتوى لوحده */
    transition: none;             /* JavaScript سيتولى التأثيرات */
}


/* ========== PAGES ========== */
.page { display: none; }
.page.active { display: block; }

/* ========== HAMBURGER BUTTON ========== */
/* Hamburger Button – لون وتأثير (ظاهر دائمًا) */
.hamburger {
    display: none; flex-direction: column; justify-content: center; gap: 6px;
    width: 30px; height: 30px; background: none; border: none; cursor: pointer; z-index: 1100;
}
.hamburger span { display: block; width: 100%; height: 3px; background: var(--dark-text); border-radius: 5px; transition: 0.3s; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

body.logged-in .hamburger {
    display: flex;
}

/* لما الـ Sidebar يُقفل (نضيف كلاس collapsed) */
.sidebar.collapsed {
    width: 0 !important;
    padding: 0 !important;
    border: none;
    overflow: hidden;
}

/* ========== LANGUAGE & THEME TOGGLES ========== */
.language-toggle, .theme-toggle {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    padding: 8px 15px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    white-space: nowrap;
}

.language-toggle:hover, .theme-toggle:hover {
    background: rgba(109, 40, 217, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.language-toggle i, .theme-toggle i {
    font-size: 16px;
}

/* في حالة الثيم الفاتح */
body.light-theme .language-toggle,
body.light-theme .theme-toggle {
    background: #f3f4f6;
    color: #111827;
    border-color: var(--light-border);
}

body.light-theme .language-toggle:hover,
body.light-theme .theme-toggle:hover {
    background: rgba(109, 40, 217, 0.1);
    border-color: var(--primary);
}


/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .content-area {
        position: relative;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .sidebar {
        position: fixed;
        top: 70px;          /* تحت الهيدر */
        left: 0;
        bottom: 0;
        width: 250px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        /* نلغي الخصائص التي تؤثر على التدفق */
        height: auto;
        padding: 20px 0;
        flex-direction: column;
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        /* نخفيها بنفس طريقة الإخفاء */
        transform: translateX(-100%);
        /* لا نغير العرض لأنه fixed */
    }
    .hamburger {
        display: none;
    }
    body.logged-in .hamburger {
        display: flex;
    }

    div:has(> table.sticky-header) {
        overflow-y: auto;
        scroll-padding-top: 80px;   /* ارتفاع الرأسين المثبّتين */
        max-height: 70vh;           /* حد أقصى اختياري للارتفاع (حسب رغبتك) */
    }
    
    /* تحسينات عامة للموبايل */
    .quick-links-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-container { grid-template-columns: 1fr; }
    .hero-btns { flex-direction: column; align-items: center; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .dashboard-header h2 { font-size: 1.5rem; }
    .section-title h2 { font-size: 1.8rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .features-grid, .quick-links-grid { grid-template-columns: 1fr; }
    .dashboard-content { grid-template-columns: 1fr !important; }
    .report-grid { grid-template-columns: 1fr !important; }
    .settings-container { grid-template-columns: 1fr; }
    .modal-content { width: 95%; margin: 10px; padding: 20px; }
    .chatbot-box { width: 280px; height: 400px; right: 10px; }
    .chatbot-toggle { width: 50px; height: 50px; font-size: 20px; }
    .hero { padding: 120px 0 40px; }
    .hero-btns { flex-direction: column; align-items: center; }
    footer .container > div:first-child { grid-template-columns: 1fr; text-align: center; }
    .social-icons { justify-content: center; }
    .inventory-table { min-width: auto; }
    .card:has(.inventory-table) { overflow-x: visible; }
}

@media (max-width: 480px) {
    div:has(> table.sticky-header) {
        overflow-y: auto;
        scroll-padding-top: 80px;   /* ارتفاع الرأسين المثبّتين */
        max-height: 70vh;           /* حد أقصى اختياري للارتفاع (حسب رغبتك) */
    }
    .container { padding: 0 15px; }
    .stat-card .value { font-size: 1.5rem; }
    .btn { padding: 6px 12px; font-size: 12px; }
    .chatbot-box { width: 260px; height: 350px; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .dashboard-header .btn { width: 100%; text-align: center; }
    .auth-box { padding: 25px; }
    .feature-card { padding: 20px; }
}

/* ========== BUTTONS ========== */
.btn {
    padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; border: none;
    font-family: 'Inter', sans-serif; transition: all 0.3s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(109, 40, 217, 0.3); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(109, 40, 217, 0.2); }
.btn-success { background-color: var(--secondary); color: white; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3); }
.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3); }
.btn-warning { background-color: var(--warning); color: white; }
.btn-warning:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(245, 158, 11, 0.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ========== CARDS ========== */
.card {
    background-color: var(--dark-card); border-radius: 12px; padding: 25px; margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); transition: transform 0.3s;
}
.card:hover { transform: translateY(-3px); }

/* ========== DASHBOARD ========== */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.dashboard-header h2 { font-size: 2rem; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background-color: var(--dark-card); border-radius: 12px; padding: 25px;
    border-left: 4px solid var(--primary); transition: all 0.3s; cursor: pointer;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.stat-card .value { font-size: 2rem; font-weight: 700; margin-top: 10px; }

/* ========== TABLES ========== */
.inventory-table { width: 100%; border-collapse: collapse; }
.inventory-table th, .inventory-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--dark-border); }
.inventory-table tr:hover { background-color: rgba(109, 40, 217, 0.05); }

/* STOCK STATUS */
.stock-status { display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: 0.85rem; transition: all 0.3s; }
.stock-in { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.stock-low { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.stock-out { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* ========== MODALS ========== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--dark-card); border-radius: 16px; width: 100%; max-width: 500px; padding: 30px; animation: fadeInUp 0.3s; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; }
.form-control {
    width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--dark-border);
    background: rgba(30, 41, 59, 0.5); color: var(--dark-text); transition: all 0.3s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.2); }

/* ========== HERO ========== */
.hero {
    padding: 160px 0 80px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9)), url('https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover; background-position: center; text-align: center;
}
.hero h1 { font-size: 3rem; margin-bottom: 20px; background: linear-gradient(135deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.2rem; color: var(--dark-text-light); max-width: 600px; margin: 0 auto 30px; }
.hero-btns { display: flex; gap: 20px; justify-content: center; }

/* ========== FEATURES ========== */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 40px; }
.feature-card { background: var(--dark-card); border-radius: 12px; padding: 30px; cursor: pointer; transition: all 0.4s ease; position: relative; overflow: hidden; }
.feature-card::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(109, 40, 217, 0.1), transparent); transition: left 0.5s; }
.feature-card:hover { transform: translateY(-10px) scale(1.02); border: 1px solid var(--primary-light); box-shadow: 0 20px 40px rgba(109, 40, 217, 0.3); }
.feature-card:hover::before { left: 100%; }
.feature-card:hover .feature-icon { transform: rotate(360deg); }
.feature-card:hover h3 { color: var(--primary-light); }
.feature-icon { width: 60px; height: 60px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 20px; color: white; transition: all 0.3s; }
.section-title { text-align: center; margin: 60px 0 40px; }
.section-title h2 { font-size: 2.5rem; margin-bottom: 15px; }

/* ========== QUICK LINKS ========== */
.quick-links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.quick-link-item {
    background: rgba(30, 41, 59, 0.5); border-radius: 10px; padding: 20px;
    text-align: center; cursor: pointer; transition: all 0.3s; border: 1px solid transparent;
}
.quick-link-item:hover { transform: translateY(-8px) scale(1.03); border-color: var(--secondary); background: rgba(16, 185, 129, 0.15); box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2); }
.quick-link-item:hover i { transform: scale(1.2) rotate(5deg); color: var(--secondary); }
.quick-link-item i { font-size: 36px; color: var(--primary-light); margin-bottom: 15px; transition: all 0.3s; }
.quick-link-item:hover h4 { color: var(--secondary); }

/* ========== ACTIVITY ========== */
.activity-list { list-style: none; }
.activity-item { padding: 15px 0; border-bottom: 1px solid var(--dark-border); display: flex; align-items: center; gap: 15px; transition: all 0.3s; }
.activity-item:hover { background: rgba(109, 40, 217, 0.05); padding-left: 10px; }
.activity-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(109, 40, 217, 0.1); display: flex; align-items: center; justify-content: center; color: var(--primary-light); transition: all 0.3s; }
.activity-item:hover .activity-icon { transform: scale(1.1); }

/* ========== USER DROPDOWN ========== */
.user-dropdown { position: relative; }
.user-btn { background: rgba(30, 41, 59, 0.7); border: 1px solid var(--dark-border); border-radius: 8px; padding: 8px 15px; color: white; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.3s; }
.user-btn:hover { background: rgba(109, 40, 217, 0.2); border-color: var(--primary); transform: translateY(-2px); }
.dropdown-menu { position: absolute; top: 100%; right: 0; background: var(--dark-card); border-radius: 8px; min-width: 180px; padding: 8px 0; margin-top: 8px; display: none; z-index: 1000; border: 1px solid var(--dark-border); }
.user-dropdown.active .dropdown-menu { display: block; animation: dropdownFade 0.3s; }
.dropdown-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--dark-text-light); text-decoration: none; transition: all 0.3s; }
.dropdown-menu a:hover { background: rgba(109, 40, 217, 0.2); color: var(--primary-light); padding-left: 22px; }

/* ========== AUTH ========== */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 90px 20px; }
.auth-box { background: var(--dark-card); border-radius: 16px; max-width: 450px; width: 100%; padding: 40px; transition: all 0.3s; text-align: center; }
.auth-box:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.auth-tabs { display: flex; gap: 10px; margin-bottom: 30px; border-bottom: 1px solid var(--dark-border); }
.auth-tab { flex: 1; padding: 12px; background: none; border: none; color: var(--dark-text-lighter); cursor: pointer; font-size: 16px; transition: all 0.3s; }
.auth-tab:hover { color: var(--primary-light); }
.auth-tab.active { color: var(--primary-light); border-bottom: 2px solid var(--primary-light); }
.auth-form { display: none; text-align: left; }
.auth-form.active { display: block; }

/* ========== SETTINGS ========== */
.settings-container { display: grid; grid-template-columns: 250px 1fr; gap: 30px; }
.settings-sidebar { background: var(--dark-card); border-radius: 12px; padding: 20px; }
.settings-sidebar a { display: block; padding: 12px 15px; color: var(--dark-text-light); text-decoration: none; border-radius: 8px; margin-bottom: 5px; transition: all 0.3s; }
.settings-sidebar a:hover { background: rgba(109, 40, 217, 0.2); color: var(--primary-light); transform: translateX(5px); }
.settings-sidebar a.active { background: rgba(109, 40, 217, 0.2); color: var(--primary-light); border-left: 3px solid var(--primary); }
.settings-section { display: none; }
.settings-section.active { display: block; animation: fadeInUp 0.3s; }

/* ========== CHATBOT ========== */
.chatbot-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; }
.chatbot-toggle { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; font-size: 24px; border: none; cursor: pointer; transition: all 0.3s; box-shadow: 0 5px 20px rgba(109, 40, 217, 0.4); }
.chatbot-toggle:hover { transform: scale(1.1); box-shadow: 0 8px 25px rgba(109, 40, 217, 0.6); }
.chatbot-box { position: absolute; bottom: 80px; right: 0; width: 350px; height: 500px; background: var(--dark-card); border-radius: 16px; display: none; flex-direction: column; border: 1px solid var(--dark-border); }
.chatbot-box.active { display: flex; animation: fadeInUp 0.3s; }
.chatbot-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); padding: 15px; color: white; border-radius: 16px 16px 0 0; display: flex; justify-content: space-between; }
.chatbot-messages { flex: 1; padding: 15px; overflow-y: auto; }
.chat-message { padding: 10px 15px; border-radius: 15px; margin-bottom: 10px; max-width: 80%; transition: all 0.3s; }
.bot-message { background: rgba(30, 41, 59, 0.7); color: var(--dark-text-light); }
.user-message { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; margin-left: auto; }
.chatbot-input { display: flex; padding: 15px; gap: 10px; border-top: 1px solid var(--dark-border); }
.chatbot-input input { flex: 1; padding: 10px; border-radius: 20px; border: 1px solid var(--dark-border); background: rgba(30, 41, 59, 0.5); color: white; transition: all 0.3s; }
.chatbot-input input:focus { outline: none; border-color: var(--primary); }
.chatbot-input button { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border: none; color: white; cursor: pointer; transition: all 0.3s; }
.chatbot-input button:hover { transform: scale(1.1); }

/* ========== FOOTER ========== */
footer { background: rgba(15, 23, 42, 0.9); border-top: 1px solid var(--dark-border); padding: 40px 0; margin-top: auto; text-align: center; }
.social-icon { color: var(--dark-text); transition: 0.3s; }
.social-icon:hover { color: var(--primary-light) !important; }

/* ========== LIGHT THEME ========== */
body.light-theme { background-color: var(--light-bg); color: var(--light-text); }
body.light-theme .card, body.light-theme .stat-card, body.light-theme .modal-content,
body.light-theme .auth-box, body.light-theme .feature-card, body.light-theme .settings-sidebar,
body.light-theme .chatbot-box { background-color: white; border: 1px solid var(--light-border); }
body.light-theme .form-control { background: #f3f4f6; color: #111827; }
body.light-theme .user-btn, body.light-theme .language-toggle, body.light-theme .theme-toggle { background: #f3f4f6; color: #111827; }
body.light-theme .btn-outline:hover { background: var(--primary); color: white; }
body.light-theme .quick-link-item { background: #f3f4f6; }
body.light-theme .quick-link-item:hover { background: rgba(16, 185, 129, 0.1); }
body.light-theme footer, body.light-theme .quick-links-container { background-color: var(--light-card); color: var(--light-text); }
body.light-theme .quick-links-container h3 { color: var(--light-text) !important; }
body.light-theme .quick-link-item p, body.light-theme .quick-link-item h4 { color: var(--light-text); }
body.light-theme footer p, body.light-theme footer div { color: var(--light-text); }
body.light-theme .social-icon { color: var(--light-text) !important; }
body.light-theme #addSupplierModal .modal-content { background: var(--light-card); border: 1px solid var(--light-border); }

/* ========== RTL ========== */
body.rtl { direction: rtl; text-align: right; }
body.rtl .stat-card { border-left: none; border-right: 4px solid var(--primary); }

/* ========== SUPPLIER BADGES ========== */
.supplier-products-list { display: flex; flex-wrap: wrap; gap: 6px; }
.supplier-product-badge { background: rgba(16, 185, 129, 0.2); color: #10b981; padding: 4px 10px; border-radius: 20px; font-size: 12px; display: inline-block; }

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dropdownFade { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== SYNC LOADING ========== */
.sync-loading { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 15px; }
.sync-loading.hidden { display: none; }
.sync-loading .spinner { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.3); border-top: 4px solid #8b5cf6; border-radius: 50%; animation: spin 1s linear infinite; }
.sync-loading p { color: white; font-size: 16px; }

/* ========== TABLES OVERFLOW & FILTER STYLING ========== */
.card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#suppliersTableMain.inventory-table, #usersTableMain.inventory-table { min-width: auto; }
#inventoryFilterRow input, #salesFilterRow input, #supplierFilterRow input,
#dashboardFilterRow input, #filterRow input {
    width: 100%; max-width: 100%; padding: 6px 8px; font-size: 12px;
    background: var(--dark-bg); color: var(--dark-text);
    border: 1px solid var(--dark-border); border-radius: 4px;
}
#inventoryFilterRow select, #salesFilterRow select, #supplierFilterRow select,
#dashboardFilterRow select, #filterRow select {
    width: 100%; padding: 6px 8px; font-size: 12px;
    background: var(--dark-bg); color: var(--dark-text);
    border: 1px solid var(--dark-border); border-radius: 4px;
}

/* ========== REPORT MODAL ========== */
#reportViewModal .modal-content { max-width: 850px; max-height: 80vh; overflow-y: auto; }
.report-option {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.report-option:hover {
    transform: translateY(-5px);
    background: rgba(109, 40, 217, 0.1); /* نفس التأثير القديم */
}
.report-option h4 { margin-bottom: 8px; }
.report-filter-select {
    width: 100%; padding: 8px 12px; margin-bottom: 10px; border-radius: 6px;
    background: var(--dark-bg); color: var(--dark-text);
    border: 1px solid var(--dark-border); font-size: 13px;
}
.report-date-fields { display: flex; gap: 8px; margin-bottom: 10px; }
.report-date-fields input[type="date"] {
    flex: 1; padding: 7px 10px;
    background: var(--dark-bg); color: var(--dark-text);
    border: 1px solid var(--dark-border); border-radius: 6px; font-size: 13px;
}
.report-actions { display: flex; gap: 8px; }
input[type="date"] {
    color-scheme: dark;
    background-color: var(--dark-bg); color: var(--dark-text);
    border: 1px solid var(--dark-border); padding: 8px 12px; border-radius: 6px;
    font-family: 'Inter', sans-serif; font-size: 14px; width: 100%;
    box-sizing: border-box; transition: border-color 0.3s;
}
input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.2); }
body.light-theme input[type="date"] {
    color-scheme: light;
    background-color: #ffffff; color: var(--light-text);
    border: 1px solid var(--light-border);
}

/* ========== MISC ========== */
.stock-info { font-weight: 600; text-align: center; transition: color 0.2s; }
#invoiceDetailModal .inventory-table { min-width: auto; width: 100%; }
.multi-select-container { border: 1px solid var(--dark-border); border-radius: 8px; background: var(--dark-bg); }
.multi-select-search {
    border: none !important; border-bottom: 1px solid var(--dark-border) !important;
    border-radius: 0 !important; padding: 10px; background: transparent; color: var(--dark-text);
}
.multi-select-options { max-height: 200px; overflow-y: auto; padding: 5px; }
.multi-select-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    cursor: pointer; border-radius: 4px; transition: background 0.2s; font-size: 14px;
}
.multi-select-item:hover { background: rgba(109, 40, 217, 0.1); }
.multi-select-item input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
.multi-select-item span:last-child:hover { color: var(--danger); transform: scale(1.2); }
#newCategoryInput { background: var(--dark-bg); color: var(--dark-text); border: 1px solid var(--dark-border); padding: 6px 10px; border-radius: 6px; }
.sticky-header thead th { position: sticky; top: 0; background: var(--dark-card); z-index: 2; }
.sticky-header thead tr:first-child th { top: 0; }
.sticky-header thead tr:last-child th { top: 40px; }

/* ========== PAGINATION ========== */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 15px; padding: 10px 0; }
.pagination-container { overflow: visible; }
.pagination-ellipsis { padding: 6px 10px; color: var(--dark-text-lighter); }

/* ========== TOAST NOTIFICATION ========== */
.toast-notification {
    position: fixed; top: 80px; right: 20px;
    background: var(--dark-card); color: var(--dark-text);
    padding: 15px 20px; border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    display: flex; align-items: center; gap: 12px;
    z-index: 9999; animation: slideInRight 0.4s ease;
    border-left: 4px solid var(--secondary); max-width: 400px;
    opacity: 1; transition: opacity 0.3s;
}
.toast-success { border-left-color: var(--secondary); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }
.toast-notification i { font-size: 20px; color: var(--secondary); }
.toast-error i { color: var(--danger); }
.toast-info i { color: var(--info); }
.toast-notification span { flex: 1; font-size: 14px; }
.toast-close { background: none; border: none; color: var(--dark-text-lighter); font-size: 18px; cursor: pointer; }

.notification-badge {
    /* position: absolute; */
    top: -5px; right: -5px; background-color: var(--danger) !important;
    color: white !important; font-size: 10px; width: 18px; height: 18px; border-radius: 50% !important;
    display: flex !important; align-items: center; justify-content: center;
}

/* ========== GLOBAL LOADER ========== */
.global-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 9999; color: white; font-size: 18px; gap: 15px;
}
.loader-spinner {
    width: 50px; height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========== LIVE CASHIER CARDS ========== */
.live-cashier-card {
    background: var(--dark-card); border-radius: 12px;
    padding: 20px; text-align: center; width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.live-cashier-card .card-icon { font-size: 40px; color: var(--primary); }
.live-cashier-card .badge {
    background: #10b981; color: white; padding: 5px 15px;
    border-radius: 20px; display: inline-block; margin-top: 10px;
}


/* ========== LIGHT THEME TABLES ========== */
body.light-theme .inventory-table th {
    background: #f3f4f6;
    color: #111827;
    border-bottom: 2px solid var(--light-border);
}

body.light-theme .inventory-table tr:hover {
    background-color: rgba(109, 40, 217, 0.03);
}

body.light-theme #inventoryFilterRow input,
body.light-theme #salesFilterRow input,
body.light-theme #supplierFilterRow input,
body.light-theme #dashboardFilterRow input,
body.light-theme #filterRow input {
    background: #ffffff;
    color: #111827;
    border: 1px solid var(--light-border);
}

body.light-theme #inventoryFilterRow select,
body.light-theme #salesFilterRow select,
body.light-theme #supplierFilterRow select,
body.light-theme #dashboardFilterRow select,
body.light-theme #filterRow select {
    background: #ffffff;
    color: #111827;
    border: 1px solid var(--light-border);
}

body.light-theme .sticky-header thead th {
    background: #f3f4f6;
    color: #111827;
}

body.light-theme .inventory-table td {
    border-bottom: 1px solid var(--light-border);
    color: #111827;
}

/* Light Theme - Report Cards */
body.light-theme .report-option {
    background: #f9fafb;
    border: 1px solid var(--light-border);
}

body.light-theme .report-option:hover {
    background: rgba(109, 40, 217, 0.05);
}

body.light-theme .report-filter-select,
body.light-theme .report-date-fields input[type="date"] {
    background: #ffffff;
    color: #111827;
    border: 1px solid var(--light-border);
}

/* Light Theme - Sale Items Table in Modal */
body.light-theme #saleItemsTable thead th {
    background: #f3f4f6;
    color: #111827;
}

/* Light Theme - Modal Headers Background */
body.light-theme #editProductModal .modal-content div[style*="sticky"],
body.light-theme #newSaleModal .modal-content div[style*="sticky"] {
    background: #ffffff !important;
}

/* Light Theme - Modal Background */
body.light-theme .modal-content {
    background: #ffffff;
}

/* ========== LIGHT THEME - HEADER & SIDEBAR ========== */
body.light-theme header {
    background-color: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--light-border);
}

body.light-theme .logo {
    color: #111827;
}

body.light-theme .hamburger span {
    background: #111827;
}

body.light-theme .sidebar {
    background: #ffffff;
    border-right: 1px solid var(--light-border);
}

body.light-theme .sidebar-item {
    color: #4b5563;
}

body.light-theme .sidebar-item:hover,
body.light-theme .sidebar-item.active {
    background: var(--primary);
    color: white;
}

body.light-theme .dropdown-menu {
    background: #ffffff;
    border: 1px solid var(--light-border);
}

body.light-theme .dropdown-menu a {
    color: #4b5563;
}

body.light-theme .dropdown-menu a:hover {
    background: rgba(109, 40, 217, 0.1);
    color: var(--primary);
}

body.light-theme .user-btn {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid var(--light-border);
}

body.light-theme .user-btn:hover {
    background: rgba(109, 40, 217, 0.1);
    border-color: var(--primary);
}

/* ========== LIGHT THEME - LIVE CASHIER CARDS ========== */
body.light-theme .live-cashier-card {
    background: #ffffff;
    border: 1px solid var(--light-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-theme .live-cashier-card h5 {
    color: #111827;
}

body.light-theme .live-cashier-card p {
    color: #4b5563;
}

body.light-theme .live-cashier-card div[style*="text-align:left"] div {
    color: #374151;
}

body.light-theme .live-cashier-card .badge {
    background: #10b981;
    color: white;
}

/* ========== LIGHT THEME - MULTI-SELECT CONTAINER ========== */
body.light-theme .multi-select-container {
    background: #ffffff;
    border: 1px solid var(--light-border);
}

body.light-theme .multi-select-search {
    background: #ffffff !important;
    color: #111827 !important;
    border-bottom: 1px solid var(--light-border) !important;
}

body.light-theme .multi-select-search::placeholder {
    color: #9ca3af;
}

body.light-theme .multi-select-options {
    background: #ffffff;
}

body.light-theme .multi-select-item {
    color: #111827;
}

body.light-theme .multi-select-item:hover {
    background: rgba(109, 40, 217, 0.05);
}

body.light-theme #newCategoryInput {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid var(--light-border) !important;
}

body.light-theme #newCategoryInput::placeholder {
    color: #9ca3af;
}

/* Light Theme - Small hints */
body.light-theme small[style*="color:#94a3b8"] {
    color: #6b7280 !important;
}

/* ========== BUTTON LOADING STATE ========== */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading .btn-text {
    /* النص هيختفي شوية */
}

.btn-outline .spinner {
    border: 2px solid rgba(109, 40, 217, 0.3);
    border-top: 2px solid var(--primary);
}

.btn-outline.loading {
    background: var(--primary);
    color: white;
}