/* 
 * ==========================================
 * S22 UI Design System v2.0
 * Inspired by: Ouedkniss (Trust) & AliExpress (Engagement)
 * ==========================================
 */
/* 
 * ==========================================
 * S22 UI Design System v3.0 (Theme Engine)
 * ==========================================
 */
:root {
    /* --- Default (Day Mode) --- */
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;

    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.75);

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.05);

    /* Dimensions */
    --header-height: 64px;
    --nav-height: 50px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Night Mode (Dark) --- */
[data-theme="dark"] {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4338ca;

    --bg-main: #0f172a;
    /* Slate 950 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --bg-nav: rgba(30, 41, 59, 0.95);
    --bg-glass: rgba(15, 23, 42, 0.8);

    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #cbd5e1;
    /* Slate 300 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border-color: #334155;
    /* Slate 700 */
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* --- Eye Care Mode (Overlay Logic) --- */
/* Note: Eye Care is now handled via .eye-care-active class on body, 
   applying a filter on top of the existing theme (Light or Dark). */


/* --- Utility Overrides (The Magic) --- */
body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    font-family: 'Tajawal', sans-serif;
    transition: background-color 0.4s ease, color 0.4s ease;
    padding-top: calc(var(--header-height) + var(--nav-height) + 10px);
    padding-bottom: 70px;
    -webkit-tap-highlight-color: transparent;
}

/* Tailwind Overrides for Themes */
.bg-white {
    background-color: var(--bg-card) !important;
}

.bg-gray-50,
.bg-slate-50,
.bg-gray-100,
.bg-slate-100 {
    background-color: var(--bg-main) !important;
}

/* FIX: Do not force dark elements to be white in light mode */
[data-theme="dark"] .bg-gray-900,
[data-theme="dark"] .bg-slate-900,
[data-theme="dark"] .bg-gray-800,
[data-theme="dark"] .bg-slate-800 {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="eye-care"] .bg-gray-900,
[data-theme="eye-care"] .bg-slate-900 {
    background-color: var(--text-primary) !important;
    /* Brownish dark for contrast */
}

/* --- Dark Mode Text Fixes --- */
.text-gray-900,
.text-gray-800,
.text-gray-700,
.text-slate-900,
.text-slate-800 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-slate-800 {
    color: #f8fafc !important;
    /* White text for dark mode */
}

.text-gray-600,
.text-gray-500,
.text-slate-500 {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-slate-500 {
    color: #cbd5e1 !important;
    /* Lighter gray for dark mode */
}

.text-gray-400 {
    color: var(--text-muted) !important;
}

.border-gray-200,
.border-gray-100,
.border-slate-200,
.border-gray-300 {
    border-color: var(--border-color) !important;
}

/* 1. Form Inputs in Dark Mode */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #1e293b !important;
    /* Slate 800 */
    color: #f8fafc !important;
    /* Slate 50 */
    border-color: #475569 !important;
    /* Slate 600 */
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #94a3b8 !important;
    /* Slate 400 */
}

/* 2. Buttons in Dark Mode (Ghost/Outline fixes) */
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-gray-200,
[data-theme="dark"] .hover\:bg-gray-100:hover,
[data-theme="dark"] .hover\:bg-gray-200:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

/* 3. Eye Care Filter (Golden/Warm Overlay) */
html.eye-care-active {
    position: relative;
}

html.eye-care-active::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 166, 0, 0.15);
    /* Warm Orange tint */
    backdrop-filter: sepia(30%) contrast(90%);
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: multiply;
    /* Blends nicely with both dark and light */
    transition: all 0.5s ease;
}

/* Adjust filter for Dark Mode to avoid being too muddy */
[data-theme="dark"].eye-care-active::before {
    mix-blend-mode: soft-light;
    background: rgba(255, 180, 50, 0.2);
}

/* ==========================================
 * ⚡ S22 Dark Mode — Professional Full Coverage
 * Works on ALL pages via [data-theme="dark"] on <html>
 * ========================================== */

