/* ============================================
   THEME: Dark Gold (Default)
   ============================================ */
:root,
[data-theme="dark-gold"] {
    --primary: #c9a227;
    --primary-hover: #b08e20;
    --primary-rgb: 201, 162, 39;
    --bg-dark: #0f1115;
    --bg-card: #1a1d23;
    --text-white: #ffffff;
    --text-gray: #a0aec0;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --btn-gradient: linear-gradient(135deg, #c9a227, #e6c14d);
    --btn-text: #000;
}

/* ============================================
   THEME: Dark Blue
   ============================================ */
[data-theme="dark-blue"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-rgb: 59, 130, 246;
    --bg-dark: #0b1120;
    --bg-card: #131b2e;
    --text-white: #ffffff;
    --text-gray: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --btn-gradient: linear-gradient(135deg, #3b82f6, #60a5fa);
    --btn-text: #fff;
}

/* ============================================
   THEME: Dark Purple
   ============================================ */
[data-theme="dark-purple"] {
    --primary: #a855f7;
    --primary-hover: #9333ea;
    --primary-rgb: 168, 85, 247;
    --bg-dark: #0f0a1a;
    --bg-card: #1a1225;
    --text-white: #ffffff;
    --text-gray: #a78bfa;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.12);
    --btn-gradient: linear-gradient(135deg, #a855f7, #c084fc);
    --btn-text: #fff;
}

/* ============================================
   THEME: Light
   ============================================ */
[data-theme="light"] {
    --primary: #c9a227;
    --primary-hover: #b08e20;
    --primary-rgb: 201, 162, 39;
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --text-white: #1a1a2e;
    --text-gray: #64748b;
    --glass: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
    --btn-gradient: linear-gradient(135deg, #c9a227, #e6c14d);
    --btn-text: #000;
}

[data-theme="light"] .glass {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

[data-theme="light"] .form-control {
    background: #f8f9fa;
    color: #1a1a2e;
    border-color: rgba(0,0,0,0.1);
}

[data-theme="light"] .form-control:focus {
    background: #fff;
}

[data-theme="light"] .sidebar {
    background: #fff !important;
    border-right-color: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] .sidebar-link {
    color: #64748b !important;
}

[data-theme="light"] .sidebar-link.active {
    color: var(--primary) !important;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    border: none;
}

.btn-primary {
    background: var(--btn-gradient);
    color: var(--btn-text);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(var(--primary-rgb), 0.3);
}

.btn-secondary {
    background: var(--glass);
    color: var(--text-white);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-white);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

/* Containers */
main {
    padding-top: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 0;
    z-index: 1001;
    backdrop-filter: blur(10px);
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-item {
    color: var(--text-gray);
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.active {
    color: var(--primary);
    font-weight: 600;
}

.animate-fade {
    animation: fadeIn 0.6s ease forwards;
}

/* ============================================
   LANGUAGE & THEME SWITCHER
   ============================================ */
.switcher-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.switcher-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-gray);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.switcher-btn:hover,
.switcher-btn.active {
    color: var(--primary);
    border-color: var(--primary);
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.theme-dot:hover,
.theme-dot.active {
    border-color: var(--text-white);
    transform: scale(1.2);
}

.theme-dot.gold { background: #c9a227; }
.theme-dot.blue { background: #3b82f6; }
.theme-dot.purple { background: #a855f7; }
.theme-dot.light-mode { background: linear-gradient(135deg, #f5f5f5, #c9a227); border: 1px solid #ccc; }

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--glass-border);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 250px;
}

[dir="rtl"] .dropdown-content {
    left: auto;
    right: 0;
}

[dir="rtl"] nav {
    flex-direction: row-reverse;
}

[dir="rtl"] nav > div {
    flex-direction: row-reverse;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================
   RESPONSIVE: TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    /* Sidebar layouts */
    .sidebar {
        width: 200px !important;
    }
    .main-content {
        margin-left: 200px !important;
        padding: 25px !important;
    }
    [dir="rtl"] .main-content {
        margin-left: 0 !important;
        margin-right: 200px !important;
    }
}

/* ============================================
   RESPONSIVE: MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Hamburger menu */
    .hamburger {
        display: block;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        padding: 80px 30px 30px;
        gap: 15px;
        z-index: 1001;
        overflow-y: auto;
        border-left: 1px solid var(--glass-border);
        box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    }

    [dir="rtl"] .nav-links {
        right: auto;
        left: 0;
        border-left: none;
        border-right: 1px solid var(--glass-border);
        box-shadow: 10px 0 30px rgba(0,0,0,0.3);
    }

    .nav-links.open {
        display: flex !important;
        animation: slideIn 0.3s ease;
    }

    .nav-overlay.open {
        display: block;
    }

    @keyframes slideIn {
        from { transform: translateX(100%); }
        to { transform: translateX(0); }
    }

    [dir="rtl"] .nav-links.open {
        animation: slideInRTL 0.3s ease;
    }

    @keyframes slideInRTL {
        from { transform: translateX(-100%); }
        to { transform: translateX(0); }
    }

    .nav-links a, .nav-links .btn {
        font-size: 1rem !important;
        padding: 10px 0;
        width: 100%;
        text-align: left;
    }

    [dir="rtl"] .nav-links a,
    [dir="rtl"] .nav-links .btn {
        text-align: right;
    }

    .nav-links .dropdown {
        width: 100%;
    }

    .nav-links .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        background: rgba(255,255,255,0.03);
        border-radius: 8px;
        margin-top: 5px;
    }

    .nav-links .dropdown:hover .dropdown-content {
        display: block;
    }

    /* Navbar */
    nav {
        margin: 10px !important;
        padding: 12px 20px !important;
    }

    /* Hero Section */
    main {
        padding-top: 60px;
    }

    /* Typography */
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.1rem !important; }

    /* Containers */
    .container {
        padding: 0 15px;
    }

    /* Glass cards */
    .glass {
        border-radius: 12px;
    }

    /* Tables responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    thead, tbody, tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    table {
        min-width: 600px;
    }

    /* Two-column grids → single column */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: repeat"] {
        grid-template-columns: 1fr !important;
    }

    /* Sidebar → top bar on mobile */
    .sidebar {
        position: fixed !important;
        width: 100% !important;
        height: auto !important;
        bottom: 0;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 999;
        padding: 10px 15px !important;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        gap: 5px;
        border-right: none !important;
        border-left: none !important;
        border-top: 1px solid var(--glass-border) !important;
        border-radius: 0 !important;
    }

    .sidebar h2 {
        display: none !important;
    }

    .sidebar-link {
        margin-bottom: 0 !important;
        white-space: nowrap;
        font-size: 0.75rem !important;
        padding: 8px 12px;
        border-radius: 8px;
        text-align: center;
    }

    .sidebar-link[style*="margin-top"] {
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 8px !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 20px 15px 80px !important;
    }

    [dir="rtl"] .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Footer */
    footer {
        padding: 40px 0 !important;
        margin-top: 60px !important;
    }

    /* Checkout grid */
    div[style*="grid-template-columns: 1fr 1fr; gap: 40px"] {
        grid-template-columns: 1fr !important;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Account page */
    div[style*="grid-template-columns: 1fr 1fr; gap: 30px"] {
        grid-template-columns: 1fr !important;
    }

    /* Feature cards */
    div[style*="minmax(280px, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Product cards */
    div[style*="minmax(250px, 1fr)"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Category filter wrap */
    div[style*="flex-wrap: wrap"] {
        justify-content: flex-start !important;
    }

    /* Support header */
    div[style*="justify-content: space-between"][style*="align-items: center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px;
    }

    /* Modal sizing */
    div[style*="max-width: 500px"] {
        max-width: 95% !important;
        padding: 25px !important;
    }
}

/* ============================================
   RESPONSIVE: SMALL PHONES (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.3rem !important; }

    nav {
        margin: 8px !important;
        padding: 10px 15px !important;
    }

    nav a[style*="font-size: 1.5rem"] {
        font-size: 1.2rem !important;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    /* Single column product cards on small phones */
    div[style*="minmax(250px, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Payment method grid */
    div[style*="grid-template-columns: 1fr 1fr; gap: 15px"] {
        grid-template-columns: 1fr !important;
    }

    /* Glass padding */
    .glass {
        padding: 20px !important;
    }

    /* Stats cards */
    div[style*="font-size: 2.5rem"] {
        font-size: 1.8rem !important;
    }

    /* Table font */
    td, th {
        padding: 10px 12px !important;
        font-size: 0.8rem;
    }
}

/* ============================================
   PREMIUM SIDEBAR STYLING (DESKTOP)
   ============================================ */
@media (min-width: 769px) {
    body .sidebar {
        padding: 40px 24px !important;
        background: var(--bg-card);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
    }

    body .sidebar h2 {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        letter-spacing: 2px !important;
        text-transform: uppercase !important;
        color: var(--primary) !important;
        margin-bottom: 35px !important;
        padding-bottom: 15px !important;
        border-bottom: 1px solid var(--glass-border) !important;
        opacity: 0.9;
    }

    body .sidebar-link {
        display: flex !important;
        align-items: center !important;
        padding: 10px 16px !important;
        color: var(--text-gray) !important;
        text-decoration: none !important;
        margin-bottom: 6px !important;
        font-weight: 500 !important;
        font-size: 0.88rem !important;
        border-radius: 8px !important;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    body .sidebar-link:hover {
        color: var(--primary) !important;
        background: rgba(var(--primary-rgb), 0.08) !important;
        transform: translateX(4px);
    }

    body .sidebar-link.active {
        color: var(--btn-text, #000) !important;
        background: var(--btn-gradient) !important;
        font-weight: 600 !important;
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25) !important;
    }

    /* Light Theme Adjustments */
    [data-theme="light"] body .sidebar-link {
        color: #64748b !important;
    }
    [data-theme="light"] body .sidebar-link:hover {
        color: var(--primary) !important;
        background: rgba(var(--primary-rgb), 0.06) !important;
    }
    [data-theme="light"] body .sidebar-link.active {
        color: var(--btn-text, #000) !important;
        background: var(--btn-gradient) !important;
    }
}

