:root {
    --primary: #007bff;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light: #f8f9fa;
    --dark: #343a40;
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --text-main: #333;
    --text-muted: #888;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --header-h: 60px;
    --nav-h: 65px;
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}
html {
    /* Prevent the "bounce" effect at top/bottom */
    overscroll-behavior: none;
    /* Allow native document flow */
    height: auto;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-main);
    direction: rtl;
    padding-bottom: calc(var(--nav-h) + 20px);
    transform: none; 
    
    /* FIX: Allow body to grow with content for native sticky behavior */
    min-height: 100vh;
    height: auto;
    position: relative;
    
    /* FIX: Prevent scroll chaining */
    overscroll-behavior-y: none;
    
    /* Remove 'overflow-y: auto' to let the window handle scrolling */
    overflow-x: hidden; 
}

/* Ensure modals still lock the screen properly */
body.modal-open {
    overflow: hidden !important;
    height: 100vh;
    position: fixed;
    width: 100%;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

.full-width {
    width: max(100%, 80vw);
}

.flex-grow {
    flex-grow: 1;
}

.muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

.text-center {
    text-align: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* --- Loader & Toast --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#toast-container {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 12px 20px;
    border-radius: 25px;
    background: #333;
    color: #fff;
    margin-bottom: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: slideDown 0.3s forwards;
    text-align: center;
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

@keyframes slideDown {
    to {
        opacity: 1;
        transform: translateY(10px);
    }
}

/* --- Auth Screen --- */
.auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8); /* Darker overlay */
    backdrop-filter: blur(5px);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Above all other modals */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-wrapper.active {
    display: flex;
    opacity: 1;
}

.auth-card {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.auth-card {
    position: relative; /* For close button positioning */
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.auth-wrapper.active .auth-card {
    transform: translateY(0);
}

/* Close Button for Auth Modal */
.auth-close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 35px;
    height: 35px;
    background: #f1f3f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    font-size: 1.2rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.auth-close-btn:hover {
    background: #e2e6ea;
    transform: scale(1.1);
}

/* Guest Profile State */
.guest-profile-card {
    text-align: center;
    padding: 40px 20px;
}

.guest-icon {
    font-size: 4rem;
    color: #e9ecef;
    margin-bottom: 20px;
}
.store-logo-section {
    margin-bottom: 30px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), #0056b3);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    margin: 0 auto 15px;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.auth-step {
    display: none;
    animation: fadeIn 0.4s;
}

.auth-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group {
    margin-bottom: 15px;
    text-align: right;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-link {
    background: none;
    color: var(--primary);
    text-decoration: none;
    padding: 10px;
    font-size: 0.9rem;
    display: inline-block;
}

/* --- Header --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: #fff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    z-index: 150;
    display: flex;
    align-items: center;
}

.container {
    max-width: 100vw;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-brand h1 {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Welcome Pill with Profile Icon */
.welcome-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary), #0056b3);
    color: white;
    padding: 6px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    max-width: 220px;
    
    /* Animation on load */
    animation: pillSlideIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation-fill-mode: both;
}

@keyframes pillSlideIn {
    0% {
        opacity: 0;
        transform: translateX(30px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.welcome-pill:hover {
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: translateY(-2px);
}

.welcome-pill:active {
    transform: translateY(0);
}

.welcome-pill .pill-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.welcome-pill .pill-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-width: 0;
}

.welcome-pill .welcome-text {
    font-size: 0.7rem;
    opacity: 0.9;
    white-space: nowrap;
    line-height: 1;
}

.welcome-pill .user-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .welcome-pill {
        max-width: 150px;
        padding: 5px 12px 5px 5px;
        gap: 8px;
    }
    
    .welcome-pill .pill-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .welcome-pill .welcome-text {
        font-size: 0.65rem;
    }
    
    .welcome-pill .user-name {
        font-size: 0.8rem;
    }
    
    .header-brand h1 {
        font-size: 1.1rem;
    }
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Language Toggle Button */
.lang-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.lang-toggle-btn:active {
    transform: scale(0.95);
}

.action-icon {
    font-size: 1.4rem;
    color: var(--text-main);
    cursor: pointer;
    position: relative;
    padding: 5px;
}

.cart-wrapper {
    position: relative;
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 2px solid #fff;
}

.main-content {
    margin-top: calc(var(--header-h) + 15px);
    min-height: calc(100vh - var(--header-h) - var(--nav-h));
}

/* --- Banner Container Structure --- */
.banners-container {
    position: relative;
    overflow: hidden;
    direction: ltr; /* Force LTR context for the container */
    border-radius: 25px;
    z-index: 10;
}

.banner-track {
    display: flex;
    flex-direction: row; /* Standard LTR flow */
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    height: 100%;
    width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    
    /* Ensure coordinate system is consistent on iOS */
    direction: ltr !important; 
}

.banners-container::-webkit-scrollbar {
    display: none;
}

/* Dots */
.banner-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px; /* Slightly tighter gap for the morph effect */
    z-index: 20;
    pointer-events: auto;
    
    /* VISUAL MAGIC: This ensures dots contrast automatically */
    mix-blend-mode: difference; 
    
    /* For RTL scroll logic consistency */
    flex-direction: row; 
}

.dot {
    width: 8px;
    height: 8px;
    
    /* PURE WHITE is required for mix-blend-mode: difference to work correctly.
       (White - Dark Background = White)
       (White - Light Background = Black) 
    */
    background-color: #ffffff;
    
    border-radius: 50px; /* Fully rounded pill */
    cursor: pointer;
    
    /* MORPHING MAGIC: Bouncy spring transition */
    transition: width 0.5s cubic-bezier(0.68, -0.6, 0.32, 1.6), 
                opacity 0.3s ease;
                
    opacity: 0.5; /* Dim inactive dots */
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5); /* Slight glow */
}

.dot:hover {
    opacity: 0.8;
    transform: scale(1.1); /* Gentle hover scale */
}


.dot.active {
    opacity: 1;
    width: 28px; /* Expands into a pill shape */
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* --- Banner Arrows (Glass Style & Position Fix) --- */
.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    color: #333;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 20;
    user-select: none;
    transition: all 0.2s ease;
    
    /* Flex Center Content */
    display: none; /* Hidden by default (Mobile) */
    align-items: center;
    justify-content: center;
}

/* Hover Effect */
.banner-arrow:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Positioning & Rotation Logic */

/* The 'Left' class button (Next in RTL) */
.banner-arrow.left {
    left: 15px; 
    right: auto;
    /* By default &#10094; is <. In RTL "Next" goes Left. */
    /* No rotation needed for RTL if we want < on the left side */
}

/* The 'Right' class button (Prev in RTL) */
.banner-arrow.right {
    right: 15px;
    left: auto;
    /* By default &#10095; is >. In RTL "Prev" goes Right. */
}

/* LTR Override (English) */
html[dir="ltr"] .banner-arrow.left {
    right: 15px;
    left: auto;
    /* In LTR, "Next" (scroll 1) goes Right. So we put the Next button on the Right.
       And we rotate the < icon to become > */
    transform: translateY(-50%) rotate(180deg);
}

html[dir="ltr"] .banner-arrow.left:hover {
    transform: translateY(-50%) scale(1.15) rotate(180deg);
}

html[dir="ltr"] .banner-arrow.right {
    left: 15px;
    right: auto;
    /* In LTR, "Prev" (scroll -1) goes Left. We put Prev button on Left.
       And we rotate the > icon to become < */
    transform: translateY(-50%) rotate(180deg);
}

html[dir="ltr"] .banner-arrow.right:hover {
    transform: translateY(-50%) scale(1.15) rotate(180deg);
}

/* Show only on Desktop */
@media (min-width: 769px) {
    .banner-arrow {
        display: flex !important;
    }
}

/* Invisible Touch Zones (Facebook Story Style) */
.banner-touch-zone {
    position: absolute;
    top: 0;
    height: 80%;
    width: 15%;
    z-index: 15;
}

.banner-touch-zone.left {
    left: 0;
}

.banner-touch-zone.right {
    right: 0;
}

/* --- Banner Item Updates --- */
.banner-item {
    flex: 0 0 100%;
    min-width: 100%; /* Force strict 100% width */
    width: 100%;
    
    /* Center alignment fixes the "sliver of next image" issue */
    scroll-snap-align: center; 
    scroll-snap-stop: always;
    aspect-ratio: 2 / 1;
    position: relative;
    user-select: none;
    overflow: hidden;
    padding: 0; 
}

.banner-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%);
    pointer-events: none;
    z-index: 1;
}

.banner-content-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 25px; /* Adjust for mobile safe area */
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Button and text aligned at bottom */
    z-index: 2;
    direction: rtl; 
}

.banner-content-layer h2 {
    color: white;
    /* Responsive font size */
    font-size: clamp(1.2rem, 4vw, 2rem); 
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0,0,0,0.7);
    margin: 0;
    max-width: 65%;
    line-height: 1.3;
    margin-bottom: 5px; /* Spacing from bottom */
}

