/* ========================================
   MARKETPLACE - Design System & Styles
   ======================================== */

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

/* --- CSS Custom Properties --- */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-glass-strong: rgba(255, 255, 255, 0.1);

    --text-primary: #f0f0f5;
    --text-secondary: #8a8a9a;
    --text-muted: #55556a;

    --accent-1: #7c3aed;
    --accent-2: #3b82f6;
    --accent-3: #06b6d4;
    --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    --accent-gradient-hover: linear-gradient(135deg, #8b5cf6, #60a5fa, #22d3ee);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 2rem;
    --font-4xl: 2.5rem;
    --font-5xl: 3.5rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.3);
    --shadow-glow-strong: 0 0 40px rgba(124, 58, 237, 0.5);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-1) var(--bg-secondary);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-1);
    border-radius: var(--radius-full);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

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

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

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes cartBounce {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* --- Header --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.header.scrolled {
    background: rgba(10, 10, 15, 0.95);
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-xl);
    font-weight: 800;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.logo-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.nav-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: var(--font-sm);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
    padding: var(--space-xs) 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: var(--transition-base);
    border-radius: var(--radius-full);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Search Bar */
.search-container {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.8rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-family: var(--font-family);
    transition: var(--transition-base);
}

.search-bar::placeholder {
    color: var(--text-muted);
}

.search-bar:focus {
    border-color: var(--accent-1);
    background: var(--bg-glass-strong);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--font-md);
    pointer-events: none;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.cart-btn {
    position: relative;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.75rem;
    color: var(--text-primary);
    font-size: var(--font-lg);
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cart-btn:hover {
    border-color: var(--accent-1);
    background: var(--bg-glass-strong);
    box-shadow: var(--shadow-glow);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-spring);
}

.cart-badge.bounce {
    animation: cartBounce 0.5s ease;
}

.cart-badge.hidden {
    display: none;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8rem var(--space-xl) var(--space-3xl);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(124, 58, 237, 0.4);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.hero-content {
    position: relative;
    max-width: 700px;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.4rem 1.2rem;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease;
}

.hero-badge span {
    color: var(--accent-3);
    font-weight: 600;
}

.hero h1 {
    font-size: var(--font-5xl);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease 0.1s forwards;
    opacity: 0;
}

.hero h1 .gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: var(--font-lg);
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto var(--space-xl);
    line-height: 1.7;
    animation: fadeInUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    animation: fadeInUp 0.6s ease 0.3s forwards;
    opacity: 0;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 600;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-glass-strong);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: var(--font-xs);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

/* --- Filters Section --- */
.filters-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl) var(--space-xl);
}

.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.filter-categories {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-glass-strong);
}

.filter-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.sort-select {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    cursor: pointer;
    transition: var(--transition-base);
}

.sort-select:focus {
    border-color: var(--accent-1);
    outline: none;
}

.sort-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.results-count {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* --- Product Grid --- */
.products-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl) var(--space-3xl);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* --- Product Card --- */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-base);
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary);
}

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

.product-card:hover .product-image-wrapper img {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new {
    background: var(--accent-gradient);
    color: white;
}

.badge-sale {
    background: var(--danger);
    color: white;
}

.badge-hot {
    background: var(--warning);
    color: #000;
}

.product-quick-actions {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    opacity: 0;
    transform: translateX(10px);
    transition: var(--transition-base);
}

.product-card:hover .product-quick-actions {
    opacity: 1;
    transform: translateX(0);
}

.quick-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-md);
    transition: var(--transition-fast);
}

.quick-action-btn:hover {
    background: var(--accent-1);
    border-color: var(--accent-1);
}

.product-info {
    padding: var(--space-lg);
}

