/*
 * Nesa Underwear — Mobile-only overrides (≤767px).
 * Section-padding rules + the new mobile header/drawer + mobile carousels + newsletter.
 * The base "display:none" rules below (outside the media query) keep the new
 * mobile header hidden on desktop/tablet; it only shows ≤767px.
 */

/* Hidden everywhere by default — only revealed inside the ≤767px block below. */
.bp-mh,
.bp-drawer,
.bp-drawer-overlay { display: none; }
.bp-carousel-count { display: none; }    /* carousel page counter — shown only ≤767px */
.bp-badges-controls { display: none; }    /* injected badges arrows — shown only ≤767px */

@media (max-width: 767px) {

  /*
   * No page-level side padding on the homepage.
   *
   * This was 15px, added back when .oxa-page carried the layout. The sections
   * pay their own --nesa-gutter now, so keeping it stacked 15px on top of the
   * section's 20px and left the homepage inset 35px on a phone.
   */

  /* Single product page side gutter → 15px. Set on .site-main (content wrapper)
     and zero #primary so the two default WooCommerce wrappers don't stack. */
  body.single-product #primary { padding-inline: 0 !important; }
  body.single-product .site-main { padding-inline: 15px !important; }

  /* ── Padding math note ──
   * To get an EXACT side gap on the full-bleed sections we force them to 100vw
   * so the page gutter no longer applies, then the inner padding IS the total. */

  /* Home soft CTAs (both #1 and #3): exactly 40px each side. */
  body.home .oxa-cta--soft {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-inline: calc(50% - 50vw) !important;
    padding-inline: 40px !important;
    padding-block: 36px !important;
    box-sizing: border-box !important;
  }
  body.home .oxa-cta--soft .oxa-container {
    padding-inline: 0 !important;
    max-width: none !important;
  }

  /* Home video: exactly 15px each side; drop the dark frame shadow/border edge. */
  body.home .oxa-video {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-inline: calc(50% - 50vw) !important;
    box-sizing: border-box !important;
  }
  body.home .oxa-video .oxa-container {
    padding-inline: 15px !important;
    max-width: none !important;
  }
  body.home .oxa-video__frame {
    border: none !important;
    box-shadow: none !important;
  }

  /* ===================================================================
   * MOBILE PAGE GUTTERS — standard 15px side padding (matches the rest).
   * Target #main + the wrapper class so we outrank component rules that use
   * an id, e.g. blog_index's `#main.oxa-page:has(.bp-blog){padding-inline:0}`
   * and the bp-overrides zeroing on checkout.
   * =================================================================== */
  body.woocommerce-checkout #main.oxa-page,
  body.woocommerce-checkout #main.site-main {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  body.page-id-101799 #main.oxa-page {   /* Blog */
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  body.page-id-101839 .oxa-page {         /* Termet dhe Kushtet (already worked) */
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  body.bp-wishlist-page #main.oxa-page {  /* Wishlist — match the shop's 15px gutter
                                             (outranks bp-final.css's `padding:2rem 0`) */
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  /* Wishlist product cards — make them identical to the shop's mobile card.
   * The shop's card overrides live in bp-shop-mobile.php but only print on
   * archive pages, so they never reach the wishlist (a plain page). Mirror them
   * here, scoped to the wishlist. Keep in sync with bp-shop-mobile.php. */
  body.bp-wishlist-page ul.products li.product {
    border: 1px solid var(--nesa-line) !important; border-radius: 12px !important; background: #fff !important;
    padding: 1.25rem !important; gap: .875rem !important;
    text-align: left !important; align-items: stretch !important; overflow: hidden !important;
  }
  /* The square-image override that was here is deleted: it was written for
   * the donor build's wishlist markup and flattened the shared .nesa-card
   * (which sizes its own media frame now). */
  body.bp-wishlist-page ul.products li.product .woocommerce-loop-product__title {
    text-align: left !important; margin: 0 !important; padding: 0 !important; min-height: 0 !important;
    font-size: .9375rem !important; font-weight: 500 !important; color: var(--nesa-ink) !important; line-height: 1.4 !important;
    display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important;
  }
  body.bp-wishlist-page ul.products li.product .price {
    text-align: left !important; margin: 0 !important; padding: 0 !important;
    font-size: 1rem !important; font-weight: 700 !important; color: var(--nesa-ink) !important;
  }
  body.bp-wishlist-page ul.products li.product .button,
  body.bp-wishlist-page ul.products li.product a.add_to_cart_button {
    display: block !important; width: auto !important; align-self: stretch !important; margin: 0 !important;
    padding: .75rem 1rem !important; text-align: center !important;
    background: var(--nesa-ink) !important; color: #fff !important;
    border-radius: 9999px !important; font-size: .875rem !important; font-weight: 600 !important;
  }
  body.bp-wishlist-page ul.products li.product .button:hover,
  body.bp-wishlist-page ul.products li.product a.add_to_cart_button:hover { background: var(--nesa-ink) !important; color: #fff !important; }

  /* ===================================================================
   * MOBILE HEADER — ☰ left · logo center · cart right · search + meta below
   * Not sticky. The BAR uses the desktop "headroom" behaviour (JS): pins to
   * the top once scrolled past, hides on scroll-down, reveals on scroll-up.
   * =================================================================== */

  .bp-mh {
    display: block;
    position: relative;
    background: #fff;
    border-bottom: 1px solid var(--nesa-line);
  }

  /* Top bar */
  .bp-mh__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 64px;
    padding: 0 0.75rem;
    background: #fff;
    transition: transform 0.32s ease;
    will-change: transform;
  }

  /* Headroom: pinned + hide/reveal (mirrors desktop bp-headroom) */
  .bp-mh__bar.bp-mh-stuck {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 55;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  }
  .bp-mh__bar.bp-mh-stuck.bp-mh--hidden { transform: translateY(-100%); }
  .bp-mh-spacer { display: none; }
  .bp-mh-spacer.is-active { display: block; }

  .bp-mh__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--nesa-ink);
    cursor: pointer;
    position: relative;
    text-decoration: none;
  }

  /* Hamburger icon (3 lines) */
  .bp-mh__burger,
  .bp-mh__burger::before,
  .bp-mh__burger::after {
    content: "";
    display: block;
    width: 22px;
    height: 2px;
    background: var(--nesa-ink);
    border-radius: 2px;
  }
  .bp-mh__burger { position: relative; }
  .bp-mh__burger::before { position: absolute; left: 0; top: -7px; }
  .bp-mh__burger::after  { position: absolute; left: 0; top: 7px; }

  /* Logo — 90px, centered */
  /*
   * Dead-centre of the BAR, not of the leftover flex space — one burger on
   * the left vs two icons on the right made the flex-centred logo drift
   * left. Absolute positioning centres it on the bar itself; the flex row
   * keeps laying out burger / wish / cart around it.
   */
  .bp-mh__bar { position: relative; }
  .bp-mh__wish { margin-left: auto; }
  .bp-mh__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    min-width: 0;
  }
  /* 56px, not the old 90 — the nesa wordmark at 90px dwarfed the bar; the
   * bar itself comes down to a standard mobile-header height to match. */
  .bp-mh__logo img { height: 56px; width: auto; display: block; object-fit: contain; }
  .bp-mh__wordmark {
    font-family: var(--nesa-font-serif, serif);
    font-size: 26px;
    letter-spacing: 0.14em;
    text-transform: lowercase;
    color: var(--nesa-ink, #111);
  }
  .bp-mh__wish { position: relative; }

  /* Cart count bubble */
  .bp-mh__cart-count {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9999px;
    background: var(--nesa-ink);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
  }

  /* Search row */
  .bp-mh__search {
    position: relative;
    padding: 0 0.75rem 0.625rem;
  }
  .bp-mh__search-icon {
    position: absolute;
    left: 1.625rem;
    top: 12px;
    color: var(--nesa-ink-soft);
    pointer-events: none;
  }
  .bp-mh__search input {
    width: 100%;
    height: 44px;
    padding: 0 1rem 0 2.75rem;
    border: 1px solid var(--nesa-line);
    border-radius: 9999px;
    font-size: 16px;            /* ≥16px prevents iOS zoom-on-focus */
    color: var(--nesa-ink);
    background: #fff;
    outline: none;
  }
  .bp-mh__search input:focus { border-color: var(--nesa-ink); }

  /* Meta section: stack the two desktop-styled .bp-meta-block rows, with a
     top border dividing it from the search. */
  .bp-mh__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 0.9rem;
    border-top: 1px solid var(--nesa-line);
  }

  /* ---- Overlay + drawer ---- */
  .bp-drawer-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 60;
  }
  .bp-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

  .bp-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 86%;
    max-width: 360px;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 70;
    overflow: hidden;                /* the panels scroll, not the drawer */
  }
  .bp-drawer.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.18); }

  /* Persistent X header (stays put across all panels) */
  .bp-drawer__head { flex: 0 0 auto; display: flex; padding: 0.75rem 0.75rem 0.5rem; }
  .bp-drawer__close {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; background: none; border: 0; color: var(--nesa-ink); cursor: pointer;
  }

  /* ---- Sliding panels ----
   * Root sits at translateX(0); each sub-panel waits at translateX(100%) and
   * slides over the root when activated. "Back" slides it out to the right. */
  .bp-drawer__viewport { position: relative; flex: 1 1 auto; overflow: hidden; }

  .bp-drawer__panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.28s ease;
  }
  .bp-drawer__panel--root { transform: translateX(0); }   /* base layer */
  .bp-drawer__panel.is-active { transform: translateX(0); }

  /* Root list */
  .bp-drawer__list { list-style: none; margin: 0; padding: 0; }
  .bp-drawer__item { border-bottom: 1px solid #eef0f2; }

  .bp-drawer__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.95rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--nesa-ink);
    background: none;
    border: 0;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }
  .bp-drawer__item--account .bp-drawer__link { justify-content: flex-start; }
  .bp-drawer__item--account svg:not(.bp-drawer__chev) { color: var(--nesa-ink); flex: 0 0 auto; }
  .bp-drawer__acct-label { display: inline-flex; align-items: center; gap: 0.6rem; }
  .bp-drawer__chev { color: var(--nesa-ink-soft); flex-shrink: 0; }   /* points right, no rotation */

  /* Back row at the top of each sub-panel */
  .bp-drawer__back {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 0.4rem;
    width: 100%; padding: 0.85rem 1.25rem;
    background: #f5f6f7; border: 0; border-bottom: 1px solid var(--nesa-line);
    font-size: 0.95rem; font-weight: 600; color: var(--nesa-ink);
    text-align: left; cursor: pointer;
  }
  .bp-drawer__back svg { color: var(--nesa-ink-soft); flex: 0 0 auto; }

  /* Sub-panel link lists — full-width rows with separators (image 2) */
  .bp-drawer__sub { display: block; padding: 0; }
  .bp-drawer__subhead {
    margin: 0;
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--nesa-ink);
  }
  .bp-drawer__sub a {
    display: block;
    padding: 0.85rem 1.25rem;
    font-size: 0.9375rem;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f1f2f4;
  }
  .bp-drawer__sub a:active { color: var(--nesa-ink); }

  /* Categories promo card (mirrors the desktop mega-menu promo) */
  .bp-drawer__promo {
    display: block;
    margin: 1rem 1rem 1.5rem;
    padding: 1.25rem;
    border-radius: 12px;
    background: var(--nesa-ink);
    color: #fff;
    text-decoration: none;
  }
  .bp-drawer__promo-title { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.25; }
  .bp-drawer__promo-text  { display: block; margin: 0.5rem 0 1rem; font-size: 0.85rem; line-height: 1.45; opacity: 0.92; }
  .bp-drawer__promo-btn   {
    display: block; padding: 0.75rem 1rem; text-align: center;
    background: #fff; color: var(--nesa-ink); border-radius: 9999px; font-weight: 700; font-size: 0.9rem;
  }

  /* ===================================================================
   * MOBILE CAROUSELS
   * (Higher specificity + !important so these beat each component's own
   *  responsive --per-view rules regardless of stylesheet load order.)
   * =================================================================== */

  /* Awards / badges → swipeable carousel, 2 visible at a time */
  .oxa-badges .oxa-badges__row {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }
  .oxa-badges .oxa-badges__row::-webkit-scrollbar { display: none; }
  .oxa-badges .oxa-badges__item {
    flex: 0 0 calc((100% - 1rem) / 2) !important;   /* exactly 2 per view */
    max-width: none !important;
    scroll-snap-align: start;
  }
  /* Uniform badge image height (template sets per-badge max-height inline → !important). */
  .oxa-badges .oxa-badges__img {
    height: 80px !important;
    max-height: 80px !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* Categories → 2 per page, tighter 15px gap, counter pagination (dots hidden). */
  .bp-cats .bp-cats__track {
    --bp-cats-per: 2 !important;
    gap: 15px !important;
  }
  .bp-cats .bp-cats__card { flex: 0 0 calc((100% - 15px) / 2) !important; }
  .bp-cats .bp-cats__dots { display: none !important; }

  /* Products (bestsellers) → 1 per page (dots hidden, counter shown instead) */
  .bp-bestsellers .bp-bestsellers__track { --bp-bs-per: 1 !important; }
  .bp-bestsellers .bp-bestsellers__dots { display: none !important; }

  /* Shared carousel page counter (bestsellers + categories + badges) */
  .bp-carousel-count {
    display: inline-block;
    min-width: 52px;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--nesa-ink);
  }

  /* Injected badges arrows + counter row */
  .bp-badges-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
  }
  .bp-badges-nav {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: none; cursor: pointer;
    font-size: 1.5rem; line-height: 1; color: var(--nesa-ink);
    border-radius: 9999px; transition: background 0.15s ease, color 0.15s ease;
  }
  .bp-badges-nav:hover { background: var(--nesa-cream); color: var(--nesa-ink); }

  /* ===================================================================
   * NEWSLETTER — every page (mobile). Input and button as two separate
   * outlined boxes stacked with a gap; button is a pill, same height as input.
   * Scoped via the .oxa-newsletter ancestor so specificity beats the
   * component's own !important rules regardless of load order.
   * =================================================================== */
  .oxa-newsletter .oxa-newsletter__title {
    font-size: 30px !important;
    font-weight: 700 !important;
  }
  .oxa-newsletter .oxa-newsletter__form {
    flex-direction: column !important;
    gap: 16px !important;
    max-width: 100% !important;
  }
  .oxa-newsletter .oxa-newsletter__input {
    height: 56px !important;
    box-sizing: border-box !important;
    border: 1px solid var(--nesa-ink) !important;
    border-radius: 10px !important;
  }
  .oxa-newsletter .oxa-newsletter__btn {
    width: 100% !important;
    height: 56px !important;
    box-sizing: border-box !important;
    border: 1px solid var(--nesa-ink) !important;
    border-radius: 9999px !important;           /* pill */
  }
  .oxa-newsletter .oxa-newsletter__privacy a {
    font-weight: 700 !important;
    color: var(--nesa-ink) !important;
  }

  /* ===================================================================
   * SINGLE PRODUCT GALLERY — show the framed image's full border.
   * bp-product.css applies overflow:hidden to the gallery wrappers at
   * ≤1024px, which clips the top/bottom of the 1px image border. Let it
   * show; horizontal scroll is still prevented by the .site-main
   * overflow-x:hidden ancestor. Doubled body class bumps specificity so
   * this wins over bp-product.css (which loads after this file).
   * =================================================================== */
  body.single-product.single-product div.product .woocommerce-product-gallery,
  body.single-product.single-product div.product .woocommerce-product-gallery .flex-viewport,
  body.single-product.single-product div.product .woocommerce-product-gallery__wrapper {
    overflow: visible !important;
  }

  /* ===================================================================
   * FOOTER (mobile) — 15px left gutter + reference-style "Follow us" block:
   * left-aligned brand column with a heading above the community text and
   * the social icons in a left-aligned row.
   * =================================================================== */
  /* No footer padding override: .bp-footer .bp-container pays --nesa-gutter on
   * both sides now, and a 15px left against a 20px right read as crooked. */

  /* The three `align-self: flex-start !important` rules that were here forced
   * the wordmark and social row left on phones only — the same centring bug,
   * patched at this end instead of at the source. bp-footer.css no longer
   * centres them at any width, so these are redundant. */

  /* "Na ndiqni" heading rendered as a label above the community text. */
  .bp-footer__brand .bp-footer__about::before {
    content: "Na ndiqni";
    display: block;
    margin-bottom: 0.75rem;
    color: #000;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
  }

}