.sticky-search {
    position: -webkit-sticky;
    position: sticky;
    top: var(--header-h);
    background: rgba(244, 246, 248, 0.95); /* Semi-transparent */
    backdrop-filter: blur(10px); /* Glass effect */
    -webkit-backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: var(--radius);
    z-index: 90;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.5s ease;
}

.sticky-search.is-stuck {
    box-shadow: 0px 15px 30px 0px #00000054;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transform: translatey(15px);
    background: rgb(244 246 248 / 81%);
}

.sticky-sentinel {
    position: absolute; /* Remove from flow to prevent layout shift */
    left: 0;
    right: 0;
    margin-top: -1px; 
    height: 1px;
    width: 100%;
    visibility: hidden;
    pointer-events: none;
}

.search-bar {
    position: relative;
    margin-bottom: 10px;
}

.search-bar input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border-radius: 25px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    background: #fff;
    font-size: 0.95rem;
}

.search-bar i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.category-filters {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 0px 15px 0px; /* Extra bottom padding for shadows */
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: 15px; /* Snap spacing */
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0; /* Prevent squishing */
}

.filter-pill span.count {
    background: #f1f3f5;
    color: #666;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    transition: all 0.3s;
}

.filter-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: scale(1.05);
}
.filter-pill.active span.count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.filter-pill:active {
    transform: scale(0.95);
}

/* --- Staggered Grid Animation --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card.anim-enter {
    animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0; /* Start hidden */
}

/* Stagger delays (up to 10 items) */
.product-card.anim-enter:nth-child(1) { animation-delay: 0.05s; }
.product-card.anim-enter:nth-child(2) { animation-delay: 0.1s; }
.product-card.anim-enter:nth-child(3) { animation-delay: 0.15s; }
.product-card.anim-enter:nth-child(4) { animation-delay: 0.2s; }
.product-card.anim-enter:nth-child(5) { animation-delay: 0.25s; }
.product-card.anim-enter:nth-child(6) { animation-delay: 0.3s; }
.product-card.anim-enter:nth-child(n+7) { animation-delay: 0.35s; }
/* --- Product Cards --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0 15px;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.horizontal-scroll-grid {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px;
    scroll-snap-type: x mandatory;
}

.horizontal-scroll-grid .product-card {
    min-width: 150px;
    width: 160px;
    scroll-snap-align: start;
}

.product-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 5px;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s;
}

.product-card:active {
    transform: scale(0.98);
}


.prod-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in;
    display: block;
    position: relative;
    z-index: 2;
    /* FIX: Center object position by default */
    object-position: center; 
}



.prod-img[loading] {
    opacity: 0;
}

.prod-img.loaded {
    opacity: 1;
}

.offer-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    z-index: 2;
}

.wishlist-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
}

.wishlist-btn i {
    color: #ccc;
    font-size: 1.1rem;
    transition: 0.2s;
}

.wishlist-btn.active i {
    color: var(--danger);
    font-weight: 900;
}

.prod-info {
    padding: 10px;
}

.prod-name {
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prod-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

.prod-old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.8em;
    margin-right: 5px;
}

/* --- Bottom Navigation --- */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffffc7;
    height: var(--nav-h);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.05);
    z-index: 90;
    padding-bottom: var(--safe-area-bottom);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #999;
    font-size: 0.7rem;
    gap: 4px;
}

.nav-tab i {
    font-size: 1.3rem;
    transition: transform 0.2s;
}

.nav-tab.active {
    color: var(--primary);
    font-weight: bold;
}

.nav-tab.active i {
    transform: translateY(-2px);
}

/* Floating Middle Button */
.nav-tab.middle-fab {
    position: relative;
    top: -25px;
    background: linear-gradient(135deg, var(--primary), #0056b3);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    flex: none;
}

.nav-tab.middle-fab i {
    font-size: 1.5rem;
    color: white;
}

/* --- Desktop Nav Override --- */
.desktop-nav {
    display: none;
    gap: 25px;
}

.nav-link {
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px;
    cursor: pointer;
}

.nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none;
    }

    .desktop-nav {
        display: flex;
    }

    .main-content {
        padding-bottom: 40px;
    }

    .container {
        max-width: 85vw;
        padding: 0 40px;
    }

    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .horizontal-scroll-grid .product-card {
        width: 220px;
    }

    .banner-item {
        aspect-ratio: 2.5 / 1; /* Slightly wider on desktop to save vertical space */
        border-radius: 0;
    }

}

/* --- Cart Drawer --- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.cart-overlay.active {
    display: block;
    opacity: 1;
}

.cart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: #fff;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    overflow: auto;
}

.cart-drawer.open {
    transform: translateX(0);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #333;
}

.cart-body {
    scroll-behavior: smooth;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.checkout-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

.checkout-header:hover {
    background: #e9ecef;
}

.checkout-header i {
    color: var(--primary);
}

.shipping-progress-container {
    background: #f0f7ff;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.shipping-text {
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-align: center;
    color: var(--primary);
    font-weight: 600;
}

.progress-track {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.5s ease;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-img {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.cart-item-variant {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cart-item-price {
    color: var(--primary);
    font-weight: 700;
    margin-top: 5px;
}

.qty-control-sm {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
    width: fit-content;
}

.qty-control-sm button {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    color: #333;
    background: none;
}

.qty-control-sm span {
    width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.remove-btn {
    font-size: 0.8rem;
    color: var(--danger);
    background-color: #ff000043;
    padding: 5px;
    border-radius: 6px;
    text-decoration: underline;
    margin-left: auto;
}

.cart-recommendations {
    padding: 15px;
    background: #f9f9f9;
    border-top: 1px solid var(--border-color);
}

.rec-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.rec-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.rec-card {
    min-width: 130px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
}

.rec-img {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    background-color: #eee;
    background-size: cover;
    margin-bottom: 5px;
}

.rec-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rec-price {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary);
    margin: 4px 0;
}

.btn-add-rec {
    width: 100%;
    padding: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--primary);
    color: var(--primary);
    background: #fff;
    border-radius: 4px;
}

.cart-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 800;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    margin-bottom: 15px;
}

/* --- Checkout --- */
.delivery-toggle-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.delivery-option {
    flex: 1;
    cursor: pointer;
}

.delivery-option input {
    display: none;
}

.option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    transition: 0.2s;
    height: 100%;
}

.option-box i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.delivery-option input:checked+.option-box {
    border-color: var(--primary);
    background-color: #f0f7ff;
    color: var(--primary);
    font-weight: bold;
}

.checkout-section {
    animation: fadeIn 0.3s ease;
    margin-bottom: 20px;
    margin-top: 5px;
}

.form-section-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.alert-box {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
}

.wallet-number {
    display: inline-block;
    background: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px dashed var(--primary);
    color: var(--primary);
    margin: 10px 0;
    font-size: 1.1rem;
    cursor: pointer;
}

.file-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    position: relative;
    background: #fdfdfd;
    cursor: pointer;
}

