/* ============================================================
   Homepage Module CSS
   All styles for the dynamic homepage builder sections:
   slider_banner, grid_banners, category_grid, category_carousel,
   collection_carousel, social_proof.
   Uses --color-primary and --color-primary-rgb CSS variables
   (set by getThemeStyles() via the DB-driven theme token block).
   ============================================================ */

/* ── Homepage shared utilities ── */
.hp-scrollbox { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.hp-scrollbox::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════════════════════
   Hero Slider  (.hp-hero-*)
   ══════════════════════════════════════════════════════════ */
.hp-hero-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: clamp(220px, 56vw, 600px);
    background: #111;
}
/* Swiper container fills the wrap */
.hp-hero-swiper { height: 100%; width: 100%; }
.hp-hero-swiper .swiper-slide { height: 100%; }
/* Frosted-glass prev/next arrows (Swiper default elements) */
.hp-hero-swiper .swiper-button-prev,
.hp-hero-swiper .swiper-button-next {
    width: 46px;
    height: 46px;
    background: rgba(255,255,255,.13);
    border: 1.5px solid rgba(255,255,255,.3);
    border-radius: 50%;
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background .18s, border-color .18s;
    --swiper-navigation-size: 18px;
}
.hp-hero-swiper .swiper-button-prev:hover,
.hp-hero-swiper .swiper-button-next:hover {
    background: rgba(255,255,255,.28);
    border-color: rgba(255,255,255,.6);
}
/* Expandable pill pagination dots */
.hp-hero-swiper .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,.4);
    opacity: 1;
    border-radius: 99px;
    transition: width .28s cubic-bezier(.4,0,.2,1), background .25s;
}
.hp-hero-swiper .swiper-pagination-bullet-active {
    width: 26px;
    background: #fff;
}

.hp-hero-slide {
    flex: none;
    width: 100%;
    position: relative;
    height: 100%;
    overflow: hidden;
}
.hp-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}
.hp-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,.68) 0%, rgba(0,0,0,.22) 55%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}
.hp-hero-content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 7vw;
    /* max-width: 660px; */
    pointer-events: none;
    margin: auto;
}
.hp-hero-title {
    font-size: clamp(1.2rem, 4vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.16;
    letter-spacing: -.5px;
    margin: 0 0 14px;
    text-shadow: 0 2px 18px rgba(0,0,0,.38);
}
.hp-hero-sub {
    font-size: clamp(.82rem, 1.4vw, 1.05rem);
    color: rgba(255,255,255,.88);
    max-width: 460px;
    line-height: 1.7;
    margin: 0 0 28px;
}
.hp-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 30px;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    align-self: flex-start;
    pointer-events: auto;
    box-shadow: 0 4px 22px rgba(0,0,0,.22);
    transition: background .2s, color .2s, gap .2s, box-shadow .2s;
}
.hp-hero-cta:hover {
    background: var(--color-primary);
    color: #fff;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.32);
}



/* ══════════════════════════════════════════════════════════
   Grid Banner Cards  (.hp-grid-card)
   ══════════════════════════════════════════════════════════ */
.hp-grid-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #f3f4f6;
    aspect-ratio: 1;
    cursor: pointer;
    transition: box-shadow .22s, transform .22s;
}
.hp-grid-card:hover {
    box-shadow: 0 10px 36px rgba(0,0,0,.18);
    transform: translateY(-5px);
}
.hp-grid-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .44s cubic-bezier(.4,0,.2,1);
    display: block;
}
.hp-grid-card:hover img { transform: scale(1.08); }

/* ══════════════════════════════════════════════════════════
   Category Carousel Bubbles  (.hp-cat-*)
   ══════════════════════════════════════════════════════════ */
.hp-cat-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: transform .2s;
}
/* Swiper slide auto-width for category strip */
.hp-cat-swiper .swiper-slide { width: auto; padding: 2px 0; }
.hp-cat-bubble:hover { transform: translateY(-5px); }

.hp-cat-ring {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    overflow: hidden;
    background: #f3f4f6;
    border: 2.5px solid #e5e7eb;
    transition: border-color .2s, box-shadow .2s;
}
.hp-cat-bubble:hover .hp-cat-ring {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), .16);
}
.hp-cat-ring img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hp-cat-name {
    font-size: .72rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    max-width: 88px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════
   Collection Carousel  (.hp-cc-*)
   Layout: flex row — [btn] [overflow-hidden clip] [btn]
   Card styling lives in theme.css (section 13 — product-card)
   ══════════════════════════════════════════════════════════ */
.hp-cc-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    margin: 0 -50px;
}