/* --- Core Backgrounds --- */
[data-theme="dark"] body {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] .bg-slate-100,
[data-theme="dark"] .bg-neutral-50,
[data-theme="dark"] .bg-neutral-100 {
    background-color: #1e293b !important;
}

/* bg-[#F2F2F7] is iOS background — overridden via body */

[data-theme="dark"] .bg-gray-200,
[data-theme="dark"] .bg-slate-200 {
    background-color: #334155 !important;
}

/* --- Text --- */
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-slate-700 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-slate-500 {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-slate-400 {
    color: #64748b !important;
}

/* --- Borders --- */
[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-slate-100,
[data-theme="dark"] .border-slate-200 {
    border-color: #334155 !important;
}

/* --- Navigation Bars --- */
[data-theme="dark"] nav,
[data-theme="dark"] .glass-nav,
[data-theme="dark"] .bottom-nav,
[data-theme="dark"] .bottom-nav-bar {
    background-color: rgba(15, 23, 42, 0.97) !important;
    border-top-color: #334155 !important;
}

/* --- Sticky Headers --- */
[data-theme="dark"] header,
[data-theme="dark"] .glass-header,
[data-theme="dark"] .sticky {
    background-color: rgba(15, 23, 42, 0.92) !important;
    border-bottom-color: #334155 !important;
}

/* --- Sidebars / Drawers --- */
[data-theme="dark"] .sidebar {
    background-color: #1e293b !important;
}

/* --- Cards / Panels --- */
[data-theme="dark"] .product-card,
[data-theme="dark"] .s22-card,
[data-theme="dark"] .ios-group,
[data-theme="dark"] .ios-item,
[data-theme="dark"] .rounded-2xl.bg-white,
[data-theme="dark"] .rounded-3xl.bg-white,
[data-theme="dark"] .rounded-xl.bg-white,
[data-theme="dark"] .rounded-2xl.shadow-sm,
[data-theme="dark"] .s22-glass-card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* --- iOS Items (profile.html) --- */
[data-theme="dark"] .ios-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .ios-item:hover,
[data-theme="dark"] .ios-item:active {
    background-color: #263548 !important;
}

/* --- Wallet Card preservation --- */
[data-theme="dark"] .wallet-card {
    background: linear-gradient(135deg, #1e1b4b, #312e81) !important;
}

/* --- Forms & Inputs --- */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

/* --- Buttons (ghost/secondary) --- */
[data-theme="dark"] .bg-gray-100:not(.ios-icon),
[data-theme="dark"] .bg-gray-200:not(.ios-icon) {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .bg-indigo-50 {
    background-color: rgba(99, 102, 241, 0.15) !important;
}

[data-theme="dark"] .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.12) !important;
}

[data-theme="dark"] .bg-amber-50 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

[data-theme="dark"] .bg-red-50 {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

[data-theme="dark"] .bg-green-50 {
    background-color: rgba(34, 197, 94, 0.1) !important;
}

/* --- Badge backgrounds in dark mode --- */
[data-theme="dark"] .bottom-nav-item .badge {
    border-color: #0f172a;
}

/* --- Slide Screens (profile) --- */
[data-theme="dark"] .slide-screen {
    background-color: #0f172a !important;
}

[data-theme="dark"] .slide-screen .bg-white {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* --- Modals --- */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal .bg-white {
    background-color: #1e293b !important;
}

/* --- Shadow adjustments --- */
[data-theme="dark"] .shadow-sm,
[data-theme="dark"] .shadow,
[data-theme="dark"] .shadow-md {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* --- Product Images placeholder --- */
[data-theme="dark"] .product-image {
    background-color: #263548 !important;
}

/* --- Category Icons --- */
[data-theme="dark"] .cat-icon,
[data-theme="dark"] .cat-icon::after {
    background: #1e293b !important;
}

/* --- Skeleton in dark mode --- */
[data-theme="dark"] .skeleton,
[data-theme="dark"] .skel {
    background: linear-gradient(90deg, #1e293b 25%, #263548 50%, #1e293b 75%) !important;
    background-size: 200% 100% !important;
}

/* --- Loading spinners --- */
[data-theme="dark"] .border-indigo-100 {
    border-color: #312e81 !important;
}

/* --- Dividers --- */
[data-theme="dark"] hr,
[data-theme="dark"] .divide-y> :not(template)~ :not(template) {
    border-color: #334155 !important;
}

/* --- Table / list rows --- */
[data-theme="dark"] tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* --- Scrollbar (custom) --- */
[data-theme="dark"] * {
    scrollbar-color: #334155 transparent;
}

/* --- Transition smooth on theme change --- */
html,
body,
* {
    transition: background-color 0.3s ease, border-color 0.25s ease, color 0.2s ease;
}

/* Exception: don't animate transforms */
[class*="translate"],
[class*="rotate"],
[class*="scale"],
.slide-screen,
#active-chat {
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1) !important;
}


/* Utilities */
.s22-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.s22-container {
    max-width: 1400px;
    /* Wider for AliExpress density */
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 769px) {
    body {
        padding-bottom: 0;
    }
}

/* Glassmorphism Utilities */
.s22-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.s22-glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .s22-glass-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.s22-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

.s22-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: var(--transition-base);
    overflow: hidden;
    position: relative;
}

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

.s22-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-weight: bold;
    transition: var(--transition-base);
}

.s22-btn-primary:active {
    transform: scale(0.97);
}

.s22-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* Specific Design Elements */

/* Hide Scrollbars */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animation */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* الشريط السفلي */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: #94a3b8;
    gap: 4px;
    transition: 0.3s;
    position: relative;
    width: 20%;
    text-decoration: none;
}

.nav-item i {
    font-size: 20px;
    transition: 0.3s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-item.active i {
    transform: translateY(-3px);
}

/* الزر العائم (للمزادات) */
.fab-container {
    position: relative;
    top: -25px;
}

.fab-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
    border: 4px solid var(--bg-body);
}

/* الشريط الجانبي */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: white;
    z-index: 70;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
}