.file-drop-area:hover {
    border-color: var(--primary);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.img-preview img {
    max-height: 100px;
    margin-top: 10px;
    border-radius: 8px;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0fff4;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* --- Product Detail Modal --- */
.product-dialog {
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
}

@media (min-width: 769px) {
    .product-dialog {
        border-radius: 15px;
    }
}

.modal-img {
    width: 100%;
    height: 280px;
    background: #f8f8f8;
    border-radius: 12px;
    margin-bottom: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.variant-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.chip {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.chip.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.modal-actions-bar {
    display: flex;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.qty-control {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.qty-control button {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    background: none;
}

.qty-control span {
    width: 35px;
    text-align: center;
    font-weight: bold;
}

/* --- Empty States & Success --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 15px;
    color: #e9ecef;
}

.success-animation {
    font-size: 5rem;
    color: var(--success);
    margin: 40px 0 20px;
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Skeleton */
.skeleton {
    background-color: #e0e0e0;
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200px 100%;
    /* Fixed width highlight for consistency */
    background-repeat: no-repeat;
    animation: skeleton-shine 1.5s infinite linear;
    border-radius: var(--radius);
}

@keyframes skeleton-shine {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(100% + 200px) 0;
    }
}

.skeleton-banner {
    width: 100%;
    height: 160px;
    margin-bottom: 20px;
}

.skeleton-card {
    width: 100%;
    height: 220px;
    border-radius: var(--radius);
}

/* States */
.page-view {
    display: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.page-view.active {
    display: block;
    opacity: 1;
}

.profile-header-card {
    padding: 30px;
    text-align: center;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    background: #e9ecef;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    color: #adb5bd;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    color: var(--text-main);
    text-decoration: none;
    align-items: center;
}

.menu-item:hover {
    background: #f8f9fa;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 0 15px;
}

.request-container {
    max-width: 600px;
    margin: 0 auto;
}

.order-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.order-card.status-pending {
    border-color: var(--warning);
}

.order-card.status-delivered {
    border-color: var(--success);
}

/* =========================
   MODAL FIXES
   ========================= */

/* The Background Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    /* High z-index to sit on top of everything */
    display: none;
    /* Hidden by default */
    align-items: flex-end;
    /* Mobile: slide up from bottom */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

/* Desktop Alignment */
@media (min-width: 769px) {
    .modal-overlay {
        align-items: center;
        /* Desktop: center screen */
    }
}

/* Active State (Triggered by JS) */
.modal-overlay.active {
    display: flex !important;
    /* Force flex when active */
    opacity: 1;
}

/* The White Box Content */
.modal-box {
    background: #fff;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Critical for absolute children */
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for modal */
.modal-box::-webkit-scrollbar {
    width: 8px;
}

.modal-box::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}

.modal-box::-webkit-scrollbar-thumb {
    background-color: #d1d9e6;
    border-radius: 4px;
}

.modal-box::-webkit-scrollbar-thumb:hover {
    background-color: #a0aec0;
}

@media (min-width: 769px) {
    .modal-box {
        border-radius: 20px;
        /* Fully rounded on desktop */
        transform: translateY(20px) scale(0.95);
        /* Desktop animation start */
    }
}

/* Animation End State */
.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}

/* Modal Internal Elements */
.close-modal-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    /* RTL Context: Left side is correct */
    width: 32px;
    height: 32px;
    background: #f1f3f5;
    border-radius: 50%;
    font-size: 1.2rem;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    border: 1px solid #e9ecef;
}

.close-modal-btn:hover {
    background: #e2e6ea;
}

.modal-img {
    width: 100%;
    height: 250px;
    background-color: #f8f9fa;
    border-radius: 16px;
    margin-bottom: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid var(--border-color);
}

/* Variant Selection */
.variant-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0 25px;
}

.chip {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.chip.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

/* Bottom Action Bar */
.modal-actions-bar {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    /* Pushes to bottom if flex column */
}

.qty-control {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.qty-control button {
    width: 45px;
    height: 45px;
    background: transparent;
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
}

.qty-control button:active {
    background: #e9ecef;
}

.qty-control span {
    width: 40px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* =========================================
   DESKTOP FLOATING PILL NAVIGATION
   ========================================= */

@media (min-width: 769px) {

    /* 1. Hide the old header text links */
    .desktop-nav {
        display: none !important;
    }

    /* 2. Transform the Bottom Nav into a Floating Pill */
    .mobile-bottom-nav {
        display: flex !important;
        /* Force visible on PC */

        /* Positioning & Sizing */
        width: auto;
        min-width: 380px;
        /* Minimal width for aesthetics */
        max-width: 600px;
        height: 65px;

        /* Floating Logic */
        position: fixed;
        bottom: 25px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);

        /* Pill Appearance */
        border-radius: 50px;
        background: rgba(255, 255, 255, 0.695);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        /* Glassmorphism */
        border: 1px solid rgba(255, 255, 255, 0.4);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);

        /* Layout Reset */
        padding: 0 20px;
        padding-bottom: 0;
        /* Reset mobile safe-area padding */
        gap: 10px;
        z-index: 1000;
        transition: all 0.3s ease;
    }

    /* Hover Lift Effect */
    .mobile-bottom-nav:hover {
        bottom: 30px;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    }

    /* 3. Style Individual Tabs for PC */
    .nav-tab {
        flex-direction: row;
        /* Icon next to Text */
        gap: 8px;
        padding: 8px 15px;
        border-radius: 30px;
        transition: background 0.2s ease, transform 0.2s;
    }

    .nav-tab:hover {
        background-color: #f1f3f5;
        transform: translateY(-2px);
    }

    .nav-tab.active {
        background-color: #e7f5ff;
        /* Light blue background for active */
        color: var(--primary);
    }

    .nav-tab span {
        font-size: 0.9rem;
        font-weight: bold;
        display: block;
        /* Ensure text is shown */
    }

    .nav-tab i {
        font-size: 1.2rem;
        margin-bottom: 0;
        /* Reset margin */
    }

    /* 4. Fix the Middle FAB (Magic Wand) for Pill Shape */
    .nav-tab.middle-fab {
        top: 0;
        /* Reset the pop-up offset */
        width: 45px;
        height: 45px;
        margin: 0 10px;
        border-radius: 12px;
        /* Squircle instead of full circle */
        background: var(--primary);
        box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
    }

    .nav-tab.middle-fab:hover {
        background: #0056b3;
        transform: scale(1.05);
    }

    /* Ensure main content has padding so it doesn't get covered */
    .main-content {
        padding-bottom: 0px;
    }
}

/* FORCE VISIBILITY: As soon as the browser has a src that isn't empty, show it */
.prod-img[src]:not([src=""]) {
    opacity: 1 !important;
}

/* Ensure the wrapper loses the gray background if the child image is visible */
.prod-img-wrap:has(.prod-img[src]:not([src=""])) {
    background-color: transparent;
}

/* Fallback for browsers not supporting :has */
.prod-img.loaded+.skeleton,
.prod-img[src]:not([src=""]) {
    opacity: 1;
}

/* Ensure skeleton animation is visible */
.prod-img-wrap.skeleton {
    background-color: #e0e0e0;
}

/* --- Product Card & Images --- */

/* The Container */
.prod-img-wrap {
    position: relative;
    overflow: hidden;
    background-color: #e0e0e0;
    /* Skeleton Base Color */
    border-radius: var(--radius);
    transition: background-color 0.3s ease-out;
    /* Smooth fade out of gray */
}

.product-card .prod-img-wrap {
    aspect-ratio: 1 / 1;
}
.product-card .prod-img-wrap img {
    aspect-ratio: 1 / 1;
}

.prod-img-wrap.loaded {
    background-color: transparent !important;
}



.prod-img.reveal {
    opacity: 1 !important;
}

/* When Wrapper is Loaded -> Show Image */
.prod-img-wrap.loaded .prod-img {
    opacity: 1;
    pointer-events: none;

}

/* Skeleton Animation (Only visible if wrapper has .skeleton class) */
.prod-img-wrap.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
    z-index: 1;
}


/* Remove Skeleton Effect once loaded */
.prod-img-wrap.loaded::after {
    display: none;
    animation: none;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

img[src]:not([src=""]) {
    opacity: 1 !important;
    transition: opacity 0.3s ease-in-out;
}

/* Ensure container has background while loading */

/* Fix z-index so button text is clickable */
.product-card button {
    position: relative;
    z-index: 5;
    border-radius: 10px;
}



/* --- Offer & Bundle Distinction --- */

.product-card.is-offer {
    border: 1px solid #ffeeba;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.15);
}

.product-card.is-bundle {
    border: 1px solid #e0cffc;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.15);
    border-radius: 10px;
}

.badge-save {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    /* Red */
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 800;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3);
}

.badge-bundle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6f42c1;
    /* Purple */
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 800;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(111, 66, 193, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-view-offer {
    background-color: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    font-weight: 700;
}

.btn-view-offer:hover {
    background-color: #f0f7ff;
}

.product-card.is-bundle .btn-view-offer {
    color: #6f42c1;
    border-color: #6f42c1;
    border-radius: 10px;
}

.product-card.is-bundle .btn-view-offer:hover {
    background-color: #f3eaff;
}

.prod-price .original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.8em;
    margin-right: 5px;
    font-weight: normal;
}



/* =========================================
   SCROLLABLE CARD SIZE FIXES
   ========================================= */

/* Override specific container styles */
.snap-scroll-container .product-card {
    /* Fixed compact width for mobile */
    min-width: 170px;
    width: 170px;

    /* Align cards to the start so you can see multiple */
    scroll-snap-align: start;

    /* Reset margins */
    margin: 0;
    flex-shrink: 0;
}

/* Fix image height in horizontal scrolls to be compact */
.snap-scroll-container .prod-img-wrap {
    height: 170px;
    /* Square aspect relative to card width */
    min-height: 170px;
}

/* Adjust text size for compact cards */
.snap-scroll-container .prod-name {
    font-size: 0.85rem;
    white-space: normal;
    /* Allow text wrapping */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Max 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.4em;
    /* Enforce height for alignment */
    line-height: 1.2;
}

.snap-scroll-container .prod-price {
    font-size: 0.95rem;
    margin-top: 5px;
}

/* Bundle Specific overrides in scroll view */
.snap-scroll-container .product-card.is-bundle {
    min-width: 200px;
    /* Bundles slightly wider */
    width: 200px;
}

.snap-scroll-container .product-card.is-bundle .prod-img-wrap {
    height: 140px;
    /* Landscape-ish for bundles */
}

/* Desktop Adjustments */
@media (min-width: 769px) {
    .snap-scroll-container .product-card {
        min-width: 220px;
        width: 220px;
    }

    .snap-scroll-container .prod-img-wrap {
        height: 220px;
    }

    .snap-scroll-container .product-card.is-bundle {
        min-width: 195px;
        width: 195px;
        height: 100%;
    }

    .snap-scroll-container .product-card.is-bundle .prod-img-wrap {
        height: 180px;
    }
}

/* --- Bundle Content (Masonry/Collage) --- */
.bundle-collage-title {
    font-weight: 700;
    margin: 20px 0 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.bundle-collage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.bundle-item-card {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.bundle-item-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    background-color: #fff;
}

.bundle-item-info {
    padding: 5px;
    font-size: 0.75rem;
}

.bundle-item-qty {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2px;
}

/* --- Banner CTA --- */
.banner-item {
    position: relative;
}

.banner-cta {
    background: #fff;
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    white-space: nowrap;
    height: fit-content;
}

.banner-cta:hover {
    transform: scale(1.05);
}
/* Mobile Adjustments */
@media (max-width: 480px) {
    .banner-content-layer {
        padding: 15px;
        align-items: flex-end;
    }
    .banner-cta {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    .banner-content-layer h2 {
        font-size: 1.1rem;
    }
   
}

.banner-cta i {
    margin-right: 5px;
    color: var(--primary);
}

/* --- Drag Scroll Physics --- */
.drag-scroll {
    cursor: grab;
    user-select: none;
    /* Prevent text selection while dragging */
}

.drag-scroll:active {
    cursor: grabbing;
}

/* --- Show All Grid Transformation --- */
.snap-scroll-container.full-grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Mobile default */
    gap: 15px;
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 0;
}

.snap-scroll-container.full-grid-view .product-card {
    min-width: auto;
    width: 100%;
    place-items: center;
}

.snap-scroll-container.full-grid-view .prod-img-wrap {
    height: auto;
}

/* Desktop Grid Override */
@media (min-width: 769px) {
    .snap-scroll-container.full-grid-view {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Improved Smooth Scroll & Drag --- */

.snap-scroll-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
    position: relative;
    margin-right: 20px;
}

.snap-scroll-container::-webkit-scrollbar {
    display: none;
}

/* While Dragging (Added by JS) */
.snap-scroll-container.active {
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
    cursor: grabbing;
}

/* Card Sizing */
.snap-scroll-container .product-card {
    min-width: 170px;
    width: 170px;
    scroll-snap-align: start;
    flex-shrink: 0;
    margin: 0;
}

@media (min-width: 769px) {
    .snap-scroll-container .product-card {
        min-width: 220px;
        width: 220px;
    }

    /* When expanded to grid */
    .snap-scroll-container.full-grid-view {
        scroll-snap-type: none;
        overflow-x: hidden;
        cursor: default;
    }
}

#payment-methods-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#payment-methods-container .delivery-option {
    min-width: 45%;
}

@media (min-width: 480px) {
    #payment-methods-container .delivery-option {
        min-width: 30%;
    }
}

/* --- Skeleton --- */
.skeleton-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-h);
}

.skeleton-header {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0 15px;
    display: flex;
    align-items: center;
}

.skeleton-content {
    padding-top: 20px;
}

.skeleton-brand {
    width: 100px;
    height: 20px;
    border-radius: 4px;
}

.skeleton-banner {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.skeleton-card {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    background: #fff;
}

.skeleton-pulse {
    background-color: #e0e0e0;
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
}

.welcome-message-container {
    text-align: center;
    margin-bottom: 20px;
    animation: fadeIn 0.5s;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.snap-scroll-container.active,
.banners-container.active {
    scroll-behavior: auto !important;
    scroll-snap-type: none !important;
    cursor: grabbing;
}

.offer-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    /* Red color for offers */
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Container must be relative for absolute children */
.snap-scroll-container,
.banners-container {
    position: relative;
}

/* Remove direct Spacer styling if present */
.scroll-spacer {
    display: none;
}

/* Left Fade (Indicates more content in RTL) */
.snap-scroll-container::after {
    content: "";
    position: sticky;
    /* Sticky ensures it stays at edge of viewport relative to parent */
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, var(--bg-color), transparent);
    z-index: 5;
    pointer-events: none;
    opacity: 0.8;
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

/* Ensure padding so last item isn't covered */
.snap-scroll-container {

}

/* Stock Badges */
.stock-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    /* Opposite to offer badge */
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stock-badge.low {
    background: #ffc107;
    color: #333;
    border: 1px solid #e0a800;
}

.stock-badge.out {
    background: #343a40;
    color: #fff;
    border: 1px solid #000;
}

/* Modal Stock Display */
.modal-stock-info {
    text-align: center;
    margin: 5px 0 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: #d39e00;
}

.text-success {
    color: var(--success);
}

/* Request Button State */
.btn-request {
    background-color: #6c757d;
    color: white;
        border-radius: var(--radius);
        width: 100%;
}

.btn-request:hover {
    background-color: #5a6268;
}

/* Dim Out of Stock Cards slightly */
.product-card.is-oos .prod-img {
    filter: grayscale(0.8);
    opacity: 0.6;
}

/* --- Desktop Scroll Enhancements --- */

/* Wrapper to position arrows relative to the list */
.scroll-wrapper {
    position: relative;
    width: 100%;
}

/* The Grid/List itself */
.snap-scroll-container {
    scroll-behavior: smooth;
    /* Native smooth scroll */
}

/* Navigation Buttons (Hidden on Mobile) */
.scroll-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--primary);
    font-size: 1.2rem;
    display: none;
    /* Hidden by default (mobile) */
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    /* Hidden until hover */
}

/* Hover effects */
.scroll-wrapper:hover .scroll-nav-btn {
    opacity: 1;
}

.scroll-nav-btn:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.scroll-nav-btn.left {
    left: -15px;
    /* Pull slightly outside container */
}

.scroll-nav-btn.right {
    right: -15px;
}

/* Desktop Only Rules */
@media (min-width: 769px) {
    .scroll-nav-btn {
        display: flex;
        /* Show buttons on PC */
    }

    /* Custom Slim Scrollbar for PC */
    .snap-scroll-container::-webkit-scrollbar {
        display: block;
        /* Override the 'display: none' from mobile styles */
        height: 8px;
        /* Thin height */
    }

    .snap-scroll-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .snap-scroll-container::-webkit-scrollbar-thumb {
        background-color: #d1d9e6;
        border-radius: 4px;
    }

    .snap-scroll-container::-webkit-scrollbar-thumb:hover {
        background-color: #a0aec0;
    }
}

/* Add this to your existing .scroll-nav-btn styles */

.scroll-nav-btn.hidden-arrow {
    opacity: 0 !important;
    pointer-events: none !important;
    cursor: default;
}

.alert-box.status-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.alert-box.status-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* --- Tracking Stepper --- */
.track-stepper {
    display: flex;
    justify-content: space-between;
    margin: 20px 0 30px;
    position: relative;
    padding: 0 10px;
}

.track-line-bg {
    position: absolute;
    top: 15px;
    right: 10%;
    /* Changed from left to right for RTL */
    left: auto;
    width: 80%;
    height: 3px;
    background: #e9ecef;
    z-index: 1;
}

.track-line-fill {
    position: absolute;
    top: 15px;
    right: 10%;
    /* Changed from left to right for RTL */
    left: auto;
    height: 3px;
    background: var(--success);
    z-index: 1;
    transition: width 0.5s ease;
}

.track-step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 25%;
}