.product-category {
    font-size: var(--font-xs);
    color: var(--accent-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.product-name {
    font-size: var(--font-md);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.stars {
    color: var(--warning);
    font-size: var(--font-sm);
    letter-spacing: 1px;
}

.rating-count {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-md);
}

.product-price {
    font-size: var(--font-xl);
    font-weight: 700;
}

.product-price .original-price {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: var(--space-sm);
    font-weight: 400;
}

.add-to-cart-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-size: var(--font-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: var(--transition-base);
}

.add-to-cart-btn:hover {
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.add-to-cart-btn.added {
    background: var(--success);
}

/* --- Cart Drawer --- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-color);
}

.cart-header h2 {
    font-size: var(--font-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cart-count-label {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-weight: 400;
}

.cart-close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.cart-close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md) var(--space-xl);
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    gap: var(--space-md);
}

.cart-empty-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.cart-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.cart-item-image {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-card);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: var(--font-sm);
    color: var(--accent-3);
    font-weight: 600;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.qty-btn:hover {
    background: var(--accent-1);
    border-color: var(--accent-1);
}

.qty-value {
    font-size: var(--font-sm);
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-md);
    cursor: pointer;
    padding: var(--space-xs);
    transition: var(--transition-fast);
}

.cart-item-remove:hover {
    color: var(--danger);
}

.cart-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-color);
    background: rgba(10, 10, 15, 0.5);
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.cart-subtotal-label {
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.cart-subtotal-value {
    font-size: var(--font-xl);
    font-weight: 700;
}

.checkout-btn {
    width: 100%;
    padding: 0.9rem;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-size: var(--font-md);
    font-weight: 700;
    border: none;
    transition: var(--transition-base);
    box-shadow: var(--shadow-glow);
}

.checkout-btn:hover {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-2px);
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Product Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    animation: scaleIn 0.4s ease;
}

.modal-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    background: var(--bg-card);
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    transition: transform 0.3s ease-in-out;
}

.slider-slide {
    min-width: 100%;
    height: 100%;
}

.slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 15, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 2;
    transition: var(--transition-fast);
}

.slider-btn:hover {
    background: rgba(10, 10, 15, 0.8);
}

.slider-btn.prev {
    left: var(--space-md);
}

.slider-btn.next {
    right: var(--space-md);
}

.slider-dots {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition-fast);
}

.slider-dot.active {
    background: white;
    transform: scale(1.2);
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.modal-details {
    padding: var(--space-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.modal-category {
    font-size: var(--font-xs);
    color: var(--accent-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.modal-name {
    font-size: var(--font-2xl);
    font-weight: 800;
    line-height: 1.2;
}

.modal-rating {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-price {
    font-size: var(--font-3xl);
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-description {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

.modal-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.modal-features li {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-features li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

.modal-add-btn {
    margin-top: auto;
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-size: var(--font-md);
    font-weight: 700;
    border: none;
    transition: var(--transition-base);
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.modal-add-btn:hover {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-2px);
}

.modal-buy-btn:hover {
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.4);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

/* --- Footer --- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-3xl) var(--space-xl) var(--space-xl);
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-2xl);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.7;
    max-width: 300px;
}

.footer-social {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-base);
}

.social-link:hover {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: white;
}

.footer-column h4 {
    font-size: var(--font-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    padding: var(--space-xs) 0;
    transition: var(--transition-fast);
}

.footer-column a:hover {
    color: var(--text-primary);
    padding-left: var(--space-sm);
}

.footer-bottom {
    max-width: 1400px;
    margin: var(--space-2xl) auto 0;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.newsletter-form {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.newsletter-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-family: var(--font-family);
}

.newsletter-input::placeholder {
    color: var(--text-muted);
}

.newsletter-input:focus {
    border-color: var(--accent-1);
    outline: none;
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    z-index: 5000;
    box-shadow: var(--shadow-lg);
    transform: translateY(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateY(0);
}

.toast-icon {
    font-size: var(--font-xl);
}

.toast-message {
    font-size: var(--font-sm);
    font-weight: 500;
}

/* --- No Results --- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }

    .modal {
        grid-template-columns: 1fr;
        max-height: 90vh;
    }

    .modal-image {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 350px;
    }
}

@media (max-width: 768px) {
    :root {
        --font-5xl: 2.5rem;
        --font-4xl: 2rem;
        --font-3xl: 1.5rem;
    }

    .header-inner {
        padding: var(--space-md);
    }

    .nav-links {
        display: none;
    }

    .search-container {
        max-width: 300px;
    }

    .hero {
        min-height: 420px;
        padding: 7rem var(--space-md) var(--space-2xl);
    }

    .filters-section,
    .products-section {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: var(--space-md);
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .search-container {
        display: none;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* --- Checkout Modal --- */
.checkout-modal {
    grid-template-columns: 1fr;
    max-width: 700px;
    padding: 0;
}

.checkout-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.checkout-header h2 {
    font-size: var(--font-xl);
    font-weight: 700;
}

.checkout-cod-badge {
    background: var(--success);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-header .modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
}

.checkout-form {
    padding: var(--space-xl);
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
}

.checkout-fields h3,
.checkout-summary h3 {
    font-size: var(--font-md);
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: var(--font-xs);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    transition: var(--transition-base);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-1);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkout-summary {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    align-self: flex-start;
}

@media (max-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Two-column form row --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- Checkout select dropdown --- */
.checkout-select {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    transition: var(--transition-base);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a9a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.checkout-select:focus {
    border-color: var(--accent-1);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.checkout-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.checkout-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* --- Delivery Type Toggle --- */
.delivery-type-toggle {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.delivery-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.7rem 1rem;
    background: var(--bg-glass);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.delivery-type-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.delivery-type-btn.active {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--accent-1);
    color: var(--text-primary);
}

.delivery-type-btn .delivery-type-icon {
    font-size: 1.1rem;
}

.delivery-type-hint {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin: 0;
    padding-top: var(--space-xs);
}

/* --- Checkout Fee Summary --- */
.checkout-fee-row {
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkout-fee-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.delivery-fee-line {
    color: var(--accent-3);
    font-weight: 600;
}

.fee-value {
    font-weight: 700;
}

.grand-total-line {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

.grand-total-value {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.1rem;
}

.checkout-fee-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    color: var(--text-muted);
    font-size: var(--font-sm);
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-md);
}

/* --- Checkout Submit Button --- */
.checkout-submit-btn {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-size: var(--font-md);
    font-weight: 700;
    border: none;
    transition: var(--transition-base);
    box-shadow: var(--shadow-glow);
    margin-top: 1.5rem;
    cursor: pointer;
}

.checkout-submit-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-2px);
}

.checkout-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* RTL overrides for new elements */
[dir="rtl"] .checkout-select {
    background-position: left 1rem center;
    padding-right: 1rem;
    padding-left: 2.5rem;
}

[dir="rtl"] .delivery-type-toggle {
    flex-direction: row-reverse;
}

[dir="rtl"] .checkout-fee-line {
    flex-direction: row-reverse;
}

[dir="rtl"] .form-row {
    direction: rtl;
}


/* ==========================================
   LANGUAGE SWITCHER
   ========================================== */
.lang-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: var(--transition-base);
    cursor: pointer;
}

.lang-btn .lang-flag {
    font-size: 1rem;
    line-height: 1;
}

.lang-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-strong);
}

.lang-btn.active {
    background: var(--accent-gradient);
    color: white;
}

/* ==========================================
   RTL (Arabic) LAYOUT
   ========================================== */
[dir="rtl"] {
    font-family: 'Tajawal', sans-serif;
    letter-spacing: 0;
}

[dir="rtl"] .header-inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .search-icon {
    left: auto;
    right: 1rem;
}

[dir="rtl"] .search-bar {
    padding: 0.65rem 2.8rem 0.65rem 1rem;
}

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

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .cart-badge {
    right: auto;
    left: -6px;
}

[dir="rtl"] .hero-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .filters-bar {
    flex-direction: row-reverse;
}

[dir="rtl"] .filter-categories {
    flex-direction: row-reverse;
}

[dir="rtl"] .product-badge {
    left: auto;
    right: var(--space-md);
}

[dir="rtl"] .product-quick-actions {
    right: auto;
    left: var(--space-md);
    transform: translateX(-10px);
}

[dir="rtl"] .product-card:hover .product-quick-actions {
    transform: translateX(0);
}

[dir="rtl"] .product-category,
[dir="rtl"] .product-name,
[dir="rtl"] .modal-category,
[dir="rtl"] .modal-name,
[dir="rtl"] .modal-description {
    text-align: right;
}

[dir="rtl"] .modal-features li {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .modal-image {
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

[dir="rtl"] .modal {
    direction: rtl;
}

[dir="rtl"] .cart-drawer {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
}

[dir="rtl"] .cart-drawer.open {
    transform: translateX(0);
}

[dir="rtl"] .cart-header,
[dir="rtl"] .cart-item,
[dir="rtl"] .cart-subtotal,
[dir="rtl"] .cart-item-controls {
    direction: rtl;
}

[dir="rtl"] .cart-item-name {
    text-align: right;
}

[dir="rtl"] .footer-inner {
    direction: rtl;
}

[dir="rtl"] .footer-brand p,
[dir="rtl"] .footer-column a {
    text-align: right;
}

[dir="rtl"] .footer-column a:hover {
    padding-left: 0;
    padding-right: var(--space-sm);
}

[dir="rtl"] .footer-bottom {
    flex-direction: row-reverse;
}

[dir="rtl"] .checkout-form {
    direction: rtl;
}

[dir="rtl"] .checkout-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .checkout-header .modal-close {
    right: auto;
    left: var(--space-md);
}

[dir="rtl"] .form-group label {
    text-align: right;
}

[dir="rtl"] .toast {
    right: auto;
    left: 2rem;
}

[dir="rtl"] .logo,
[dir="rtl"] .cart-header h2,
[dir="rtl"] .hero-badge,
[dir="rtl"] .lang-switcher,
[dir="rtl"] .product-rating,
[dir="rtl"] .product-price-row,
[dir="rtl"] .modal-rating,
[dir="rtl"] .footer-social {
    flex-direction: row-reverse;
}

[dir="rtl"] .product-price .original-price {
    margin-left: 0;
    margin-right: var(--space-sm);
}

[dir="rtl"] .cart-empty,
[dir="rtl"] .sort-select {
    direction: rtl;
}