.sidebar.active {
    right: 0;
}

/* كروت المنتجات */
.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #f1f5f9;
    transition: transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    aspect-ratio: 1/1;
    background-color: #f1f5f9;
    position: relative;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

/* الأقسام (Stories Style) */
.cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    cursor: pointer;
}

.cat-icon {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    /* دائري مثل الستوري */
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    font-size: 24px;
    transition: 0.3s;
    color: var(--primary);
}

/* حلقة ملونة حول الأيقونة */
.cat-icon::before {
    content: '';
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: -2px;
    right: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f59e0b, #ec4899, #8b5cf6);
    z-index: -1;
}

/* طبقة بيضاء للفصل */
.cat-icon::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 50%;
    background: var(--bg-card);
    z-index: -1;
}

.cat-item:active .cat-icon {
    transform: scale(0.95);
}

/* Loader Animation */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* تأثير الظهور */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* New & Discount Badges */
.badge-new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    animation: pulse-green 2s infinite;
}

.badge-discount {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Cart Fly Animation */
@keyframes flyToCart {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.1);
        opacity: 0;
    }
}

.fly-item {
    position: fixed;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: flyToCart 0.8s ease-in-out forwards;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    color: white;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInUp 0.5s, fadeOut 0.5s 4.5s forwards;
    width: max-content;
    max-width: 90vw;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
}

/* ==========================================
 * Mobile UX Enhancements
 * ========================================== */

/* Touch Targets - Minimum 44px for accessibility */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.touch-target-lg {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 20px;
}

