/* ═══════════════════════════════════════════════════════════════════════════════
   Banner Engine — Shared Carousel Styles
   Used by homepage (marketplace mode) and seller store (seller mode)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Container ──────────────────────────────────────────────────────────────── */
/* ── Container ──────────────────────────────────────────────────────────────── */
.banner-slider {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    aspect-ratio: 1920 / 640;
    max-height: 520px;
    height: auto;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary-color, #1e293b), var(--accent-color, #3b82f6), var(--bg-dark, #0f172a));
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x;
    -ms-touch-action: pan-x;
}

.banner-slider.seller-mode {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

/* ── Track ──────────────────────────────────────────────────────────────────── */
.banner-track {
    display: flex;
    /* Width set inline by PHP (N×100%) so the JS translateX math stays correct. */
    height: 100%;
    transition: transform 600ms ease-in-out;
    will-change: transform;
}

/* ── Slides ─────────────────────────────────────────────────────────────────── */
.banner-slide {
    flex: 0 0 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: block;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.banner-slide a {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 1;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center center;
    display: block;
    position: relative;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.banner-slider.seller-mode .banner-slide img {
    object-fit: fill;
}

.banner-slide img.loaded { opacity: 1; }

.banner-slide img.loaded { opacity: 1; }

/* ── Shimmer loading ────────────────────────────────────────────────────────── */
.banner-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--card-hover, #e8e8e8) 25%, var(--card-bg, #f5f5f5) 50%, var(--card-hover, #e8e8e8) 75%);
    background-size: 200% 100%;
    animation: bannerShimmer 1.5s ease-in-out infinite;
    z-index: 1;
}

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

/* ── Drag cursor affordance ──────────────────────────────────────────────── */
.banner-slider .banner-track           { cursor: grab; }
.banner-slider.grabbing .banner-track  { cursor: grabbing; }
/* Images and links inside track must not show text cursor */
.banner-slide img,
.banner-slide a                        { cursor: inherit; }

/* ── Indicator dots ─────────────────────────────────────────────────────────── */
.banner-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

.banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.banner-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.banner-dot.active {
    width: 22px;
    height: 8px;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    transform: scale(1);
}

.banner-dot:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

/* ── Navigation Arrows ──────────────────────────────────────────────────────── */
.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.banner-slider:hover .banner-arrow {
    opacity: 1;
}

.banner-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    background: #ffffff;
    color: var(--interactive, #2563eb);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.banner-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.banner-arrow:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
    opacity: 1;
}

.banner-arrow-prev {
    left: 16px;
}

.banner-arrow-next {
    right: 16px;
}

/* Touch & mobile arrow visibility */
@media (pointer: coarse), (max-width: 768px) {
    .banner-arrow {
        opacity: 0.85;
        width: 34px;
        height: 34px;
    }
    .banner-arrow-prev { left: 8px; }
    .banner-arrow-next { right: 8px; }
}

/* ── Content overlay (seller mode) ──────────────────────────────────────────── */
.banner-content {
    position: relative;
    z-index: 3;
    padding: 40px;
    max-width: 500px;
    pointer-events: none;
}

.banner-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.banner-desc {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
}

.banner-btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: auto;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.banner-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.banner-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light, #9CA3AF);
    text-align: center;
    gap: 12px;
    padding: 0 20px;
}

.banner-empty i {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

.banner-empty a {
    color: var(--accent, #2563eb);
    text-decoration: none;
    font-size: 0.9rem;
}
.banner-empty a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Desktop & Tablet scaling ─────────────────────────────────────────────── */
/* Desktop (1920×700) & Tablets scale proportionally via aspect-ratio: 1920 / 700 */

/* ── Mobile Layout ──────────────────────────────────────────────────────────
   Banner must be clearly larger than the navbar (~64px) on all phone sizes.
   Heights chosen so banner is a proper hero section, not a thin strip.
── */
@media (max-width: 640px) {
    .banner-slider:not(.seller-mode) {
        aspect-ratio: auto;
        height: 280px;
        border-radius: 14px;
    }
    .banner-slider:not(.seller-mode) .banner-slide img {
        object-fit: fill;
    }
    .banner-dots { bottom: 10px; gap: 6px; }
    .banner-dot { width: 8px; height: 8px; border-width: 1.5px; }
    .banner-content { padding: 20px; }
    .banner-title { font-size: 1.2rem; }
    .banner-desc { font-size: 0.82rem; }
}

@media (max-width: 480px) {
    .banner-slider:not(.seller-mode) { height: 220px; border-radius: 12px; }
    .banner-dots { bottom: 8px; gap: 5px; }
    .banner-dot { width: 7px; height: 7px; border-width: 1.5px; }
}

@media (max-width: 425px) {
    .banner-slider:not(.seller-mode) { height: 195px; border-radius: 10px; }
    .banner-dots { bottom: 6px; gap: 4px; }
    .banner-dot { width: 6px; height: 6px; border-width: 1.5px; }
}

@media (max-width: 380px) {
    .banner-slider:not(.seller-mode) { height: 175px; border-radius: 8px; }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   Hero Mode 2 — Split Hero Layout
   .hero-split-section  → wrapper <section>
   .hero-split-wrapper  → flex row: left banner + right sidebar
   .hero-split-banner   → left: contains the .banner-slider
   .hero-split-side     → right: categories + highlights
   ═══════════════════════════════════════════════════════════════════════════════ */

.hero-split-section {
    width: 100%;
}

.hero-split-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: stretch;
    width: 100%;
    min-height: 420px;
}

/* Left column — let the banner fill the grid cell */
.hero-split-banner {
    position: relative;
    min-width: 0;
    border-radius: 18px;
    overflow: hidden;
}

.hero-split-banner .banner-slider {
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    min-height: 320px;
    border-radius: 0; /* clipped by .hero-split-banner */
}

/* Right column */
.hero-split-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* ── Category quick-links ──────────────────────────────────────────────────── */
.hero-split-cats {
    background: var(--card-bg, #fff);
    border-radius: 14px;
    border: 1px solid var(--border, #e2e8f0);
    padding: 14px;
    flex-shrink: 0;
}

.hero-split-cats-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light, #64748b);
    margin-bottom: 10px;
}

.hero-split-cats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.hero-split-cat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 10px;
    background: var(--card-hover, #f8fafc);
    text-decoration: none;
    transition: background 0.18s, transform 0.18s;
    cursor: pointer;
    border: 1px solid transparent;
}

.hero-split-cat-tile:hover {
    background: var(--interactive-light, #eff6ff);
    border-color: var(--interactive, #2563eb);
    transform: translateY(-2px);
}

.hero-split-cat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(37, 99, 235, 0.09);
    color: var(--interactive, #2563eb);
}

.hero-split-cat-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── Flash deal highlight items ────────────────────────────────────────────── */
.hero-split-highlights {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

.hero-split-highlight-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
    min-width: 0;
}

.hero-split-highlight-item:hover {
    border-color: var(--interactive, #2563eb);
    transform: translateX(3px);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.10);
}

.hero-split-highlight-item img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--card-hover, #f1f5f9);
}

.hero-split-highlight-img-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--card-hover, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light, #94a3b8);
    flex-shrink: 0;
}

.hero-split-highlight-info {
    flex: 1;
    min-width: 0;
}

.hero-split-highlight-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-split-highlight-price {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--interactive, #2563eb);
    margin-top: 2px;
}

/* ── Responsive: collapse to stacked on tablet / mobile ─────────────────────── */
@media (max-width: 1024px) {
    .hero-split-wrapper {
        grid-template-columns: 1fr;
        min-height: unset;
    }

    .hero-split-banner .banner-slider {
        min-height: 240px;
        height: 240px;
        aspect-ratio: auto;
    }

    .hero-split-side {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hero-split-cats,
    .hero-split-highlights {
        flex: 1 1 48%;
        min-width: 240px;
    }
}

@media (max-width: 640px) {
    .hero-split-banner .banner-slider {
        min-height: 200px;
        height: 200px;
        border-radius: 14px;
    }

    .hero-split-side {
        flex-direction: column;
    }

    .hero-split-cats,
    .hero-split-highlights {
        flex: unset;
        min-width: unset;
    }

    .hero-split-cats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero-split-cat-icon {
        width: 30px;
        height: 30px;
    }

    .hero-split-cat-name {
        font-size: 0.62rem;
    }
}

/* ── Option 1: Full Hero Banner ───────────────────────────────────────────── */
.hero-opt1-wrapper {
    width: 100%;
    max-width: var(--banner-w-desk, 1920px);
    margin: 0 auto 24px auto;
}

.hero-opt1-wrapper .banner-slider {
    width: 100%;
    max-width: var(--banner-w-desk, 1920px);
    height: var(--banner-h-desk, 400px);
    max-height: none;
    aspect-ratio: auto;
    margin: 0 auto;
}

/* ── Option 2: Static Banner + Carousel ────────────────────────────────────── */
.hero-opt2-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 0 auto 24px auto;
}

.hero-static-banner {
    width: 100%;
    max-width: var(--static-w-desk, 1920px);
    height: var(--static-h-desk, 280px);
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.hero-static-banner a {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-static-banner img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    display: block;
    opacity: 1;
}

.hero-opt2-wrapper .banner-slider {
    width: 100%;
    max-width: var(--banner-w-desk, 1920px);
    height: var(--banner-h-desk, 320px);
    margin: 0 auto;
    max-height: none;
    aspect-ratio: auto;
}

/* ── Option 3: Hero Banner + Small Banner Cards ────────────────────────────── */
.hero-opt3-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 0 auto 24px auto;
}

.hero-opt3-top {
    width: 100%;
    max-width: var(--opt3-hero-w-desk, 1920px);
    height: var(--opt3-hero-h-desk, 360px);
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.hero-opt3-top a {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-opt3-top img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    display: block;
    opacity: 1;
}

.hero-opt3-cards-row {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    width: 100%;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.hero-opt3-cards-row::-webkit-scrollbar {
    height: 6px;
}

.hero-opt3-cards-row::-webkit-scrollbar-track {
    background: transparent;
}

.hero-opt3-cards-row::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 6px;
}

.hero-banner-card {
    flex: 0 0 var(--opt3-card-w-desk, 380px);
    width: var(--opt3-card-w-desk, 380px);
    min-width: var(--opt3-card-w-desk, 380px);
    height: var(--opt3-card-h-desk, 160px);
    scroll-snap-align: start;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: auto;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    display: block;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hero-banner-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.hero-banner-card img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    display: block;
    opacity: 1;
}

/* Tablet Responsive Breakpoint */
@media (max-width: 1024px) {
    .hero-opt1-wrapper {
        max-width: var(--banner-w-tab, 100%);
    }
    .hero-opt1-wrapper .banner-slider {
        max-width: var(--banner-w-tab, 100%);
        height: var(--banner-h-tab, 300px);
    }
    .hero-static-banner {
        max-width: var(--static-w-tab, 100%);
        height: var(--static-h-tab, 220px);
    }
    .hero-opt2-wrapper .banner-slider {
        max-width: var(--banner-w-tab, 100%);
        height: var(--banner-h-tab, 240px);
    }
    .hero-opt3-top {
        max-width: var(--opt3-hero-w-tab, 100%);
        height: var(--opt3-hero-h-tab, 260px);
    }
    .hero-opt3-cards-row {
        gap: 12px;
    }
    .hero-banner-card {
        flex: 0 0 var(--opt3-card-w-tab, 300px);
        width: var(--opt3-card-w-tab, 300px);
        min-width: var(--opt3-card-w-tab, 300px);
        height: var(--opt3-card-h-tab, 130px);
    }
}

/* Mobile Responsive Breakpoint */
@media (max-width: 768px) {
    .hero-opt1-wrapper {
        max-width: var(--banner-w-mob, 100%);
    }
    .hero-opt1-wrapper .banner-slider {
        max-width: var(--banner-w-mob, 100%);
        height: var(--banner-h-mob, 200px);
    }
    .hero-static-banner {
        max-width: var(--static-w-mob, 100%);
        height: var(--static-h-mob, 160px);
        border-radius: 14px;
    }
    .hero-opt2-wrapper .banner-slider {
        max-width: var(--banner-w-mob, 100%);
        height: var(--banner-h-mob, 180px);
    }
    .hero-opt3-top {
        max-width: var(--opt3-hero-w-mob, 100%);
        height: var(--opt3-hero-h-mob, 180px);
        border-radius: 14px;
    }
    .hero-opt3-cards-row {
        gap: 10px;
    }
    .hero-banner-card {
        flex: 0 0 var(--opt3-card-w-mob, 240px);
        width: var(--opt3-card-w-mob, 240px);
        min-width: var(--opt3-card-w-mob, 240px);
        height: var(--opt3-card-h-mob, 110px);
        border-radius: 12px;
    }
}