.step-icon {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #ccc;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.step-label {
    font-size: 0.75rem;
    color: #999;
    text-align: center;
    font-weight: 500;
}

.track-step.active .step-icon {
    border-color: var(--primary);
    color: var(--primary);
    background: #e7f5ff;
    transform: scale(1.1);
}

.track-step.active .step-label {
    color: var(--primary);
    font-weight: bold;
}

.track-step.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.order-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.meta-item label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.meta-item span {
    font-weight: bold;
    font-size: 0.9rem;
}

/* Order Status Badges in List */
.badge-pending {
    background-color: var(--warning);
    color: #333;
}

.badge-danger {
    background-color: var(--danger);
    color: white;
}

.badge-default {
    background-color: var(--secondary);
    color: white;
}

/* Ensure modal list is scrollable */
.modal-body.scrollable {
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Smoothly hide sections */
.hidden {
    display: none !important;
}

/* Ensure the grid takes up full width when filtered */
.page-view.active {
    animation: fadeIn 0.3s ease-out;
}

/* --- Filter & Sort UI --- */

/* The Filter Icon Button next to pills */
.btn-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Space between icon and text */
    padding: 8px 16px;
    border-radius: 20px; /* Pill shape */
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-left: 5px;
    transition: all 0.2s ease;
}

.btn-filter-icon:hover {
    background-color: #f8f9fa;
    border-color: #ced4da;
}

.btn-filter-icon.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.btn-filter-icon i {
    font-size: 1rem;
}

/* Filter Modal (Bottom Sheet Style) */
.filter-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 2100; /* Above everything */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-modal.open {
    transform: translateY(0);
}

.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.filter-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Filter Section Headers */
.filter-section-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

/* Sort Options Grid */
.sort-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sort-radio {
    display: none;
}

.sort-label {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.sort-radio:checked + .sort-label {
    background-color: #e7f5ff;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: bold;
}

/* Price Range Inputs */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-inputs input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}

.price-separator {
    font-weight: bold;
    color: var(--text-muted);
}