/* Clip container: hides slides that are out of view */
.hp-cc-clip {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Swiper container — overflow visible so peek/grab works inside clip */
.hp-cc-swiper {
    overflow: visible !important;
    padding: 6px 2px 20px;
}
.hp-cc-swiper .swiper-slide {
    width: 220px;
}

/* Nav buttons — flex items, not absolutely positioned */
.hp-cc-btn-prev,
.hp-cc-btn-next {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.94);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    transition: background .18s, box-shadow .18s, opacity .18s, color .18s;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    z-index: 2;
}
.hp-cc-btn-prev:hover,
.hp-cc-btn-next:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    color: #111;
}
.hp-cc-btn-prev.swiper-button-disabled,
.hp-cc-btn-next.swiper-button-disabled {
    opacity: .30;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   Social Proof Cards  (.sp-*)
   ══════════════════════════════════════════════════════════ */
.sp-card {
    transition: transform .24s cubic-bezier(.34,1.56,.64,1), box-shadow .24s ease;
    cursor: default;
}
.sp-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 52px rgba(0,0,0,.22) !important;
}
.sp-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 30px;
    padding: 5px 11px 5px 8px;
}
.sp-pill i  { font-size: 14px; }
.sp-pill span { color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .4px; }

.sp-fb-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: #1877F2;
}
.sp-fb-hdr-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   Homepage utility classes  (.section-title, .hero-gradient,
   .fade-in-up, .btn-primary — override getThemeStyles versions)
   ══════════════════════════════════════════════════════════ */
.hero-gradient {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.section-title {
    position: relative;
    display: inline-block;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
}

@keyframes hp-fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: hp-fadeInUp 0.6s ease-out; }

/* ══════════════════════════════════════════════════════════
   Mobile tweaks
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .hp-hero-content  { padding: 0 18px; max-width: 100%; }
    .hp-hero-title    { margin-bottom: 8px; }
    .hp-hero-sub      { margin-bottom: 16px; }
    .hp-hero-cta      { padding: 10px 20px; font-size: .8rem; }
    .hp-hero-swiper .swiper-button-prev,
    .hp-hero-swiper .swiper-button-next { width: 34px; height: 34px; --swiper-navigation-size: 16px; }
    .hp-hero-swiper .swiper-button-prev { left: 8px; }
    .hp-hero-swiper .swiper-button-next { right: 8px; }

    /* ── Collection carousel: mobile-first layout ── */
    .hp-cc-wrap {
        margin: 0;          /* remove desktop -50px outset */
        padding: 0;
        gap: 0;
    }
    .hp-cc-btn-prev,
    .hp-cc-btn-next {
        display: none !important;
    }
    /* Swiper fills full width; clip inherits its natural width */
    .hp-cc-clip {
        overflow: hidden;
    }
    /* Restore overflow:hidden so Swiper clips slides correctly */
    .hp-cc-swiper {
        overflow: hidden !important;
        padding: 6px 0 20px;
    }
}


/* ---------------------------------------------------------------------------
   Shoppable Hotspot Pins
   Used on: homepage (all section types), product-detail page
---------------------------------------------------------------------------- */

/* Container that holds the background image + pins */
.hp-shoppable-wrap {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: inherit;
}

.hp-shoppable-bg {
    width: 100%;
    height: auto;
    display: block;
}

/* The "+" pin button */
@keyframes hp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
    70%  { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.hp-hotspot-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform .15s;
    animation: hp-pulse 2.4s infinite;
    padding: 0;
}

.hp-hotspot-pin:hover,
.hp-hotspot-pin.active {
    transform: translate(-50%, -50%) scale(1.15);
    animation: none;
}

.hp-pin-plus {
    font-size: 20px;
    font-weight: 300;
    color: #111;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* Tooltip card */
.hp-hotspot-card {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(.94);
    min-width: 230px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.16);
    padding: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 20;
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

.hp-hotspot-pin.active .hp-hotspot-card,
.hp-hotspot-pin:focus-within .hp-hotspot-card {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* Right-edge flip � card opens to the left */
.hp-hotspot-pin[data-edge="right"] .hp-hotspot-card {
    left: auto;
    right: 0;
    transform: translateX(0) scale(.94);
}
.hp-hotspot-pin[data-edge="right"].active .hp-hotspot-card,
.hp-hotspot-pin[data-edge="right"]:focus-within .hp-hotspot-card {
    transform: translateX(0) scale(1);
}

.hp-hotspot-card img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.hp-hotspot-card-info {
    overflow: hidden;
}

.hp-hotspot-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.hp-hotspot-card-price {
    font-size: 13px;
    color: #2563EB;
    font-weight: 700;
    margin: 0;
}

/* Product-detail: pins layer inside #pd-main-image-area */
#pd-main-image-area {
    position: relative;
}

/* Mobile optimizations for hotspot pins */
@media (max-width: 768px) {
    .hp-hotspot-pin {
        width: 32px;
        height: 32px;
        box-shadow: 0 2px 8px rgba(0,0,0,.25);
    }
    
    .hp-pin-plus {
        font-size: 18px;
    }
    
    .hp-hotspot-card {
        min-width: 240px;
        max-width: calc(100vw - 16px);
    }
    
    .hp-hotspot-card img {
        width: 56px;
        height: 56px;
    }
    
    .hp-hotspot-card-name {
        font-size: 12px;
        max-width: 150px;
    }
    
    .hp-hotspot-card-price {
        font-size: 12px;
    }
}

/* Lightbox hotspot adjustments for mobile */
@media (max-width: 768px) {
    #pd-lightbox #pd-lb-inner {
        padding: 16px 48px !important;
    }
    
    #pd-lightbox #pd-lb-img {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    #pd-lb-prev,
    #pd-lb-next {
        width: 40px !important;
        height: 40px !important;
        font-size: 24px !important;
        left: 8px;
        right: 8px;
        -webkit-tap-highlight-color: transparent;
    }
    
    #pd-lb-close {
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
        top: 8px !important;
        right: 8px !important;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Desktop lightbox adjustments */
