/* AYUBO Commerce v2.9.1 — mobile shop optimisation */

/* Keep mobile pages comfortable around notches and browser UI. */
@media (max-width: 575.98px) {
  .ayubo-site { overflow-x: hidden; }
  .ayubo-navbar .container-fluid { padding-left: 14px !important; padding-right: 14px !important; }

  /* Homepage / CMS product sections: exactly one product per row on phones. */
  .cms-product_grid .container,
  .cms-upsell_products .container { padding-left: 14px !important; padding-right: 14px !important; }
  .cms-product_grid .row,
  .cms-upsell_products .row { --bs-gutter-y: 1.35rem; }
  .cms-product_grid .row > [class*="col-"],
  .cms-upsell_products .row > [class*="col-"] { flex: 0 0 auto; width: 100%; }
  .cms-product_grid .d-flex.justify-content-between,
  .cms-upsell_products .d-flex.justify-content-between { align-items: flex-start !important; gap: 14px; }
  .cms-product_grid .display-6,
  .cms-upsell_products .display-6 { font-size: clamp(1.8rem, 8vw, 2.35rem); }
  .cms-product_grid .btn-outline-success { white-space: nowrap; }

  .cms-product-card {
    width: 100%;
    padding: .8rem !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 10px 30px rgba(23,62,43,.07);
  }
  .cms-product-card > .ratio {
    --bs-aspect-ratio: 82%;
    border-radius: 1rem !important;
  }
  .cms-product-card > .ratio img { padding: 1rem !important; object-fit: contain !important; }
  .cms-product-card .card-body { padding: 1rem .45rem .45rem !important; }
  .cms-product-card .card-body small { font-size: .82rem; min-height: 0; }
  .cms-product-card .card-body h3 {
    font-size: 1.08rem !important;
    line-height: 1.38;
    min-height: 0;
    margin: .5rem 0 .85rem;
  }
  .cms-product-card .card-body strong { font-size: 1.2rem; }
  .cms-product-card .btn { width: 100%; min-height: 44px; }

  /* Legacy/fallback product catalogue also becomes one product per row. */
  .product-grid { grid-template-columns: 1fr !important; gap: 18px !important; }
  .product-card { border-radius: 18px !important; }
  .product-image-wrap { aspect-ratio: 1.08 / 1; }
  .product-image-wrap img { padding: 18px !important; }
  .product-card-body { padding: 18px !important; }
  .product-card-body p { display: block !important; min-height: 0; }

  /* Related products: one clear recommendation at a time on phones. */
  .product-related-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  .product-related-card { padding: .65rem !important; }
  .product-related-image { min-height: 250px; }
  .product-related-image img { max-height: 245px; object-fit: contain; }
  .product-related-body h3 { font-size: 1rem !important; }

  /* Product page spacing and buying controls. */
  .product-page-v29 { padding-bottom: 88px; }
  .product-page-container { padding-left: 14px !important; padding-right: 14px !important; }
  .product-detail-grid { gap: 18px !important; }
  .product-main-media { min-height: 330px; }
  .product-main-media img { max-height: 330px; object-fit: contain; }
  .product-info-card { padding: 1.15rem !important; }
  .product-buy-box { grid-template-columns: 92px 1fr !important; gap: 10px !important; }
  .product-buy-button { min-height: 52px; }

  .mobile-product-buybar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1045;
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px max(14px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    background: rgba(255,255,255,.97);
    border-top: 1px solid rgba(23,62,43,.12);
    box-shadow: 0 -12px 34px rgba(18,45,31,.13);
    backdrop-filter: blur(14px);
  }
  .mobile-product-buybar-price { min-width: 0; display: flex; flex-direction: column; }
  .mobile-product-buybar-price small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #68756d; font-size: .72rem; }
  .mobile-product-buybar-price strong { color: var(--ayubo-dark); font-size: 1.1rem; }
  .mobile-product-buybar form { margin: 0; }
  .mobile-product-buybar .btn { min-height: 46px; border-radius: 999px; padding-inline: 18px; white-space: nowrap; }
  body:has(.mobile-product-buybar) .ai-launch { bottom: 84px; }
  body:has(.mobile-product-buybar) .ai-panel { bottom: 140px; max-height: calc(100dvh - 175px); }

  /* Cart: readable touch-first cards instead of a compressed desktop row. */
  .cart-page { margin-top: 24px; }
  .cart-page .section-title { gap: 12px; }
  .cart-layout { display: grid !important; grid-template-columns: 1fr !important; gap: 18px !important; }
  .cart-list { border-radius: 16px; overflow: visible; background: transparent; border: 0; }
  .cart-row {
    grid-template-columns: 82px minmax(0,1fr) auto !important;
    gap: 12px !important;
    align-items: start !important;
    margin-bottom: 12px;
    padding: 14px !important;
    background: #fff;
    border: 1px solid var(--line) !important;
    border-radius: 16px;
  }
  .cart-thumb { width: 82px !important; height: 82px !important; grid-row: 1 / 3; }
  .cart-info { min-width: 0; }
  .cart-info strong { line-height: 1.3; }
  .cart-info small { line-height: 1.45; }
  .cart-row > form:last-child { grid-column: 3 !important; grid-row: 1; }
  .cart-row > form:last-child .remove-button { width: 36px; height: 36px; padding: 0; }
  .cart-qty { grid-column: 2 / 4 !important; grid-row: 2; align-items: center; }
  .cart-qty input { width: 76px !important; min-height: 42px; }
  .cart-qty button { min-height: 42px; }
  .cart-line-total { grid-column: 2 / 4 !important; grid-row: 3; justify-self: end; font-size: 1.1rem; }
  .coupon-box { border-radius: 16px; padding: 16px; }
  .coupon-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .coupon-form input { margin-bottom: 0; }
  .coupon-form button { width: 100%; min-height: 46px; }
  .cart-summary { border-radius: 16px !important; padding: 20px !important; }
  .checkout-link { min-height: 50px; display: grid !important; place-items: center; border-radius: 999px !important; }

  /* Checkout: single-column cards with touch-friendly fields. */
  .checkout-grid { grid-template-columns: 1fr !important; gap: 18px !important; }
  .checkout-grid .admin-card,
  .checkout-grid .order-summary { border-radius: 16px; padding: 18px; }
  .checkout-grid .form-row { grid-template-columns: 1fr !important; gap: 0 !important; }
  .checkout-grid input,
  .checkout-grid textarea,
  .checkout-grid select { min-height: 48px; font-size: 16px; }
  .checkout-grid textarea { min-height: 100px; }
  .payment-option { padding: 14px; min-height: 54px; }
  .checkout-button { min-height: 52px; border-radius: 999px !important; font-size: .98rem; }
  .order-summary { position: static !important; }
}

/* Small tablets keep two products, then grow to three/four on desktop via Bootstrap. */
@media (min-width: 576px) and (max-width: 767.98px) {
  .cms-product-card > .ratio img { padding: .8rem; }
}