/* Skeleton Screens */
.skeleton {
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    width: 100%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-md);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav.nav-hidden {
    transform: translateY(100%);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    min-width: 60px;
    padding: 8px 0;
    color: var(--text-muted);
    transition: color 0.2s ease;
    position: relative;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item .badge {
    position: absolute;
    top: 5px;
    right: 50%;
    transform: translateX(120%);
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

[data-theme="dark"] .bottom-nav-item .badge {
    border-color: #1e293b;
}

/* Floating Action Button (FAB) in Nav */
.nav-fab-container {
    position: relative;
    top: -24px;
}

.nav-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    border: 4px solid var(--bg-main);
    transition: transform 0.2s;
}

.nav-fab:active {
    transform: scale(0.95);
}

[data-theme="dark"] .nav-fab {
    border-color: #0f172a;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

/* Page Transitions */
.page-enter {
    animation: pageEnter 0.4s ease-out forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pull to Refresh Spinner */
.ptr-spinner {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: var(--primary);
    opacity: 0;
    pointer-events: none;
}

/* PWA Install Modal */
.pwa-modal {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(150%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-modal.active {
    transform: translateY(0);
}

.pwa-content {
    padding: 20px;
}

/* Haptic Feedback - visual pulse on tap */
.haptic-tap {
    transition: transform 0.1s ease;
}

.haptic-tap:active {
    transform: scale(0.95);
}

/* --- Global Skeleton Loader --- */
.skeleton {
    background: linear-gradient(90deg, #f0f2f5 25%, #e5e7eb 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Dark Mode Skeleton */
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
}

/* Utilities */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ======================================================
 * S22MARKET UX Enhancement Utilities v1.0
 * ====================================================== */

/* ── Visibility helpers ── */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

/* ── Sticky bottom action bar (mobile) ── */
.sticky-action-bar {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 1100;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .sticky-action-bar {
    background: rgba(15, 23, 42, 0.95);
    border-top-color: rgba(255, 255, 255, 0.06);
}

.sticky-action-bar.hidden {
    transform: translateY(110%);
}

.sticky-price-pill {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    padding: 10px 16px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.sticky-action-bar .s22-btn-add-cart {
    flex: 1;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 13px 20px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sticky-action-bar .s22-btn-add-cart:active {
    transform: scale(0.97);
}

.sticky-action-bar .s22-btn-add-cart:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ── Pulse badge (for new order count) ── */
.pulse-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

/* ── Notification dot (tiny red dot on icons) ── */
.notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulseBadge 1.8s infinite;
}

[data-theme="dark"] .notif-dot {
    border-color: #1e293b;
}

/* ── Slide-up animation ── */
@keyframes slideInUpSoft {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-up {
    animation: slideInUpSoft 0.4s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

/* ── Order summary card ── */
.order-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 1rem;
}

.order-summary-card .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.order-summary-card .row.total {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.order-summary-card .row.total span:last-child {
    color: #059669;
}

/* ── Stats card (merchant dashboard) ── */
.merchant-stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s, transform 0.2s;
}

.merchant-stat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    transform: translateY(-2px);
}

.merchant-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.merchant-stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.merchant-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── New order banner (merchant) ── */
.new-orders-banner {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: slideInUpSoft 0.45s ease;
}

.new-orders-banner .banner-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    animation: pulseBadge 1.5s infinite;
}

.new-orders-banner .banner-body {
    flex: 1;
}

.new-orders-banner .banner-title {
    font-weight: 900;
    font-size: 1rem;
}

.new-orders-banner .banner-sub {
    font-size: 0.82rem;
    opacity: 0.85;
}

/* ── Filter tab bar (horizontal scroll) ── */
.filter-tab-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.filter-tab-bar::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: 99px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.18s;
    white-space: nowrap;
}

.filter-tab.active,
.filter-tab:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Skeleton card for product grid ── */
.skeleton-card-product {
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.skeleton-product-img {
    aspect-ratio: 1;
    background: linear-gradient(90deg, #f0f2f5 25%, #e5e7eb 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton-product-img {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

.skeleton-product-body {
    padding: 0.75rem;
}

.skeleton-line {
    height: 12px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f2f5 25%, #e5e7eb 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
}

[data-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}