@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font-ar: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[lang="ar"], html[dir="rtl"] {
    font-family: var(--font-ar);
    direction: rtl;
    text-align: right;
}

html[lang="en"], html[dir="ltr"] {
    font-family: var(--font-en);
    direction: ltr;
    text-align: left;
}

body {
    background-color: #f8fafc;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #10b981;
}

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

.animate-fade-in {
    animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Glassmorphism effects */
.glass-panel {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Line clamp helpers */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide scrollbar for category tabs */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}
.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ======================================================== */
/* 🛒 Cart Overlay & Drawer - Rock-Solid CSS Transitions */
/* ======================================================== */
#cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

#cart-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#cart-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    z-index: 1000;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

/* In RTL: Drawer slides in from the right edge */
html[dir="rtl"] #cart-drawer {
    right: 0;
    left: auto;
    transform: translateX(105%);
}
html[dir="rtl"] #cart-drawer.active {
    transform: translateX(0);
    visibility: visible;
}

/* In LTR: Drawer slides in from the right edge as well */
html[dir="ltr"] #cart-drawer {
    right: 0;
    left: auto;
    transform: translateX(105%);
}
html[dir="ltr"] #cart-drawer.active {
    transform: translateX(0);
    visibility: visible;
}

/* ======================================================== */
/* 🗺️ Country Dropdown Styles */
/* ======================================================== */
.country-dropdown {
    position: relative;
}

.country-menu {
    position: absolute;
    top: calc(100% + 8px);
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 120;
}

html[dir="rtl"] .country-menu {
    right: 0;
    left: auto;
}
html[dir="ltr"] .country-menu {
    left: 0;
    right: auto;
}

.country-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    transition: all 0.15s ease;
}

.country-option:hover {
    background: #f0fdf4;
    color: #16a34a;
}

.country-option.active {
    background: #dcfce7;
    color: #15803d;
    font-weight: 800;
}

.country-option .flag {
    font-size: 18px;
    line-height: 1;
}

.country-option .currency-tag {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 8px;
}

html[dir="rtl"] .country-option .currency-tag {
    margin-right: auto;
    margin-left: 0;
}

html[dir="ltr"] .country-option .currency-tag {
    margin-left: auto;
    margin-right: 0;
}

/* ======================================================== */
/* 🌐 Language Switcher Button */
/* ======================================================== */
.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lang-btn:hover {
    background: #ecfdf5;
    color: #15803d;
    border-color: #86efac;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.1);
}
