: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;
}
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* HEADER */
header {
    background-color: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    position: fixed; top: 0; width: 100%; z-index: 1000;
    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); }
.nav-links { display: flex; list-style: none; gap: 4px; }
.nav-links a {
    text-decoration: none; color: var(--dark-text-light); font-weight: 500; font-size: 14px;
    transition: all 0.3s; display: flex; align-items: center; padding: 10px 14px; border-radius: 8px; position: relative;
}
.nav-links a:hover { color: var(--primary-light); background-color: rgba(109, 40, 217, 0.1); transform: translateY(-2px); }
.nav-links a.active { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3); }
.nav-links a i { margin-right: 8px; }
.notification-badge {
    position: absolute; top: -5px; right: -5px; background-color: var(--danger);
    color: white; font-size: 10px; width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* 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; }

/* PAGES */
.page { display: none; padding: 90px 0 60px; min-height: calc(100vh - 70px); }
.page.active { display: block; }

/* 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: 60px; text-align: center; }
.language-toggle, .theme-toggle { background: rgba(30, 41, 59, 0.7); border: 1px solid var(--dark-border); border-radius: 8px; padding: 8px 12px; color: white; cursor: pointer; transition: all 0.3s; }
.language-toggle:hover, .theme-toggle:hover { background: rgba(109, 40, 217, 0.2); border-color: var(--primary); transform: translateY(-2px); }
.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); }

/* 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); }
.social-icon { color: var(--dark-text); transition: 0.3s; }
.social-icon:hover { color: var(--primary-light) !important; }

/* RTL */
body.rtl { direction: rtl; text-align: right; }
body.rtl .nav-links a i { margin-left: 8px; margin-right: 0; }
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; }
.supplier-products-multi { width: 100%; padding: 10px; border-radius: 8px; background: #0f172a; color: white; border: 1px solid var(--dark-border); min-height: 130px; }
.supplier-products-multi option { padding: 8px; margin: 2px 0; border-radius: 6px; }
.supplier-products-multi option:checked { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }

/* 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); } }

/* 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; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .quick-links-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-container { grid-template-columns: 1fr; }
    .hero-btns { flex-direction: column; align-items: center; }
}
/* ========== RESPONSIVE IMPROVEMENTS ========== */

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 5px;
    z-index: 1100;
}
.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--dark-text);
    border-radius: 5px;
    transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    /* Show hamburger, hide nav */
    .hamburger { display: flex; }
    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: 0;
        background: var(--dark-card);
        overflow-y: auto;
        transition: height 0.4s ease;
        padding: 0;
        gap: 0;
        z-index: 999;
        box-shadow: 0 10px 15px rgba(0,0,0,0.3);
    }
    .nav-links.active {
        height: calc(100vh - 70px);
        padding: 20px;
    }
    .nav-links a {
        padding: 15px;
        border-bottom: 1px solid var(--dark-border);
        width: 100%;
    }

    /* Typography */
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .dashboard-header h2 { font-size: 1.5rem; }
    .section-title h2 { font-size: 1.8rem; }

    /* Grids */
    .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 */
    .settings-container { grid-template-columns: 1fr; }

    /* Modals */
    .modal-content { width: 95%; margin: 10px; padding: 20px; }

    /* Chatbot */
    .chatbot-box { width: 280px; height: 400px; right: 10px; }
    .chatbot-toggle { width: 50px; height: 50px; font-size: 20px; }

    /* Hero */
    .hero { padding: 120px 0 40px; }
    .hero-btns { flex-direction: column; align-items: center; }

    /* Footer */
    footer .container > div:first-child { grid-template-columns: 1fr; text-align: center; }
    .social-icons { justify-content: center; }

    /* Inventory/sales/suppliers tables */
    .inventory-table { min-width: 600px; }
    .card:has(.inventory-table) { overflow-x: auto; }

    /* Light theme adjustments */
    body.light-theme .nav-links { background: white; }
    body.light-theme .nav-links a { border-color: var(--light-border); }
}

@media (max-width: 480px) {
    .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; }
}