/* Modal Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Active Filter Tags (Removable) */
.active-filter-tag {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #90caf9;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.active-filter-tag:hover {
    background-color: #bbdefb;
    border-color: #64b5f6;
}

.active-filter-tag i {
    font-size: 0.8rem;
    color: #0d47a1;
    opacity: 0.7;
}

.active-filter-tag:hover i {
    opacity: 1;
    color: #d32f2f; /* Red X on hover */
}

/* Vertical Separator line in filter bar */
.filter-separator {
    width: 1px;
    background-color: #dee2e6;
    margin: 5px 2px;
    flex-shrink: 0;
}

/* --- Search Bar Enhancements --- */

/* Position the Clear 'X' Button on the LEFT (since RTL) */
.search-bar .clear-search-btn {
    position: absolute;
    left: 15px; /* Opposite to the search icon */
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    display: none; /* Hidden by default */
    z-index: 10;
    transition: color 0.2s;
}

.search-bar .clear-search-btn:hover {
    color: var(--danger);
}

.search-bar .clear-search-btn.visible {
    display: block;
}

/* Adjust input padding so text doesn't hit the X button */
.search-bar input {
    padding-left: 40px; /* Make room for X button */
}

/* --- Header Reset Button Styling --- */
.btn-reset-view {
    /* Push to left in RTL flex container */
    margin-right: auto; 
    margin-left: 0;
    
    /* Visual Style */
    background-color: #e7f5ff;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0, 123, 255, 0.2);
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-reset-view:hover {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
    transform: translateY(-2px);
}

.btn-reset-view i {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.btn-reset-view:hover i {
    transform: translateX(3px); /* Move arrow slightly */
}

/* --- Double-Sided Scroll Fade & Spacer --- */

.scroll-wrapper {
    position: relative;
    z-index: 1;
    /* Ensure the wrapper doesn't clip the buttons */
    overflow: visible; 
}

/* Base Fade Style */
.scroll-wrapper::before,
.scroll-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    pointer-events: none;
    z-index: 20; /* Below buttons (30), Above content (1) */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
    border-radius: var(--radius);
}

/* Right Fade (Start of List in RTL) */
.scroll-wrapper::before {
    background: linear-gradient(to left, var(--bg-color), transparent);
}

/* Left Fade (End of List in RTL) */
.scroll-wrapper::after {
    left: 0;
    background: linear-gradient(to right, var(--bg-color), transparent);
}

/* Dynamic Visibility Classes (Added by JS) */
.scroll-wrapper.can-scroll-right::before {
    opacity: 1;
}

.scroll-wrapper.can-scroll-left::after {
    opacity: 1;
}

/* Buttons */
.scroll-nav-btn {
    z-index: 30 !important; /* Always on top */
}

/* Desktop Adjustments */
@media (min-width: 769px) {
    .scroll-wrapper {
        margin-left: 0;
        margin-right: 0;
    }
    /* Position buttons slightly outside */
    .scroll-nav-btn.left { left: -20px; }
    .scroll-nav-btn.right { right: -20px; }
}

.search-bar {
    position: relative;
    z-index: 101;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    padding: 10px;
    display: none;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.active {
    display: block;
}

.suggestion-group {
    margin-bottom: 10px;
}

.suggestion-header {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-inline: 25px;
}

.search-chip {
    background: #f1f3f5;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-chip:hover {
    background: #e9ecef;
}

.search-chip i {
    font-size: 0.8rem;
    color: #999;
}

.suggestion-row {
    padding: 10px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.suggestion-row:last-child {
    border-bottom: none;
}

.suggestion-row:hover {
    background-color: #f8f9fa;
}

.suggestion-row i {
    color: #ccc;
    font-size: 0.8rem;
}

.suggestion-highlight {
    font-weight: bold;
    color: var(--primary);
}

.suggestion-img {
    width: 35px;
    height: 35px;
    object-fit: cover;
    border-radius: 6px;
    background-color: #f0f0f0;
    border: 1px solid var(--border-color);
}

.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000; /* Highest z-index */
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px; /* Constraints image so it's not fully edge-to-edge */
}

.image-preview-overlay.active {
    display: flex;
    opacity: 1;
}

.preview-content {
    position: relative;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    line-height: 0; /* Removes bottom spacing for img */
}

#preview-full-img {
    max-width: 100%;
    max-height: 85vh; /* Keep within view */
    object-fit: contain;
    display: block;
    background-color: #fff; /* White bg for transparent product PNGs */
}

.watermark-logo {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 60px; /* Small watermark */
    height: 60px;
    object-fit: contain;
    opacity: 0.4; /* Semi-transparent */
    pointer-events: none; /* Let clicks pass through */
    filter: grayscale(100%); /* Subtle look */
}

.close-preview-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 2rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    z-index: 20001;
}

.close-preview-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.zoom-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10 !important; 
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.zoom-btn:hover {
    background: #fff;
    transform: scale(1.1);
    color: var(--primary);
}

.zoom-btn i {
    color: #555;
    font-size: 0.9rem;
    pointer-events: none;
}

.zoom-btn:hover i {
    color: var(--primary);
}

/* Style for the expand icon inside the Product Modal image */
.modal-img-expand-icon {
    position: absolute;
    bottom: 15px;
    left: 15px; /* Opposite to Share button */
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    pointer-events: none; /* Let clicks pass to the parent div */
    backdrop-filter: blur(4px);
    transition: transform 0.2s;
}

.modal-img:hover .modal-img-expand-icon {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.7);
}

/* Ensure the modal image container is clickable */
.modal-img {
    cursor: zoom-in;
    position: relative;
}

.auth-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin: 0 auto 15px;
    display: block;
    border-radius: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.header-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
    border-radius: 6px;
}

/* Helper to hide elements */
.hidden {
    display: none !important;
}

.small-header-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    font-weight: bold;
    white-space: nowrap;
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.small-header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.4);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cart-actions {
    margin-inline: 20px;
}

.variant-count-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.variant-count-badge i {
    font-size: 0.6rem;
}

/* Ensure transition for image switching in modal */
.modal-img {
    transition: background-image 0.3s ease-in-out;
}

/* --- Modal Gallery Styles --- */
.modal-gallery-container {
    position: relative;
    width: 100%;
    height: 320px; /* Fixed height for consistency */
    background-color: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.modal-gallery-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.modal-gallery-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.modal-gallery-item {
    min-width: 100%;
    height: 100%;
    scroll-snap-align: center;
    position: relative;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: zoom-in;
}

/* Dots Indicator */
.gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
    pointer-events: none;
}

.gallery-dot {
    width: 6px;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transition: all 0.3s;
}

.gallery-dot.active {
    background: var(--primary);
    width: 12px;
    border-radius: 6px;
}

/* Position floating buttons inside the gallery container */
.modal-gallery-container .close-modal-btn {
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.modal-gallery-container .modal-img-expand-icon {
    bottom: 10px;
    left: 10px;
}

/* --- Product Card Slideshow --- */
.prod-img-slider {
    display: flex;
    height: 100%;
    width: 100%;
    direction: ltr; 
    position: relative;
    will-change: transform;
}

/* Pause on hover */
.product-card:hover .prod-img-slider {
    animation-play-state: paused;
}

.prod-img-slider .prod-img {
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
    outline: none;
    flex-shrink: 0; /* Important for RTL flex */
}

/* 2 Images */
.slider-2 { width: 200%; }
.slider-2 .prod-img { width: 50%; }

/* 3 Images */
.slider-3 { width: 300%; }
.slider-3 .prod-img { width: 33.333%; }

/* 4 Images */
.slider-4 { width: 400%; }
.slider-4 .prod-img { width: 25%; }

/* 5 Images */
.slider-5 { width: 500%; }
.slider-5 .prod-img { width: 20%; }

/* --- Bundle Collage Slide Styles --- */

/* Allow any child (img or div) to act as a slide */
.prod-img-slider > * {
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
    outline: none;
}

/* 2x2 Grid for Bundle Items */
.bundle-card-collage {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1px; /* Tiny gap for visual separation */
    background-color: #eee;
    overflow: hidden;
    padding: 5px;
    border-radius: var(--radius);
}

.bundle-card-collage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Specific logic for 3 items: Make first item take full height */
.bundle-card-collage.items-3 img:first-child {
    grid-row: span 2;
}

/* Specific logic for 1 item (fallback): Fill whole space */
.bundle-card-collage.items-1 {
    display: block; 
}
.bundle-card-collage.items-1 img {
    width: 100%;
    height: 100%;
}
/* Fix for 2 items: Side-by-Side (1 Row, 2 Columns) */
.bundle-card-collage.items-2 {
    grid-template-rows: 1fr; /* Override default 1fr 1fr */
    grid-template-columns: 1fr 1fr;
}

/* Update positioning for badges to sit on the card container */
.product-card .stock-badge,
.product-card .offer-tag,
.product-card .badge-save {
    position: absolute;
    z-index: 20; /* Ensure it sits above the image slider */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Enhanced shadow for visibility */
}

/* Position Stock Badge (Top Left) */
.product-card .stock-badge {
    top: 10px;
    left: 10px;
    right: auto;
}

/* Position Offer/Bundle Tag (Top Right) */
.product-card .offer-tag {
    top: 10px;
    right: 10px;
    left: auto;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 800;
}

/* Savings Badge (Bottom Right of Image area, but relative to card) */
/* We keep savings on image usually, but if moved to card, we adjust top */
.product-card .badge-save {
    top: 45px; /* Below the offer tag */
    right: 10px;
    left: auto;
}



.snap-scroll-container .product-card.is-bundle {
    place-items: center;
    
}

.snap-scroll-container .product-card.is-bundle .prod-img-wrap{
    margin-block: 5px;
}

/* --- Product Card Icons & Badges (Card Level) --- */

.product-card {
    position: relative;
    overflow: hidden;
    isolation: isolate; /* Creates stacking context */
}
.product-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s;
    /* FIX: Flex layout ensures children stretch correctly */
    display: flex;
    flex-direction: column;
    /* FIX: Overflow hidden ensures image doesn't bleed out rounded corners on iOS */
    overflow: hidden; 
}
/* 1. Wishlist (Top Left) */
.product-card .wishlist-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.product-card .wishlist-btn.active {
    background: #fff0f0;
    border-color: #ffcccc;
}

