/* PL317 – Bollywood TEST: responsive presentation only. No order/business logic. */
@media (max-width: 767.98px) {
  /* PL318: Inline search like PL315. No fixed results layer or nested scroller. */
  body.pt-menu-search-active #pt-sticky-topbar .pt-cat-bar-wrapper { display:none !important; }
  body.pt-menu-search-active #menuListing .pt-search-results-heading { display:none !important; }
  body.pt318-search-focused #pt-sticky-topbar .pt-service-toggle,
  body.pt-menu-search-active #pt-sticky-topbar .pt-service-toggle,
  #pt-sticky-topbar.pt-topbar-pinned .pt-service-toggle { display:none !important; }
  #pt-sticky-topbar #search_text { font-size:16px !important; }
  /* The listing stays in the document. Browser page scrolling remains native. */
  body.pt-menu-search-active #menuListing { position:static !important; height:auto !important; max-height:none !important; overflow:visible !important; }
  /* Product modal: choose options without expanding horizontally or zooming. */
  #addtocartModal { overflow-x: hidden !important; }
  #addtocartModal .modal-dialog {
    width: calc(100% - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    height: calc(min(var(--pt317-modal-height, 100svh), 100svh) - 16px) !important;
    max-height: calc(min(var(--pt317-modal-height, 100svh), 100svh) - 16px) !important;
  }
  #addtocartModal .modal-content,
  #addtocartModal .modal-body,
  #addtocartModal .pt-mobile-modal-action { min-width:0 !important; max-width:100%; box-sizing:border-box; }
  #addtocartModal input[type=text],
  #addtocartModal input[type=number],
  #addtocartModal textarea,
  #addtocartModal select { font-size:16px !important; max-width:100%; }
  #addtocartModal .modal-body { overflow-x:hidden !important; overflow-wrap:anywhere; }
}
/* Landscape: preserve screen space, reduce clipped cart/product content. */
@media (orientation:landscape) and (max-height: 550px) and (pointer:coarse) {
  #addtocartModal .modal-dialog { margin:4px auto !important; max-height:calc(var(--pt317-modal-height, 100dvh) - 8px) !important; height:calc(var(--pt317-modal-height, 100dvh) - 8px) !important; }
  #addtocartModal .modal-body { padding-top:24px !important; }
  #addtocartModal .pt-mobile-modal-action { padding-bottom:4px !important; }
  #loginModal .modal-dialog, #AddressModal .modal-dialog { max-width:min(560px, calc(100vw - 24px)) !important; margin:8px auto !important; }
  #loginModal .modal-content, #AddressModal .modal-content { max-height:calc(var(--pt317-modal-height, 100dvh) - 16px) !important; overflow-y:auto !important; }
  #checkout_cart_details { max-width:100%; min-width:0; }
}

/* PL319: eliminate delayed modal travel on touch devices. Visual only.
   The viewport height may still adjust when the OS keyboard opens. */
@media (pointer:coarse) and (max-width: 1199.98px) {
  #addtocartModal .modal-dialog,
  #loginModal .modal-dialog,
  #registerModal .modal-dialog,
  #wfsServiceModal .modal-dialog,
  #AddressModal .modal-dialog {
    transition: none !important;
    -webkit-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
  }
  #addtocartModal.fade .modal-dialog,
  #loginModal.fade .modal-dialog,
  #registerModal.fade .modal-dialog,
  #wfsServiceModal.fade .modal-dialog,
  #AddressModal.fade .modal-dialog {
    transform: none !important;
    -webkit-transform: none !important;
  }
}
/* A configured banner may be shown, but an empty section must not
   reserve space between the top bar and the product list. */
.special-menu-for-time:not(:has(.pt-savings-banner)) {
  display: none !important;
}

/* PL320: do not overlay the keyboard/search input with the back-to-top button. */
@media (max-width: 767.98px) {
  body.pt318-search-focused #pt-scroll-top { opacity:0 !important; visibility:hidden !important; pointer-events:none !important; }
}

/* PL321: eliminate mobile reset heading even during asynchronous redraws. */
@media (max-width: 767.98px) {
  #menuListing .pt-search-results-heading,
  #menuListing #pt_search_reset_btn { display:none !important; }
}

/* PL322: a global document scroll button must not float above the cart
   drawer or checkout. The cart has its own independent scroll area. */
body:not(.pt-customer-menu-page) #pt-scroll-top,
body:has(.sidebar-cart-active.inside) #pt-scroll-top,
body:has(.main-wrapper.overlay-active) #pt-scroll-top {
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
/* Keep the cart's own navigation and close button inside the viewport.
   This touches only the already-open customer cart, not checkout logic. */
