/* SS Elementor Product Slider — v2.7.9
 * Production-grade styles. No overlay-anchor stacking; controls and links are
 * real siblings so taps inside the card never fight z-index layers.
 *
 * v2.7.9: Force mode for TikTok/in-app WebView gestures —
 *   - JS now locks gestures on touchstart inside the slider wrapper and
 *     uses a scoped history shield if the WebView still attempts back/exit.
 *
 * v2.7.8: Full slider-region TikTok/WebView swipe hardening —
 *   - Protection is scoped to `.ss-eps-wrap`, so the header/space above the
 *     products, arrows, dots, and cards are all protected from back/exit.
 *   - Outside the product slider wrapper, WebView/browser gestures stay normal.
 *
 * v2.7.7: TikTok WebView swipe hardening —
 *   - Protection is now scoped to the slider only. Outside the slider,
 *     horizontal WebView back/exit gestures are not blocked.
 *   - TikTok receives a stronger `touch-action:none` contract on the
 *     slider viewport/children so a swipe inside the slider cannot be
 *     stolen by the WebView before JS handles it.
 *
 * v2.7.6: iOS Safari swipe-back hardening —
 *   - `overscroll-behavior-x: contain` + `-webkit-overflow-scrolling: touch`
 *     scoped to the slider wrap (the outer, non-scrolling container) so the
 *     swipe gesture is contained to the slider without touching the
 *     `.ss-eps-viewport` gesture contract — which some Android / older
 *     WebKit builds break if overscroll-behavior is set on it (see the
 *     viewport block below). html/body keep the stronger `none`.
 *
 * v2.7.4: smoother mobile swipe —
 *   - track inherits `touch-action: pan-y` explicitly so iOS WKWebView
 *     never falls back to `auto` mid-drag (some builds reset the gesture
 *     contract on transformed children).
 * v2.7.3: maximum horizontal-swipe-back defence —
 *   - touch-action: pan-y on html/body so the browser globally rejects
 *     any horizontal gesture (back-swipe, forward-swipe, overscroll-nav)
 *   - overscroll-behavior-x: none (stronger than contain) on html/body
 *   - 24px viewport inset on mobile so the swipe surface never sits in
 *     the OS edge-swipe hot zone (~20px on iOS, up to 30px on Android)
 */

/* ---------- Horizontal gesture policy ----------
 * Do NOT block horizontal gestures globally. The WebView/browser should still
 * be able to go back/exit when the swipe starts outside the slider. The hard
 * gesture lock is scoped below to `.ss-eps-viewport` only.
 */
html, body {
    -webkit-tap-highlight-color: transparent;
}
body.ss-eps-ios {
    -webkit-overflow-scrolling: touch;
}

/* Mobile: pull the slider's swipe surface 24px off each screen edge so
 * the gesture never starts on the OS edge-swipe hot zone. Both edges,
 * universal — applies on mobile Safari, Chrome, and every in-app webview.
 *
 * Apply on the WRAP (not just viewport) so any inner padding that the
 * theme adds doesn't push the swipe surface back to the edge. */