@media (min-width: 769px) {
    #pd-lightbox #pd-lb-inner {
        padding: 20px 72px !important;
    }
    
    #pd-lb-prev {
        left: 12px !important;
    }
    
    #pd-lb-next {
        right: 12px !important;
    }
    
    #pd-lb-prev,
    #pd-lb-next {
        width: 48px !important;
        height: 48px !important;
        font-size: 30px !important;
    }
    
    #pd-lb-close {
        width: 40px !important;
        height: 40px !important;
        font-size: 24px !important;
        top: 12px !important;
        right: 12px !important;
    }
}

/* ══════════════════════════════════════════════════════════
   Frequently Bought Together (FBT) bundle widget
   ══════════════════════════════════════════════════════════ */
.fbt-widget {
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    padding: 18px;
}

.fbt-widget + .fbt-widget {
    margin-top: 20px;
}

.fbt-widget__cards {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.fbt-widget__card {
    flex: 0 0 auto;
    max-width: 100%;
    position: relative;
}

/* Re-card the small thumbnails — the global luxury reset (768px+) strips
   borders/radius from .product-card, so restore them here with the
   higher specificity of the .fbt-widget__card ancestor. */
.fbt-widget__card .product-card {
    border: 1px solid var(--border-light, #f0ede8);
    border-radius: var(--r-lg, 16px);
    background: #fff;
    height: 100%;
}

.fbt-widget__card .product-card__image-wrap {
    background: #f7f6f3;
    height: 150px;
}

.fbt-widget__card .product-card__name {
    font-size: 0.75rem;
}

/* "+" separator between bundle items */
.fbt-widget__card + .fbt-widget__card::before {
    content: '+';
    position: absolute;
    left: -14px;
    top: 75px;
    transform: translate(-50%, -50%);
    font-size: 1.375rem;
    font-weight: 300;
    color: #c7c2ba;
    z-index: 1;
}

.fbt-widget__summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    background: var(--surface-50, #fafafa);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 16px 20px;
}

.fbt-widget__heading {
    flex: 1 1 100%;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-400, #9ca3af);
}

.fbt-widget__name {
    color: var(--color-primary, #ea580c);
    text-transform: none;
    letter-spacing: normal;
}

.fbt-widget__prices {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.fbt-widget__original {
    font-size: 0.875rem;
    color: var(--text-400, #9ca3af);
    text-decoration: line-through;
}

.fbt-widget__price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-900, #111827);
}

.fbt-widget__savings {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #16a34a;
}

.add-bundle-to-cart-btn {
    margin-left: auto;
    background: var(--color-primary, #ea580c);
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    border: none;
    border-radius: var(--r-pill, 999px);
    padding: 12px 24px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.add-bundle-to-cart-btn:hover {
    background: var(--color-primary-dark, #c2410c);
}

.add-bundle-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.fbt-widget__msg {
    flex: 1 1 100%;
    font-size: 0.8125rem;
    color: #dc2626;
}

@media (max-width: 640px) {
    .fbt-widget {
        padding: 14px;
        border-radius: 12px;
    }

    .fbt-widget__cards {
        gap: 22px;
    }

    .fbt-widget__card {
        width: calc(50% - 11px);
    }

    .fbt-widget__card .product-card__image-wrap {
        height: auto;
    }

    .fbt-widget__card + .fbt-widget__card::before {
        left: -12px;
        top: 50%;
    }

    .fbt-widget__summary {
        flex-direction: column;
        align-items: stretch;
    }

    .add-bundle-to-cart-btn {
        margin-left: 0;
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .fbt-widget {
        display: flex;
        align-items: stretch;
        gap: 2rem;
        padding: 24px;
    }

    .fbt-widget__cards {
        flex: 1;
        flex-wrap: nowrap;
        gap: 36px;
        margin-bottom: 0;
        align-items: stretch;
    }

    .fbt-widget__card {
        width: 220px !important;
    }

    .fbt-widget__card + .fbt-widget__card::before {
        left: -18px;
        top: 75px;
    }

    .fbt-widget__summary {
        flex: 0 0 300px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
    }

    .fbt-widget__heading {
        flex: 0 0 auto;
    }

    .add-bundle-to-cart-btn {
        margin-left: 0;
        width: 100%;
    }

    .fbt-widget__msg {
        flex: 0 0 auto;
    }
}