.product-card .wishlist-btn.active i {
    color: var(--danger);
    font-weight: 900;
}

/* 2. Zoom/Expand (Bottom Right of Image Area) */
.product-card .zoom-btn {
    position: absolute;
    /* Mobile Image Height is approx 170px. Button size 32px. Padding 10px. */
    top: 138px; 
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

/* Desktop Adjustment for Taller Images */
@media (min-width: 769px) {
    .product-card .zoom-btn {
        top: 178px; /* Desktop Image Height is approx 220px */
    }
}

/* 3. Badges (Top Right Stack) */
.product-card .stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    z-index: 25;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.product-card .offer-tag {
    position: absolute;
    top: 38px; /* Stacked below stock badge */
    right: 10px;
    left: auto;
    z-index: 24;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Savings Badge (Bottom Left of Image) */
.product-card .badge-save {
    position: absolute;
    top: 10px; 
    right: 10px;
    z-index: 25;
}
@media (min-width: 769px) {
    .product-card .badge-save {
        top: 15px;
    }
}




.wishlist-btn:hover, .zoom-btn:hover {
    transform: scale(1.1);
    background: #fff;
    color: var(--primary);
}

/* --- Product Card Positioning Fix --- */

.prod-img-wrap {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
/* The Container */
.prod-img-wrap {
    position: relative;
    overflow: hidden;
    background-color: #e0e0e0;
    /* Skeleton Base Color */
    border-radius: var(--radius);
    transition: background-color 0.3s ease-out;
    isolation: isolate;
    /* FIX: Force full width and center alignment */
    width: 100%;
    margin: 0 auto;
    /* FIX: Flex centering for the internal image */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 1. Wishlist (Top Left) */
.prod-img-wrap .wishlist-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    border: none;
}

.prod-img-wrap .wishlist-btn.active {
    background: #fff0f0;
}

.prod-img-wrap .wishlist-btn.active i {
    color: var(--danger);
    font-weight: 900;
}

/* 2. Zoom/Expand (Bottom Right) */
.prod-img-wrap .zoom-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    top: auto; /* Reset top */
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s;
    color: #555;
}

/* 3. Badges (Top Right Stack) */
.prod-img-wrap .stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    left: auto;
    z-index: 25;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border-radius: 4px;
}

.prod-img-wrap .offer-tag {
    position: absolute;
    top: 34px; /* Stacked below stock badge */
    right: 8px;
    left: auto;
    z-index: 24;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 4. Variant/Savings Count (Bottom Left) */

.prod-img-wrap .badge-save {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 24;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}


/* Hover Effects */
.prod-img-wrap .wishlist-btn:hover, 
.prod-img-wrap .zoom-btn:hover {
    transform: scale(1.1);
    background: #fff;
    color: var(--primary);
}

.expiry-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(220, 53, 69, 0.9);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 5;
    font-weight: bold;
}

body.animations-paused .product-card .prod-img-slider {
    animation-play-state: paused !important;
}

/* 2. Pause Top Banner Slider */
body.animations-paused .banner-track {
    animation-play-state: paused !important;
}

/* 3. Pause Skeletons (if visible in background) */
body.animations-paused .skeleton {
    animation-play-state: paused !important;
}

/* 4. Pause any horizontal scroll lists auto-scrolling */
body.animations-paused .snap-scroll-container {
    scroll-behavior: auto !important; /* Stop smooth scroll momentum in background */
}
/* --- Enhanced Cart Conflict Modal --- */

.conflict-intro {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    background-color: #f0f7ff;
    border: 1px solid #cce5ff;
    padding: 15px;
    border-radius: 8px;
    color: #004085;
}

.conflict-section-title {
    font-weight: 800;
    margin: 15px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Cloud Items Grid */
.conflict-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 5px;
}

.conflict-item-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

/* Selected State for visuals */
.conflict-item-card.selected {
    border-color: var(--primary);
    background-color: #f0f7ff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}

.conflict-checkbox {
    margin-left: 15px;
    transform: scale(1.3);
    cursor: pointer;
    flex-shrink: 0;
}

.conflict-img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    margin-left: 12px;
    background-color: #eee;
    flex-shrink: 0;
}

.conflict-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conflict-name {
    font-weight: bold;
    font-size: 0.85rem;
    line-height: 1.2;
}

.conflict-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
}

.conflict-price {
    font-weight: bold;
    color: var(--primary);
    font-size: 0.9rem;
}

/* Current Cart Summary Box */
.local-cart-summary {
    background: #fff;
    border: 1px dashed #ccc;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.local-cart-summary i {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* --- Detailed Address Form --- */
.address-section-group {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
    position: relative;
}

.address-section-group::before {
    content: '📍';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 0 8px;
    font-size: 1.2rem;
    border-radius: 10px;
    border-top: 2px solid var(--primary);
    
}

.address-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.address-grid .full-span {
    grid-column: span 2;
}

.saved-address-selector {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--primary);
    background-color: #f0f7ff;
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007bff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: left 12px top 50%;
    background-size: 10px auto;
    padding-left: 30px;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    margin-top: 15px;
    display: block;
}

/* Swipe Up Hint Animation */
.swipe-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    animation: bounceUp 2s infinite;
    opacity: 0.7;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    gap: 5px;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.swipe-hint.visible {
    display: flex; /* Only show when checkout is active */
}
@keyframes bounceUp {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* Optimization for footer interactions */
#checkout-btn, 
.cart-total-row {
    touch-action: none;
    cursor: grab;
    user-select: none;
}
/* Send Later Option */
.send-later-option {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.send-later-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--warning);
}

.send-later-option span {
    font-size: 0.85rem;
    font-weight: bold;
    color: #856404;
}

/* Payment Warning Card (Success Screen) */
.payment-warning-card {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.2);
}

.payment-warning-icon {
    font-size: 3rem;
    color: #ffc107;
    margin-bottom: 10px;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.whatsapp-action-btn {
    background-color: #25D366;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

/* OOS Toggle Pill */
.filter-pill.oos-toggle {
    border-color: var(--success);
    color: var(--success);
}

.filter-pill.oos-toggle.active {
    background-color: var(--success);
    color: #fff;
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.filter-pill.oos-toggle i {
    font-size: 0.9rem;
}

/* --- Bundle Collage Grid System --- */

.bundle-card-collage {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 2px; /* Small white gap */
    background-color: #fff;
    overflow: hidden;
}

.bundle-card-collage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 1 Item: Full Fill */
.bundle-card-collage.items-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* 2 Items: Side by Side (Vertical Split) */
.bundle-card-collage.items-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

/* 3 Items: 1 Large Left, 2 Stacked Right */
.bundle-card-collage.items-3 {
    grid-template-columns: 1.5fr 1fr; /* Left image is wider */
    grid-template-rows: 1fr 1fr;
}
.bundle-card-collage.items-3 img:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2; /* Takes up entire left side */
}
.bundle-card-collage.items-3 img:nth-child(2) {
    grid-column: 2;
    grid-row: 1; /* Top Right */
}
.bundle-card-collage.items-3 img:nth-child(3) {
    grid-column: 2;
    grid-row: 2; /* Bottom Right */
}

/* 4 Items: Classic 2x2 Grid */
.bundle-card-collage.items-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Modal Price Styling */
.modal-price-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.modal-current-price {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 800;
}

.modal-old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
}

.modal-save-badge {
    background-color: #28a745; /* Green */
    color: white;
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.modal-save-badge i {
    font-size: 0.75rem;
}

/* --- Dual Range Slider --- */
.range-slider-wrapper {
    position: relative;
    width: 100%;
    height: 50px;
    margin-top: 10px;
    direction: ltr; /* Sliders work best in LTR context for math */
}

.slider-track-bg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 5px;
    background-color: #e9ecef;
    border-radius: 5px;
    z-index: 1;
}

.slider-track-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 5px;
    background-color: var(--primary);
    z-index: 2;
    border-radius: 5px;
}