@media (max-width: 767px) {
    .ss-eps-wrap {
        padding-left:  10px;
        padding-right: 10px;
    }
    .ss-eps-viewport {
        margin-left:  14px;
        margin-right: 14px;
    }
}
.ss-eps-wrap {
    --ss-gap: 24px;
    --ss-card-bg: #fff;
    --ss-card-radius: 24px;
    --ss-shadow: 0 14px 35px rgba(15, 23, 42, .08);
    --ss-border: 1px solid rgba(148, 163, 184, .22);
    --ss-text: #0f172a;
    --ss-muted: #64748b;
    --ss-soft: #eff4ff;
    --ss-soft-hover: #dfe7ff;
    --ss-btn-grad-1: #0f172a;
    --ss-btn-grad-2: #223250;
    --ss-nav-bg: #fff;
    --ss-nav-color: #0f172a;
    position: relative;
    width: 100%;
    /* Whole slider region owns horizontal swipe; vertical page scroll remains native. */
    touch-action: pan-y;
    /* Keep the horizontal swipe contained to the slider without
     * mutating the viewport's gesture contract. Safe here because the
     * wrap is a normal-flow container, not the scroll/overflow element. */
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.ss-eps-wrap *,
.ss-eps-wrap *::before,
.ss-eps-wrap *::after { box-sizing: border-box; }

/* ---------- Header ---------- */
.ss-eps-sectionbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.ss-eps-heading { min-width: 0; flex: 1 1 auto; }
.ss-eps-section-title { margin: 0 0 6px; font-size: clamp(24px, 3vw, 48px); line-height: 1.08; font-weight: 800; color: var(--ss-text); letter-spacing: -.02em; }
.ss-eps-section-subtitle { margin: 0; color: var(--ss-muted); font-size: clamp(13px, 1.4vw, 20px); line-height: 1.55; max-width: 720px; }
.ss-eps-toolbar { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.ss-eps-header-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 18px; border-radius: 999px; text-decoration: none; background: var(--ss-soft); color: var(--ss-text); font-weight: 700; font-size: 14px; line-height: 1; white-space: nowrap; transition: background .22s ease, transform .22s ease; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.ss-eps-header-btn:hover { transform: translateY(-1px); background: var(--ss-soft-hover); }
.ss-eps-nav { display: flex; align-items: center; gap: 10px; }
.ss-eps-arrow { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--ss-nav-bg); color: var(--ss-nav-color); box-shadow: 0 8px 22px rgba(15, 23, 42, .08); cursor: pointer; transition: box-shadow .22s ease, transform .22s ease; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.ss-eps-arrow:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 23, 42, .12); }
.ss-eps-arrow:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ---------- Viewport ----------
 * Critical: only `overflow: hidden` + `touch-action: pan-y` here.
 * Adding overscroll-behavior, -webkit-overflow-scrolling, or
 * `contain` on this element breaks vertical-scroll handoff on some
 * Android builds and older WebKit — page refuses to scroll when the
 * user's finger lands inside the slider.
 */
.ss-eps-viewport {
    overflow: hidden;
    cursor: grab;
    /* Apply user-select: none unconditionally so the first drag move
     * doesn't have to invalidate every descendant's style. */
    user-select: none;
    -webkit-user-select: none;
    /* Native vertical pan stays with the browser; horizontal swipe goes to JS. */
    touch-action: pan-y;
    /* Promote to its own layer so drag transforms stay on the compositor. */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}
.ss-eps-viewport * { user-select: none; -webkit-user-select: none; }
.ss-eps-viewport.is-dragging { cursor: grabbing; }

/* TikTok WebView fallback: its native horizontal back/exit recogniser can win
 * before a normal `touchmove` handler fires. Restrict the stronger gesture
 * contract to the slider only, so outside-slider swipes still behave normally. */
body.ss-eps-inapp .ss-eps-wrap,
body.ss-eps-inapp .ss-eps-wrap *,
body.ss-eps-inapp .ss-eps-viewport,
body.ss-eps-inapp .ss-eps-track,
body.ss-eps-inapp .ss-eps-slide,
body.ss-eps-inapp-tiktok .ss-eps-wrap,
body.ss-eps-inapp-tiktok .ss-eps-wrap *,
body.ss-eps-inapp-tiktok .ss-eps-viewport,
body.ss-eps-inapp-tiktok .ss-eps-track,
body.ss-eps-inapp-tiktok .ss-eps-slide {
    touch-action: none;
    -ms-touch-action: none;
}
body.ss-eps-inapp .ss-eps-wrap,
body.ss-eps-inapp-tiktok .ss-eps-wrap {
    overscroll-behavior-x: contain;
}

.ss-eps-track {
    display: flex;
    gap: var(--ss-gap);
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* `perspective` needs a length unit — 1000 alone is invalid and
     * silently ignored in WKWebView, losing the 3D-layer promotion. */
    -webkit-perspective: 1000px;
    perspective: 1000px;
    /* Match the viewport's gesture contract so iOS WKWebView keeps
     * dispatching horizontal touchmoves to JS once the track is being
     * translated. Without this some WKWebView builds switch the track
     * back to `touch-action: auto` once it's transformed, and the
     * slider stops tracking the finger mid-swipe. */
    touch-action: pan-y;
}
/* Kill ALL inherited transitions inside the track while dragging so the
 * card's hover-transform transition can't fight the finger. */
.ss-eps-viewport.is-dragging .ss-eps-track,
.ss-eps-viewport.is-dragging .ss-eps-track * {
    transition: none !important;
}

