/* PIYAMO v2.0.4 — targeted WooCommerce mobile layout maintenance.
   Retain accessible keyboard focus and native checkout behavior. */

/* 1. Preserve compact footer styling while leaving the treasure dock fixed.
   The v2.0.5 stylesheet reserves an unobstructed scroll landing area. */
@media (max-width: 767px) {
  /* Older bundles reserve 92px in the copyright row; it belongs nowhere
     after copyright, including the product and account footers. */
  body.single-product footer.piyamo-mobile-footer,
  body.woocommerce-account footer.piyamo-mobile-footer,
  body.woocommerce-shop footer.piyamo-mobile-footer {
    margin: 0 !important; padding-bottom: 0 !important;
  }
  body.single-product footer.piyamo-mobile-footer .piyamo-mobile-footer-inner,
  body.woocommerce-account footer.piyamo-mobile-footer .piyamo-mobile-footer-inner {
    padding-bottom: 0 !important; margin-bottom: 0 !important;
  }
  body.single-product footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom,
  body.piyamo-mobile-store-chrome.single-product footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom,
  body.woocommerce-account footer.piyamo-mobile-footer .piyamo-mobile-footer-bottom {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) !important;
    margin: 0 !important; min-height: 0 !important;
  }
  /* The account page had an obsolete 92px reservation on .woocommerce;
     overriding the exact earlier selector fixes every My Account tab. */
  body.piyamo-mobile-store-chrome.woocommerce-account .woocommerce,
  body.woocommerce-account .site-content .woocommerce,
  body.woocommerce-account .site-content .woocommerce-MyAccount-wrapper,
  body.woocommerce-account .site-content .woocommerce-MyAccount-content {
    min-height: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  body.woocommerce-account .site-content #primary,
  body.woocommerce-account .site-content #main,
  body.woocommerce-account .site-content #main .content-inner {
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  body.woocommerce-account .site-content #main { padding-bottom: 8px !important; }
}

/* 2. Plugin-provided Points redemption control: match the original coupon
   input + button design without changing its form, AJAX or event handlers. */
body.woocommerce-cart .piyamo-points-compact {
  display: flex !important;
  flex-flow: row wrap !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin: 8px 0 !important;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-input {
  display: block !important;
  flex: 1 1 130px !important;
  width: auto !important;
  min-width: 0 !important;
  height: 39px !important;
  min-height: 39px !important;
  max-height: 39px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 11px !important;
  border: 1px solid #d9c8d7 !important;
  border-radius: 9px !important;
  background: #fffafd !important;
  box-shadow: none !important;
  color: #3c2f3a !important;
  font: 400 12px/1.4 Poppins, Satoshi, sans-serif !important;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-input:focus {
  border-color: #7b5a7c !important;
  outline: 2px solid rgba(123,90,124,.22) !important;
  outline-offset: 1px !important;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-input::placeholder {
  color: #857386 !important; opacity: 1;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-button,
body.woocommerce-cart .piyamo-points-compact button.piyamo-points-button {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  justify-content: center !important;
  align-items: center !important;
  height: 39px !important;
  min-height: 39px !important;
  min-width: 96px !important;
  max-width: 45% !important;
  margin: 0 !important;
  padding: 0 13px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  border: 1px solid #684a6d !important;
  border-radius: 9px !important;
  background: #684a6d !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font: 600 11px/1.2 Poppins, Satoshi, sans-serif !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-button:hover {
  background: #54385a !important;
  border-color: #54385a !important;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-button:focus-visible {
  outline: 2px solid #634565 !important;
  outline-offset: 2px !important;
}
body.woocommerce-cart .piyamo-points-compact .piyamo-points-button:disabled {
  opacity: .55 !important; cursor: not-allowed;
}
/* Supporting notes appear beneath the input row, not squeezed beside it. */
body.woocommerce-cart .piyamo-points-compact > :not(.piyamo-points-input):not(.piyamo-points-button) {
  flex-basis: 100%; max-width: 100%;
}

/* 3. Shipping form: mobile WebView compact sizing, including Select2. */
@media (max-width: 767px) {
  body.woocommerce-checkout .checkout-section:is(.shipping-section,.billing-section),
  body.woocommerce-checkout .shipping-section,
  body.woocommerce-checkout .billing-section { padding: 8px 10px !important; }
  body.woocommerce-checkout .checkout-section :is(.billing-fields-grid,.shipping-fields-grid) {
    row-gap: 3px !important; column-gap: 7px !important;
  }
  body.woocommerce-checkout .checkout-section :is(.billing-fields-grid,.shipping-fields-grid) .form-field-custom,
  body.woocommerce-checkout .checkout-section .form-row {
    margin: 0 0 3px !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 {
    display: block;
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    margin: 0 0 2px !important;
    letter-spacing: 0 !important;
  }
  body.woocommerce-checkout .checkout-section :is(input.f-input,input.input-text,select.f-input,select),
  body.woocommerce-checkout .billing-fields-grid :is(input.f-input,input.input-text,select),
  body.woocommerce-checkout .shipping-fields-grid :is(input.f-input,input.input-text,select),
  body.woocommerce-checkout .checkout-section .select2-container .select2-selection--single {
    box-sizing: border-box !important;
    min-width: 0 !important;
    height: 37px !important;
    min-height: 37px !important;
    max-height: 37px !important;
    padding: 0 9px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    line-height: normal !important;
  }
  body.woocommerce-checkout .checkout-section input::placeholder {font-size: 12px !important;}
  body.woocommerce-checkout .checkout-section .select2-selection__rendered,
  body.woocommerce-checkout :is(.billing-fields-grid,.shipping-fields-grid) .select2-selection__rendered {
    font-size: 12px !important;
    line-height: 35px !important;
    padding-left: 0 !important;
  }
  body.woocommerce-checkout .checkout-section .select2-selection__arrow,
  body.woocommerce-checkout :is(.billing-fields-grid,.shipping-fields-grid) .select2-selection__arrow { height: 37px !important; }
  body.woocommerce-checkout .checkout-section .section-heading { font-size: 13px !important; margin-bottom: 5px !important; }
  body.woocommerce-checkout .checkout-section :is(.billing-fields-grid,.shipping-fields-grid) :is(input,select):focus {
    outline-offset: 1px !important;
  }
}
/* Avoid automatic zoom in iOS Safari / WKWebView; Android keeps the 12px text. */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 767px) {
    body.woocommerce-checkout .checkout-section :is(input,select,textarea),
    body.woocommerce-checkout .checkout-section .select2-selection__rendered {font-size: 16px !important;}
  }
}