.dual-range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none; /* Let clicks pass through track */
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: none;
    z-index: 3;
    margin: 0;
}

.dual-range-input::-webkit-slider-thumb {
    pointer-events: auto; /* Re-enable clicks for thumb */
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-top: -10px; /* Center thumb vertically relative to track (if needed) */
}

.dual-range-input::-moz-range-thumb {
    pointer-events: auto;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.price-readout {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-main);
    font-family: monospace; /* Keeps numbers aligned */
    font-size: 1.1rem;
    direction: ltr; /* Keep numbers LTR */
}

/* Price Suggestions Chips in Modal */
.price-suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.price-chip {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.price-chip:hover {
    border-color: var(--primary);
    background: #e7f5ff;
}

/* --- Branch & Contact Info --- */
.branch-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.branch-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.branch-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.action-btn-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: bold;
    transition: transform 0.2s;
}

.action-btn-icon:hover {
    transform: translateY(-2px);
}

.btn-map { background: #e3f2fd; color: #1976d2; }
.btn-call { background: #e8f5e9; color: #2e7d32; }
.btn-wa { background: #f0fdf4; color: #25D366; border: 1px solid #25D366; }

/* --- Site Footer --- */
.site-footer {
    background-color: #f8f9fa;
    padding: 40px 20px 10px 20px; /* Extra padding bottom for mobile nav */
    text-align: center;
    border-top: 1px solid #e9ecef;
    margin-top: 40px;
    border-radius: var(--radius);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.footer-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}

.footer-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.social-icon {
    font-size: 1.5rem;
    color: var(--secondary);
    transition: color 0.2s;
}

.social-icon:hover { color: var(--primary); }

.copyright {
    font-size: 0.75rem;
    color: #999;
}

/* --- Legal Text View --- */
.legal-content {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    line-height: 1.8;
    color: #444;
}

.legal-content h3 { color: var(--primary); margin-top: 20px; }
.legal-content ul { padding-right: 20px; }

.delivery-option #filterHideOos {
    display: block !important;
}

/* --- Seamless Scrolling Marquee --- */
:root {
    --announcement-h: 0px; 
    --marquee-duration: 20s; /* Calculated by JS */
    --marquee-end-pos: -100%; /* Calculated by JS */
}

.announcement-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    background-color: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    
    /* Layout */
    display: flex;
    align-items: center;
    overflow: hidden; /* Hide the scrolling parts */
    white-space: nowrap; 
    height: auto;
    min-height: 35px;
}

.announcement-bar a {
    color: #fff;
    text-decoration: underline;
}

/* The Track holding duplicates */
.marquee-track {
    display: flex;
    width: fit-content;
    will-change: transform;
}

/* Individual Item Styling */
.anno-item {
    padding: 8px 0;
    margin-right: 50px; /* Gap between duplicates (RTL default) */
    display: inline-block;
}

/* Gap adjustment for LTR */
html[dir="ltr"] .anno-item {
    margin-right: 0;
    margin-left: 50px;
}

/* Scrolling Animation Class */
.announcement-bar.is-scrolling .marquee-track {
    animation: marquee-infinite var(--marquee-duration) linear infinite;
}

@keyframes marquee-infinite {
    0% { transform: translateX(0); }
    100% { transform: translateX(var(--marquee-end-pos)); }
}

/* --- Category Slider --- */
.categories-slider-wrapper {
    margin: 15px 0;
    padding-left: 15px; /* RTL fix */
}

.categories-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-block: 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.category-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 70px;
    cursor: pointer;
    transition: transform 0.2s;
}

.category-pill:hover {
    transform: translateY(-3px);
}

.category-pill.active .cat-img {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.category-pill .cat-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    background-color: #f0f0f0;
}

.category-pill span {
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
}

/* --- Coupon Input in Cart --- */
.coupon-section {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.coupon-input-group {
    display: flex;
    gap: 10px;
}

.coupon-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.coupon-msg {
    font-size: 0.8rem;
    margin-top: 5px;
}
.coupon-msg.success { color: var(--success); }
.coupon-msg.error { color: var(--danger); }

/* --- Cart Issue / OOS Modal --- */
.issue-modal-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.issue-icon {
    font-size: 3rem;
    color: var(--warning);
    margin-bottom: 10px;
    animation: pulse-warning 2s infinite;
}

.issue-list {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.issue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #e6dbb9;
    font-size: 0.9rem;
    color: #856404;
}

.issue-item:last-child {
    border-bottom: none;
}

.issue-reason {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.5);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
    font-weight: bold;
}

.suggestion-section-title {
    text-align: center;
    margin: 20px 0 15px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* --- Checkout Warnings & Upload --- */
.warning-text-box {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    gap: 8px;
    align-items: start;
}

.warning-text-box i {
    margin-top: 3px;
}

#wallet-upload-section {
    border-top: 1px dashed var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
    animation: fadeIn 0.3s ease;
}

.send-later-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.send-later-label:hover {
    background: #e9ecef;
}

.send-later-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--warning);
}

.send-later-label span {
    font-size: 0.85rem;
    font-weight: bold;
    color: #495057;
}

/* File Drop Area Disabled State */
.file-drop-area.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: #e9ecef;
    border-color: #ced4da;
}

.coupon-input-group button {
    background-color: #63dc068e;
    padding: 5px;
    border-radius: 10px;
}

/* --- Coupon UI States --- */
.coupon-section {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

/* State: Input mode */
.coupon-input-group {
    display: flex;
    gap: 10px;
}

.coupon-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* State: Applied mode */
.coupon-applied-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #d1e7dd;
    color: #0f5132;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #badbcc;
}

.coupon-info strong {
    display: block;
    font-size: 0.9rem;
}

.coupon-info span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.remove-coupon-btn {
    background: none;
    border: none;
    color: #842029;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: transform 0.2s;
}

.remove-coupon-btn:hover {
    transform: scale(1.2);
    color: #dc3545;
}

.announcement-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001; /* Highest */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s ease; /* Slide animation */
}

.main-header {
    top: var(--announcement-h); /* Start below announcement */
    transition: top 0.3s ease;  /* Slide animation */
}

/* When Scrolled Down (Class added by JS) */
body.scrolled-mode .announcement-bar {
    transform: translateY(-100%); /* Slide up out of view */
}

body.scrolled-mode .main-header {
    top: 0 !important; /* Slide up to top edge */
}

.main-content {
    /* Push content down by (Header Height + Announcement Height + Spacing) */
    margin-top: calc(var(--header-h) + var(--announcement-h) + 15px) !important;
    transition: margin-top 0.3s ease;
}

.sticky-search {
    /* Ensure the search bar sticks UNDER the header + announcement */
    top: calc(var(--header-h) + var(--announcement-h)) !important;
}
body.scrolled-mode .sticky-search {
    top: var(--header-h) !important; /* Adjust sticky position */
}

.cart-drawer, .modal-overlay {
    /* Ensure drawers/modals cover the announcement bar */
    z-index: 2000 !important;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-shake {
    animation: errorShake 0.4s ease-in-out;
    border-color: var(--danger) !important;
}

.coupon-msg.error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    font-weight: bold;
    display: block; /* Ensure it takes space */
}


/* Notes & Attachments Section */
.notes-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 15px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
}

.notes-toggle-btn:hover {
    border-color: var(--primary);
    background-color: #f8fbff;
}

.notes-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    background-color: #fdfdfd;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 0 15px; /* Hidden initially via max-height */
}

.notes-container.open {
    max-height: 500px; /* Arbitrary large height */
    padding: 15px;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preview-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid #ddd;
    position: relative;
    animation: popIn 0.3s ease;
}

.preview-thumb .remove-img-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border: 1px solid white;
}

/* Enhanced CTA Button */
.btn-confirmed {
    background: linear-gradient(135deg, #28a745, #218838);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    font-size: 1.1rem;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.btn-confirmed i {
    font-size: 1.2rem;
}

/* Hide Swipe Hint */
.swipe-hint { display: none !important; }

.fa-arrow-left {
    font-size: 0.9rem;
    font-weight: 900;
    margin-right: 10px !important;
    align-self: center !important;
}

/* --- Pending Payment Actions in History --- */
.action-required-card {
    background: #fff;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    animation: slideDown 0.4s ease-out;
}

.action-required-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #856404;
    font-weight: bold;
    margin-bottom: 10px;
}

.action-required-header i {
    animation: pulse-warning 2s infinite;
}

.wallet-copy-box {
    background: #fff8e1;
    border: 1px dashed #d39e00;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.wallet-copy-box:active {
    transform: scale(0.98);
    background: #ffecb5;
}

.wallet-display-number {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    letter-spacing: 1px;
}

.copy-feedback {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: bold;
    display: none; /* Toggled via JS */
}

.mini-upload-zone {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    position: relative;
    transition: border-color 0.3s;
}

.mini-upload-zone:hover {
    border-color: var(--primary);
}

