/* PIYAMO v2.0.3 — eight mobile storefront fixes.
 * Kept separate so older compiled WooCommerce and brand styling are unchanged.
 * Preserve all error messages, native controls and keyboard focus indicators.
 */

/* 1 — Do not reserve a 108px footer spacer underneath copyright.
   The fixed jewellery cart dock sits over the viewport, not inside the footer. */
@media (max-width: 767px) {
  body.woocommerce-shop .piyamo-mobile-footer,
  body.post-type-archive-product .piyamo-mobile-footer,
  body.tax-product_cat .piyamo-mobile-footer,
  body.tax-product_tag .piyamo-mobile-footer,
  body.piyamo-mobile-shop-ui-active .piyamo-mobile-footer {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }
  body.woocommerce-shop .piyamo-mobile-footer-bottom,
  body.post-type-archive-product .piyamo-mobile-footer-bottom,
  body.tax-product_cat .piyamo-mobile-footer-bottom,
  body.tax-product_tag .piyamo-mobile-footer-bottom,
  body.piyamo-mobile-shop-ui-active .piyamo-mobile-footer-bottom,
  body.piyamo-mobile-shop-ui-active.piyamo-mobile-store-chrome .piyamo-mobile-footer-bottom {
    margin: 0 !important;
    padding: 12px 14px calc(13px + env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
  }
  body.piyamo-mobile-shop-ui-active .piyamo-mobile-footer-inner {
    margin-bottom: 0 !important; padding-bottom: 0 !important;
  }
  /* Reserve space where it's actually needed: near the last product, above
     the fixed cart dock, never *after* the copyright line. */
  body.woocommerce-shop .shop-archive-wrapper,
  body.post-type-archive-product .shop-archive-wrapper,
  body.tax-product_cat .shop-archive-wrapper,
  body.tax-product_tag .shop-archive-wrapper {
    margin-bottom: 0 !important;
    padding-bottom: 24px !important;
  }
}

/* 2 — Specification panel and recommendations touch naturally, no huge blank. */
body.single-product .piyamo-pdp-grid {align-content:start !important;}
body.single-product .piyamo-product-tabs-section--inline {margin-bottom:0 !important;}
body.single-product .piyamo-pdp-main {margin-bottom:0 !important; min-height:0 !important;}
@media (max-width:767px) {
  body.single-product .piyamo-pdp-grid {row-gap:8px !important;}
  body.single-product .piyamo-pdp-main {padding-bottom:2px !important;}
  body.single-product .piyamo-product-tabs-section--inline {
    padding-bottom:6px !important; margin:0 !important;
  }
  body.single-product .piyamo-related-section {
    margin:0 !important; padding-top:10px !important;
  }
}

/* 3 — Gallery dots outside the photo: PDP markup moved after the image. */
body.single-product .piyamo-gallery > .piyamo-pdp-dots {
  position:static !important;
  left:auto !important; bottom:auto !important;
  transform:none !important;
  display:flex !important; width:max-content; max-width:100%;
  justify-content:center !important; align-items:center !important;
  align-self:center !important;
  margin:0 auto 2px !important;
  border:1px solid rgba(123,90,124,.14) !important;
  background:#f9f0f5 !important;
  box-shadow:none !important;
  z-index:auto !important;
}
/* Archive/card indicators were already in a toolbar outside the image, but
   old CSS incorrectly set position:absolute on them. */
.product-card .piyamo-card-gallery-toolbar .piyamo-card-dots,
.product-card .piyamo-card-dots.piyamo-card-dots--outside {
  position:static !important;
  left:auto !important; bottom:auto !important;
  transform:none !important;
  display:flex !important;
  margin:0 auto !important;
  box-shadow:none !important;
}

/* 5 — Back-to-top to the very bottom-right on CART and CHECKOUT only.
   Keep the controls out of the keyboard viewport when typing. */
@media (max-width:767px) {
  body.woocommerce-cart .piyamo-global-scroll-top,
  body.woocommerce-checkout .piyamo-global-scroll-top,
  body.woocommerce-cart.piyamo-mobile-store-chrome .piyamo-global-scroll-top,
  body.woocommerce-checkout.piyamo-mobile-store-chrome .piyamo-global-scroll-top,
  body.woocommerce-cart.piyamo-mobile-shop-ui-active .piyamo-global-scroll-top,
  body.woocommerce-checkout.piyamo-mobile-shop-ui-active .piyamo-global-scroll-top {
    position:fixed !important;
    right:10px !important;
    bottom:calc(10px + env(safe-area-inset-bottom)) !important;
    width:40px !important; height:40px !important;
    z-index:170 !important;
  }
  body.piyamo-keyboard-open .piyamo-global-scroll-top,
  body.piyamo-webview-keyboard-open .piyamo-global-scroll-top {opacity:0 !important;pointer-events:none !important;}
}

/* 6, 8 — More information visible per screen while keeping readable controls.
   These 40px controls are for Android WebView and narrow mobile browsers;
   iOS uses 16px text below to avoid zooming when the keyboard appears. */
@media (max-width:767px) {
  body.woocommerce-checkout .checkout-section,
  body.woocommerce-checkout .shipping-section,
  body.woocommerce-checkout .billing-section {
    padding:10px 11px !important;
  }
  body.woocommerce-checkout .billing-fields-grid,
  body.woocommerce-checkout .shipping-fields-grid {
    row-gap:5px !important; column-gap:8px !important;
  }
  body.woocommerce-checkout .checkout-section .form-field-custom,
  body.woocommerce-checkout .checkout-section .form-row {
    margin-bottom:4px !important;
  }
  body.woocommerce-checkout .checkout-section :is(.billing-fields-grid,.shipping-fields-grid) .form-field-custom label,
  body.woocommerce-checkout .checkout-section .form-row > label,
  body.woocommerce-account .woocommerce-MyAccount-content form label,
  body.woocommerce-account .woocommerce :is(.woocommerce-form-login,.woocommerce-form-register,.woocommerce-ResetPassword) .form-row > label,
  body.woocommerce-account .account-auth-card .form-row > label {
    font-size:10px !important; line-height:1.25 !important;
    margin-bottom:3px !important;
    letter-spacing:0 !important;
  }
  body.woocommerce-checkout .checkout-section :is(input.input-text,input.f-input,select.f-input,select),
  body.woocommerce-checkout .checkout-section .select2-container .select2-selection--single,
  body.woocommerce-checkout .billing-fields-grid :is(input.input-text,input.f-input,select.f-input,select),
  body.woocommerce-checkout .shipping-fields-grid :is(input.input-text,input.f-input,select.f-input,select),
  body.woocommerce-account .woocommerce-MyAccount-content form :is(input.input-text,input[type="text"],input[type="email"],input[type="password"],input[type="tel"],input[type="number"],select),
  body.woocommerce-account .woocommerce :is(.woocommerce-form-login,.woocommerce-form-register,.woocommerce-ResetPassword) input.input-text,
  body.woocommerce-account .account-auth-card :is(.woocommerce-form-login,.woocommerce-form-register) .form-row input.input-text {
    box-sizing:border-box !important; width:100% !important;
    height:40px !important; min-height:40px !important; max-height:40px !important;
    padding:0 10px !important;
    border-radius:9px !important;
    font-size:14px !important;
    line-height:normal !important;
  }
  body.woocommerce-checkout .checkout-section .select2-selection__rendered,
  body.woocommerce-checkout .billing-fields-grid .select2-selection__rendered,
  body.woocommerce-checkout .shipping-fields-grid .select2-selection__rendered {
    font-size:13px !important; line-height:38px !important;
  }
  body.woocommerce-checkout .checkout-section .select2-selection__arrow,
  body.woocommerce-checkout .billing-fields-grid .select2-selection__arrow,
  body.woocommerce-checkout .shipping-fields-grid .select2-selection__arrow {
    height:40px !important;
  }
  body.woocommerce-checkout .checkout-section textarea,
  body.woocommerce-account .woocommerce-MyAccount-content form textarea {
    height:auto !important; min-height:65px !important; font-size:13px !important;
  }
  body.woocommerce-checkout .checkout-section .section-heading {font-size:13.5px !important; margin-bottom:7px !important;}
  body.woocommerce-account .account-auth-card {padding:12px !important;}
  body.woocommerce-account .account-auth-card h2.account-auth-title {font-size:20px !important; margin-bottom:7px !important;}
  body.woocommerce-account .account-auth-card .form-row,
  body.woocommerce-account .woocommerce :is(.woocommerce-form-login,.woocommerce-form-register) .form-row {
    margin-bottom:7px !important;
  }
  body.woocommerce-account .woocommerce-MyAccount-content form .form-row {margin-bottom:7px !important;}
  body.woocommerce-account .woocommerce-MyAccount-content :is(.woocommerce-EditAccountForm,.woocommerce-Address form) {padding:10px !important;}
  body.woocommerce-account .woocommerce-EditAccountForm fieldset {
    margin-top:12px !important; padding:12px !important;
  }
  body.woocommerce-account .woocommerce-EditAccountForm fieldset legend {font-size:12px !important;}
  body.woocommerce-account .woocommerce-EditAccountForm fieldset .form-row {margin-bottom:7px !important;}
  body.woocommerce-account .woocommerce-MyAccount-content :is(.description,.woocommerce-form-row em) {
    font-size:10px !important; line-height:1.35 !important;
  }
}
/* Prevent iOS Safari/WebView auto-zoom on focused inputs. */
@supports (-webkit-touch-callout: none) {
  @media (max-width:767px) {
    body.woocommerce-checkout .checkout-section :is(input,select,textarea),
    body.woocommerce-account .woocommerce :is(input,select,textarea) {font-size:16px !important;}
  }
}

/* 7 — Remove account-only forced blank height and surplus bottom padding. */
body.woocommerce-account .site-main {min-height:0 !important; padding-bottom:12px !important;}
body.woocommerce-account .site-content {min-height:0 !important; padding-bottom:0 !important;}
body.woocommerce-account .woocommerce-MyAccount-wrapper {margin-bottom:0 !important; padding-bottom:0 !important;}
@media (max-width:767px) {
  body.woocommerce-account .woocommerce,
  body.woocommerce-account .woocommerce-MyAccount-content,
  body.woocommerce-account .site-content .container {
    min-height:0 !important;
    margin-bottom:0 !important;
    padding-bottom:0 !important;
  }
  body.woocommerce-account .piyamo-mobile-footer {margin-top:0 !important;}
  body.woocommerce-account .piyamo-mobile-footer-bottom {
    padding-bottom:calc(13px + env(safe-area-inset-bottom)) !important;
  }
  body.woocommerce-account .account-page-header {margin-bottom:8px !important;}
  body.woocommerce-account .woocommerce-MyAccount-navigation {margin-bottom:8px !important;}
}

/* Highest-specificity correction for legacy :not(cart):not(checkout) spacer. */
@media (max-width:767px) {
  body:not(.woocommerce-cart):not(.woocommerce-checkout) footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom,
  body.woocommerce-cart footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom,
  body.woocommerce-checkout footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom {
    padding:12px 14px calc(13px + env(safe-area-inset-bottom)) !important;
    margin-bottom:0 !important;
    min-height:0 !important;
  }
}