.ss-eps-slide {
    flex: 0 0 auto;
    min-width: calc((100% - (var(--ss-gap) * 3)) / 4);
    /* Inherit pan-y from viewport so the image / card inside don't
     * accidentally introduce pinch-zoom or other gestures. */
    touch-action: pan-y;
}

/* Image must not eat the touch sequence with its own gestures. */
.ss-eps-thumb,
.ss-eps-thumb img { touch-action: pan-y; }

/* ---------- Card ---------- */
.ss-eps-card {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ss-card-bg);
    border: var(--ss-border);
    border-radius: var(--ss-card-radius);
    box-shadow: var(--ss-shadow);
    transition: transform .28s ease, box-shadow .28s ease;
    text-decoration: none;
}
.ss-eps-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(15, 23, 42, .12); }

.ss-eps-thumb-link {
    display: block;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}

.ss-eps-thumb {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8fafc;
}
.ss-eps-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.ss-eps-card:hover .ss-eps-thumb img { transform: scale(1.035); }

.ss-eps-badge {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: .02em;
    text-transform: uppercase;
    z-index: 2;
}

.ss-eps-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }

.ss-eps-title { margin: 0; color: var(--ss-text); font-size: clamp(16px, 1.2vw, 20px); line-height: 1.35; font-weight: 800; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ss-eps-title a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.ss-eps-title a:hover { color: #2563eb; }

.ss-eps-price { margin: 0; color: var(--ss-muted); font-size: clamp(13px, 1vw, 15px); line-height: 1.4; font-weight: 600; }
.ss-eps-price .amount { font-weight: 800; color: var(--ss-text); font-size: 1.06em; }
.ss-eps-price del { opacity: .55; margin-inline-end: 6px; }

.ss-eps-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }

.ss-eps-secondary-btn,
.ss-eps-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: 0;
    border-radius: 16px;
    padding: 13px 14px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
    cursor: pointer;
    transition: background .22s ease, transform .22s ease, box-shadow .22s ease;
    min-height: 46px;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    font-family: inherit;
}
.ss-eps-secondary-btn { background: var(--ss-soft); color: var(--ss-text); }
.ss-eps-secondary-btn:hover { background: var(--ss-soft-hover); }
.ss-eps-secondary-btn-light { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .18); }

.ss-eps-cart-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }

.ss-eps-qty {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, .32);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    min-width: 0;
}
.ss-eps-qty-btn {
    border: 0;
    background: #f8fafc;
    height: 40px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    color: var(--ss-text);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.ss-eps-qty-btn:hover { background: var(--ss-soft); }
.ss-eps-qty-btn:active { background: var(--ss-soft-hover); }
.ss-eps-qty-input {
    width: 100%;
    height: 40px;
    border: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--ss-text);
    padding: 0 4px;
    -moz-appearance: textfield;
    background: #fff;
    cursor: text;
}
.ss-eps-qty-input::-webkit-outer-spin-button,
.ss-eps-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ss-eps-cart-btn {
    background: linear-gradient(135deg, var(--ss-btn-grad-1), var(--ss-btn-grad-2));
    color: #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
}
.ss-eps-cart-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(15, 23, 42, .2); }
.ss-eps-cart-btn.is-loading { opacity: .8; pointer-events: none; }
.ss-eps-cart-btn.is-added { background: linear-gradient(135deg, #16a34a, #15803d); }
.ss-eps-cart-btn:disabled { cursor: not-allowed; opacity: .7; }

.ss-eps-cart-icon { display: inline-flex; line-height: 1; flex: 0 0 auto; }
.ss-eps-cart-text { display: inline-block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-eps-cart-message { min-height: 16px; font-size: 12px; font-weight: 700; color: #16a34a; line-height: 1.2; }

/* Category card */
.ss-eps-category-card .ss-eps-body { justify-content: flex-end; }

/* End card */
.ss-eps-endcard { justify-content: center; align-items: stretch; text-decoration: none; background: radial-gradient(circle at top left, #2563eb 0, #0f172a 72%); -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.ss-eps-endcard .ss-eps-title { color: #fff; }
.ss-eps-endcard-inner { padding: 24px 18px; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 100%; text-align: center; align-items: center; }
.ss-eps-end-badge { width: 52px; height: 52px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .18); font-size: 26px; color: #fff; font-weight: 800; }

/* Dots */
.ss-eps-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.ss-eps-dot { width: 9px; height: 9px; border-radius: 999px; background: rgba(15, 23, 42, .18); cursor: pointer; transition: width .22s ease, background .22s ease; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.ss-eps-dot.is-active { width: 28px; background: #0f172a; }

/* Empty state */
.ss-eps-empty { padding: 18px; border-radius: 18px; background: #fff7ed; color: #9a3412; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .ss-eps-wrap { --ss-gap: 18px; }
    .ss-eps-slide { min-width: calc((100% - var(--ss-gap)) / 2); }
    .ss-eps-sectionbar { align-items: flex-start; flex-direction: column; }
    .ss-eps-toolbar { width: 100%; justify-content: space-between; }
    .ss-eps-body { padding: 16px; }
    .ss-eps-secondary-btn, .ss-eps-cart-btn { min-height: 44px; padding: 12px 13px; }
}

@media (max-width: 767px) {
    .ss-eps-wrap { --ss-gap: 12px; }
    .ss-eps-sectionbar { gap: 14px; margin-bottom: 14px; }
    .ss-eps-section-title { font-size: clamp(21px, 7vw, 30px); }
    .ss-eps-section-subtitle { font-size: 13px; line-height: 1.45; }
    .ss-eps-toolbar { width: 100%; gap: 8px; align-items: center; }
    .ss-eps-header-btn { flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 10px 14px; font-size: 12px; }
    .ss-eps-nav { gap: 8px; }
    .ss-eps-arrow { width: 40px; height: 40px; font-size: 20px; }
    .ss-eps-slide { min-width: calc(100% - 8px); }
    .ss-eps-card { border-radius: 18px; }
    .ss-eps-body { padding: 12px; gap: 8px; }
    .ss-eps-title { font-size: 15px; line-height: 1.3; }
    .ss-eps-price { font-size: 12px; }
    .ss-eps-actions { gap: 8px; }
    .ss-eps-secondary-btn, .ss-eps-cart-btn { min-height: 40px; padding: 10px 12px; border-radius: 14px; font-size: 12px; gap: 6px; }
    .ss-eps-qty { grid-template-columns: 32px minmax(0, 1fr) 32px; border-radius: 12px; }
    .ss-eps-qty-btn { height: 34px; font-size: 16px; }
    .ss-eps-qty-input { height: 34px; font-size: 12px; }
    .ss-eps-cart-message { font-size: 11px; min-height: 14px; }
    .ss-eps-endcard-inner { padding: 20px 14px; gap: 12px; }
    .ss-eps-end-badge { width: 46px; height: 46px; font-size: 22px; }
    .ss-eps-dots { gap: 7px; margin-top: 14px; }
    .ss-eps-dot { width: 8px; height: 8px; }
    .ss-eps-dot.is-active { width: 24px; }
}

@media (max-width: 480px) {
    .ss-eps-wrap { --ss-gap: 10px; }
    .ss-eps-slide { min-width: 100%; }
    .ss-eps-section-title { font-size: 20px; }
    .ss-eps-section-subtitle { font-size: 12px; }
    .ss-eps-header-btn { padding: 9px 12px; font-size: 11px; }
    .ss-eps-arrow { width: 36px; height: 36px; font-size: 18px; }
    .ss-eps-body { padding: 10px; }
    .ss-eps-title { font-size: 14px; }
    .ss-eps-price { font-size: 11px; }
    .ss-eps-secondary-btn, .ss-eps-cart-btn { min-height: 36px; padding: 9px 10px; font-size: 11px; border-radius: 12px; }
    .ss-eps-qty { grid-template-columns: 28px minmax(0, 1fr) 28px; }
    .ss-eps-qty-btn { height: 30px; font-size: 15px; }
    .ss-eps-qty-input { height: 30px; font-size: 11px; }
    .ss-eps-cart-icon svg { transform: scale(.9); }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .ss-eps-card, .ss-eps-thumb img, .ss-eps-secondary-btn, .ss-eps-cart-btn, .ss-eps-arrow, .ss-eps-dot { transition: none; }
    .ss-eps-card:hover { transform: none; }
    .ss-eps-card:hover .ss-eps-thumb img { transform: none; }
}