@media (max-width: 1199.98px) {
  .sidebar-cart-active.inside {
    box-sizing:border-box !important;
    max-width:100vw !important;
    left:0 !important;
    right:0 !important;
  }
  .sidebar-cart-active.inside > .pt-cart-menu-back-fixed {
    max-width:calc(100% - 84px) !important;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}


/* PL323 – Bollywood TEST: smartphone landscape checkout presentation ONLY.
   A low-height touch viewport should not inherit the desktop 7/5 columns.
   No changes to form fields, values, validation, scripts, or payment controls. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1199.98px) and (pointer: coarse) {
  .checkout-section .checkout-section-all > .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: clamp(12px, 2.5vw, 28px) !important;
    padding-right: clamp(12px, 2.5vw, 28px) !important;
    box-sizing: border-box;
  }
  .checkout-section .checkout-section-all > .container > .row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
  .checkout-section .checkout-section-all > .container > .row > .col-lg-7,
  .checkout-section .checkout-section-all > .container > .row > .col-md-7,
  .checkout-section .checkout-section-all > .container > .row > .col-lg-5,
  .checkout-section .checkout-section-all > .container > .row > .col-md-5 {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .checkout-section .checkout-section-all #payment-form,
  .checkout-section .checkout-section-all .details-section,
  .checkout-section .checkout-section-all .checkout-total-section,
  .checkout-section .checkout-section-all #checkout,
  .checkout-section .checkout-section-all .checkout-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  /* Disable desktop sticky/fixed summary in the stacked landscape flow. */
  .checkout-section .checkout-section-all .checkout-total-section,
  .checkout-section .checkout-section-all .checkout-total-section.pt-summary-fixed,
  .checkout-section .checkout-section-all .checkout-total-section.pt-summary-bottom,
  .checkout-section .checkout-section-all .checkout-sticky {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .checkout-section .checkout-section-all .details-section {
    padding-top: 10px !important;
  }
  .checkout-section .checkout-section-all .details-section .section {
    padding: clamp(12px, 2vw, 22px) !important;
  }
  .checkout-section .pt-checkout-service-grid,
  .checkout-section #pt-delivery-time-container {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .checkout-section #checkout-form input,
  .checkout-section #checkout-form select,
  .checkout-section #checkout-form textarea {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 16px;
  }
  .checkout-section .checkout-banner img.pt-checkout-location-map {
    max-height: 170px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
  }
  .checkout-section .checkout-section-all .pt-payment-summary {
    flex-wrap: wrap;
    min-width: 0;
  }
}


/* PL324 – Bollywood TEST: existing delivery-address search, mobile presentation ONLY.
   The same #wfsServiceModal, Google suggestions and server validation remain unchanged.
   Do not introduce a second address dialog or change click/selection handlers. */
@media (max-width:1199.98px) and (pointer:coarse) {
  /* The modal stays on its established visualViewport positioning controller. */
  #wfsServiceModal.pt112-mobile .wfsmodal-body,
  #wfsServiceModal.pt112-mobile .wfs-service-time-wrapper,
  #wfsServiceModal.pt112-mobile .service-tab-pane { min-width:0; box-sizing:border-box; }

  /* Clear, finger-friendly existing search field (also suppresses iOS input autozoom). */
  #wfsServiceModal.pt112-mobile #modal_address_autocomplete {
    width:100%; max-width:100%; min-width:0;
    min-height:52px; padding:12px 14px;
    font-size:16px !important; line-height:1.35;
    border:1.5px solid #cfd5df; border-radius:12px;
    box-sizing:border-box; background:#fff; color:#222;
  }
  #wfsServiceModal.pt112-mobile #modal_address_autocomplete:focus {
    outline:2px solid #ef7c27; outline-offset:0;
    border-color:#ef7c27;
  }
  #wfsServiceModal.pt112-mobile #modal_address_autocomplete::placeholder {
    color:#707781; opacity:1;
  }

  /* More than two suggestions can now be seen in the SAME existing list.
     The height is still bounded by visual viewport so the keyboard won't cover it. */
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-mobile-suggestions:not([hidden]) {
    display:block !important;
    box-sizing:border-box !important;
    width:100% !important;
    max-height:min(48dvh,320px) !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
    margin:8px 0 0 !important;
    padding:0 !important;
    border:1px solid #e2e5eb !important;
    border-radius:12px !important;
    background:#fff !important;
    box-shadow:0 4px 16px rgba(26,33,45,.10) !important;
    -webkit-overflow-scrolling:touch;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion {
    display:flex !important; align-items:center !important;
    width:100% !important;
    min-height:58px !important;
    padding:12px 14px !important;
    gap:12px !important;
    line-height:1.4 !important;
    border-bottom:1px solid #eff0f3 !important;
    background:#fff;
    touch-action:manipulation;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion:last-child {
    border-bottom:0 !important;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-pin {
    flex:0 0 24px; text-align:center;
    color:#eb7926; font-size:21px;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion-label {
    font-size:15px !important;
    line-height:1.4 !important;
    min-width:0; overflow-wrap:anywhere;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion[aria-selected="true"],
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion:focus-visible {
    background:#fff5ed !important;
  }

  /* Keep the existing house-number confirmation legible without touching validation. */
  #wfsServiceModal.pt112-mobile #pt-house-number-prompt {
    box-sizing:border-box; max-width:100%; border-radius:12px !important;
  }
  #wfsServiceModal.pt112-mobile #pt-house-number-input {
    min-width:0; max-width:100%; font-size:16px !important;
  }
  #wfsServiceModal.pt112-mobile #pt-house-number-confirm {
    min-height:44px; flex:0 0 auto;
  }
  /* Existing manual fallback remains visible whenever application shows it. */
  #wfsServiceModal.pt112-mobile #pt-manual-address-button {
    min-height:44px; max-width:100%; white-space:normal;
  }
}

/* On narrow landscape phones, the existing address search must remain usable. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1199.98px) and (pointer:coarse) {
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-mobile-suggestions:not([hidden]) {
    max-height:min(38dvh,180px) !important;
  }
  #wfsServiceModal.pt112-mobile.pt116-search-mode .pt114-suggestion {
    min-height:48px !important; padding:8px 12px !important;
  }
}