/* Specific styling for the 'Paid/Processing' state within history */
.payment-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
}
.payment-status-badge.pending { background: #ffeeba; color: #856404; }
.payment-status-badge.paid { background: #d4edda; color: #155724; }

.sticky-sentinel {
    width: 100%;
    height: 1px;
    background: transparent;
    visibility: hidden;
    pointer-events: none;
    /* Ensure it sits in the document flow right before the sticky element */
    position: relative; 
    margin-bottom: -1px; /* Prevent layout gap */
}

/* --- Robust Banner Styles (Fixing disappearance) --- */
.banners-container {
    width: 100%;
    position: relative;
    overflow: hidden;
    direction: ltr; /* Sliders work best in LTR */
    border-radius: var(--radius);
    margin-bottom: 20px;
    z-index: 1;
    min-height: 150px; /* Prevent collapse */
    background-color: var(--border-color); /* Skeleton BG */
}

/* Force visible display for the slider parent */
#banners-slider {
    display: block;
}
#banners-slider.hidden {
    display: none !important;
}

.banner-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    border-radius: var(--radius);
}

.banner-item {
    flex: 0 0 100%; /* Force 1 item width */
    width: 100%;
    scroll-snap-align: center;
    position: relative;
    border-radius: var(--radius);
}

.banner-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--radius);
}

/* Dots z-index fix */
.banner-dots {
    z-index: 5;
}

/* --- Announcement Modal --- */
.announcement-modal-body {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.announcement-modal-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-line; /* Preserves newlines if any */
}

.announcement-modal-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}

/* --- Wallet Selection Visuals --- */
.wallet-option-label {
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    cursor: pointer; 
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* Default State (Inactive) */
.wallet-option-label {
    background-color: transparent;
    opacity: 0.8;
}

/* Active State (Selected) */
.wallet-option-label.active {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
    opacity: 1;
}

.wallet-option-label input:checked + div span {
    color: var(--primary);
}

img {
    border-radius: var(--radius);
}

/* --- Slider Animation Logic --- */

/* Base Slider Styles */
.prod-img-slider {
    display: flex;
    height: 100%;
    width: 100%;
    /* Ensure RTL handling works by forcing LTR layout for the flex container 
       and using transforms to move it properly */
    direction: ltr; 
}

.prod-img-slider .prod-img {
    height: 100%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    /* Ensure images/grids don't get squished */
    flex-grow: 0; 
}

/* 2-Slide Specifics (Main + Collage) */
.slider-2 {
    width: 200%; /* 2 slides * 100% card width */
    animation: slider-2-anim 8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.slider-2 .prod-img {
    width: 50%; /* 100% / 2 slides */
}

/* Keyframes for 2 Slides (0% -> 50% -> 0%) */
/* Stays on Main (0) for ~45%, moves to Collage (-50%) for ~45% */
@keyframes slider-2-anim {
    0%, 45% {
        transform: translateX(0);
    }
    50%, 95% {
        transform: translateX(-50%);
    }
    100% {
        transform: translateX(0);
    }
}

/* Pause animation on hover for better viewing */
.product-card:hover .prod-img-slider {
    animation-play-state: paused;
}
/* --- Slider & Collage Fixes (Robust Viewport Logic) --- */

/* 1. Base Slider Container */
.prod-img-slider {
    display: flex;
    height: 100%;
    width: 100%; /* Fits the card wrapper exactly */
    direction: ltr; 
    position: relative;
    will-change: transform;
    /* Allow children to overflow horizontally within this flex container */
    box-sizing: border-box;
}

/* 2. Slide Item (Main Image & Collage) */
.prod-img-slider .slide-item {
    height: 100%;
    /* FORCE FULL WIDTH: 100% of the card wrapper */
    width: 100%;
    min-width: 100%; 
    flex: 0 0 100%; /* Don't grow, don't shrink, stay 100% */
    
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    position: relative;
}

/* Ensure images inside the slide-item div fill it */
.prod-img-slider .slide-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 3. Slider Animation (2 Slides) */
.slider-2 {
    /* We don't set width to 200% anymore. Flex items dictate the width. */
    animation: slider-2-anim 8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* Animation Keyframes: Move -100% (One full slide width) */
@keyframes slider-2-anim {
    0%, 45% {
        transform: translateX(0);
    }
    50%, 95% {
        transform: translateX(-100%); /* Move one full card width to the left */
    }
    100% {
        transform: translateX(0);
    }
}

/* 4. Collage Grid System */
.bundle-card-collage {
    display: grid !important; 
    width: 100% !important;
    height: 100% !important;
    gap: 1px;
    background-color: #fff;
    overflow: hidden;
}

/* Inner Images Wrapper */
.collage-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.collage-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Grid Layouts */
.bundle-card-collage.items-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.bundle-card-collage.items-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.bundle-card-collage.items-3 { grid-template-columns: 1.5fr 1fr; grid-template-rows: 1fr 1fr; }
.bundle-card-collage.items-3 .collage-img-wrapper:nth-child(1) { grid-row: 1 / span 2; grid-column: 1; }
.bundle-card-collage.items-3 .collage-img-wrapper:nth-child(2) { grid-row: 1; grid-column: 2; }
.bundle-card-collage.items-3 .collage-img-wrapper:nth-child(3) { grid-row: 2; grid-column: 2; }
.bundle-card-collage.items-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* Pause on hover */
.product-card:hover .prod-img-slider {
    animation-play-state: paused;
}

/* --- Product Customization & Modal Styles --- */
.modal-description-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
    border: 1px solid #eee;
}

.modal-desc-title {
    color: var(--primary);
    display: block;
    margin-bottom: 5px;
}

.modal-desc-text {
    line-height: 1.6;
}

.customization-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.customization-input-wrapper {
    margin-top: 10px;
}

.required-asterisk {
    color: var(--danger);
}

.input-error {
    border-color: var(--danger) !important;
    background-color: #fff5f5;
}

/* --- Cart Customization Display --- */
.cart-customization-details {
    margin-top: 4px;
    font-size: 0.75rem;
    border-right: 2px solid var(--primary);
    padding-right: 8px;
    color: var(--text-muted);
}

.cart-customization-row {
    display: block;
}

.cart-customization-key {
    font-weight: bold;
    color: var(--text-main);
}

/* --- Slider Image Fill Helper --- */
.slide-img-fill {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ======================================== */
/* Order Success Screen Improvements */
/* ======================================== */

.order-success-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.order-success-card .success-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: successPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.order-success-card h2 {
    margin: 10px 0;
    font-size: 1.8rem;
}

.order-success-card .order-ref {
    font-size: 1.1rem;
    margin: 10px 0;
    opacity: 0.95;
}

.order-success-card .order-total {
    font-size: 1.3rem;
    margin: 15px 0 5px 0;
}

.order-success-card .wallet-used {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.payment-required-card {
    background: white;
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.1);
}

.payment-required-card h3 {
    color: #ff9800;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.payment-required-card .instructions {
    text-align: right;
    line-height: 1.8;
    color: #555;
}

.payment-required-card .instructions p {
    margin: 8px 0;
}

.btn-whatsapp {
    display: block;
    background: #25D366;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.05rem;
    text-align: center;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp i {
    font-size: 1.3rem;
    margin-left: 8px;
}

.next-steps {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: right;
}

.next-steps h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.next-steps ol {
    padding-right: 25px;
    line-height: 2;
    color: #555;
}

.next-steps ol li {
    margin: 10px 0;
    font-size: 0.95rem;
}

.success-note {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 0.95rem;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .order-success-card {
        padding: 20px;
    }
    
    .order-success-card h2 {
        font-size: 1.4rem;
    }
    
    .payment-required-card {
        padding: 15px;
    }
    
    .btn-whatsapp {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* Load More Button */
#load-more-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#load-more-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--primary-dark);
}

#load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#load-more-btn i {
    margin-left: 8px;
}

/* ============= PRODUCT REVIEWS STYLES ============= */
.reviews-section {
    animation: fadeIn 0.3s ease-in;
}

.review-star-input {
    transition: all 0.2s ease;
}

.review-star-input:hover {
    transform: scale(1.1);
}

.reviews-section h4 {
    user-select: none;
}

#review-form-modal .modal-content {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Product card rating badge */
.product-rating-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.product-rating-badge i {
    color: #ffc107;
    font-size: 0.9em;
}

/* Loading spinner for reviews */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Review Form Modal Styles */
#review-form-modal .modal-content {
    max-width: 500px;
    animation: slideUp 0.3s ease-out;
}

#review-form-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

#review-form-modal .modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-main);
}

.review-product-info {
    text-align: center;
    padding: 20px;
    background: var(--light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.review-product-info img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.review-product-info .product-name {
    font-weight: bold;
    font-size: 1.05rem;
    color: var(--text-main);
}

.review-rating-section {
    text-align: center;
    margin: 25px 0;
}

.review-rating-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.05rem;
    color: var(--text-main);
}

#review-star-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

#review-form-modal textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s;
}

#review-form-modal textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#review-form-modal .btn-primary {
    margin-top: 20px;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: bold;
}