/* Responsive tuning for storefront (phone + tablet) */

/* Unified search visual (matches requested style) */
.big-search-bar {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  min-height: 56px;
  background: linear-gradient(180deg, #2e4a68, #253f5c);
  border: 1px solid rgba(18, 33, 52, 0.22);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(13, 26, 43, 0.18);
  padding: 4px 4px 4px 12px;
  gap: 8px;
}
.big-search-bar .search-ic {
  position: static;
  inset-inline-start: auto;
  top: auto;
  transform: none;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-end: 2px;
  color: #e8f0fb;
}
.big-search-bar input,
.big-search-bar .form-control {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #eef4ff !important;
  padding-inline: 6px !important;
}
.big-search-bar .search-ic { order: 0; }
.big-search-bar input,
.big-search-bar .form-control { order: 1; }
.big-search-bar input::placeholder,
.desktop-search #desktop-search::placeholder {
  color: #d8e4f3 !important;
}
.big-search-bar .search-btn,
.desktop-search .desktop-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  min-height: 44px;
  padding-inline: 18px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #14d879, #0fc96f);
  box-shadow: 0 8px 18px rgba(20, 216, 121, 0.28);
  white-space: nowrap;
}
.big-search-bar .search-btn { order: 2; }
html[dir="rtl"] .big-search-bar .search-btn {
  border-radius: 0 999px 999px 0;
}
html[dir="ltr"] .big-search-bar .search-btn {
  border-radius: 999px 0 0 999px;
}
html[dir="rtl"] .big-search-bar .search-btn { order: 0; }
html[dir="rtl"] .big-search-bar .search-ic { order: 1; }
html[dir="rtl"] .big-search-bar input,
html[dir="rtl"] .big-search-bar .form-control {
  order: 2;
  text-align: right;
}

/* Categories back button inside search bar */
.big-search-bar > .btn.flex-shrink-0 {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(232, 240, 251, 0.26);
  background: rgba(232, 240, 251, 0.14);
  color: #eef4ff;
}

/* Desktop search shell */
.desktop-search {
  display: flex;
  align-items: center;
  gap: 0;
  background: linear-gradient(180deg, #2e4a68, #253f5c);
  border: 1px solid rgba(18, 33, 52, 0.22);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(13, 26, 43, 0.16);
  padding: 4px;
}
.desktop-search #desktop-search {
  width: min(48vw, 520px);
  min-width: 190px;
  min-height: 44px;
  padding-inline: 14px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #eef4ff !important;
}
.desktop-search .desktop-search-btn {
  border-radius: 999px;
}

/* Shared touch sizing for small/medium devices */
@media (max-width: 991.98px) {
  :root {
    --touch-min: 44px;
  }

  /* Categories mobile fixes:
     1) prevent desktop logo/header from appearing
     2) keep search bar pinned at top while scrolling */
  body.page-categories .desktop-header {
    display: none !important;
  }
  body.page-categories #cat-view .big-search-bar {
    position: -webkit-sticky;
    position: sticky !important;
    top: calc(env(safe-area-inset-top) + 6px);
    z-index: 1090;
  }

  .page-surface {
    border-radius: 16px;
    padding: 12px;
  }

  .section-underline {
    margin-bottom: 1.1rem;
  }

  #cat-view.container {
    padding-inline: 0.42rem;
  }

  .typing-heading {
    margin-bottom: 0.45rem !important;
  }

  /* Search bars */
  .big-search-bar {
    padding: 0.55rem 0.65rem;
    gap: 0.45rem;
    border-radius: 14px;
  }
  .big-search-bar .form-control,
  .big-search-bar input,
  #desktop-search {
    min-height: 46px;
    font-size: 16px;
    line-height: 1.2;
  }
  .big-search-bar .btn,
  .big-search-bar .clear-btn,
  .big-search-bar .search-btn {
    min-width: 46px;
    min-height: 46px;
    width: 46px;
    height: 46px;
  }

  /* Cards + product actions */
  .product-card {
    border-radius: 16px !important;
  }
  .product-card .card-body {
    padding: 0.72rem 0.62rem;
  }
  .product-img {
    height: clamp(124px, 33vw, 164px);
    padding: 8px;
  }
  .product-title {
    font-size: 0.92rem;
    min-height: 2.6em;
  }
  .add-to-cart,
  .options-btn,
  .btn-add,
  .opt-add-btn,
  .sheet-footer .btn {
    min-height: 44px !important;
    font-size: 0.9rem !important;
  }

  .fav-btn {
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
  }

  /* Bottom nav */
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .nav-item {
    min-height: 58px;
    min-width: 64px;
    padding: 0.24rem 0.3rem;
  }
  .bottom-nav .icon {
    font-size: 1.45rem;
  }

  /* Mobile header controls */
  .mobile-header .container-fluid {
    padding-inline: 0.6rem;
  }
  .mh-menu-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
  }
  .mh-left {
    width: 44px;
  }

  /* Cart bars/sheets */
  #mobile-cart-bar {
    left: 8px;
    right: 8px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    border-radius: 14px;
    padding: 0.72rem 0.8rem;
    gap: 10px;
  }
  #mobile-cart-bar .btn-view-cart {
    min-height: 42px;
    white-space: nowrap;
    padding: 0.56rem 1rem;
  }

  .mobile-cart-sheet {
    width: calc(100% - 8px);
    height: min(90dvh, 760px);
    padding: 12px 12px 0;
    border-radius: 16px 16px 0 0;
  }
  .sheet-body {
    max-height: calc(90dvh - 132px);
    padding-inline-end: 2px;
  }
  .sheet-footer {
    padding: 8px 0 calc(18px + env(safe-area-inset-bottom));
  }

  .cart-item img {
    width: 92px;
    height: 92px;
  }
  .btn-round {
    width: 40px;
    height: 40px;
  }

  .options-sheet {
    width: calc(100% - 12px);
    max-height: 88dvh;
    padding: 10px 10px 12px;
    border-radius: 18px 18px 0 0;
  }
  .opt-item {
    padding: 10px;
    border-radius: 12px;
  }
  .opt-controls {
    gap: 6px;
  }
  .options-item img {
    width: 82px;
    height: 82px;
  }

  .offcanvas {
    --bs-offcanvas-width: min(92vw, 420px);
  }

  /* Categories overlay rows */
  .cats-item {
    min-height: 50px;
    padding: 10px 14px;
  }
  .cats-icon,
  .cats-emoji {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
}

/* Phones */
@media (max-width: 575.98px) {
  .page-surface {
    border-radius: 14px;
    padding: 10px;
  }

  .home-cats {
    margin: 14px 0 18px;
  }
  #cat-view.container {
    padding-inline: 0.28rem;
  }
  .home-cats-grid {
    gap: 10px;
  }
  .cat-banner {
    border-radius: 14px;
  }

  .product-card .card-body {
    padding: 0.66rem 0.55rem;
  }
  .product-title {
    font-size: 0.88rem;
  }
  .product-img {
    height: clamp(118px, 38vw, 146px);
  }

  .bottom-nav .nav-item {
    min-height: 56px;
    min-width: 60px;
  }
  .bottom-nav .icon {
    font-size: 1.35rem;
  }

  .mobile-cart-sheet,
  .options-sheet {
    width: calc(100% - 6px);
  }
}

/* Tablets */
@media (min-width: 576px) and (max-width: 991.98px) {
  .page-surface {
    border-radius: 18px;
    padding: 14px;
  }

  .product-img {
    height: clamp(138px, 24vw, 170px);
  }

  .bottom-nav .nav-item {
    min-height: 60px;
    min-width: 70px;
  }

  .mobile-cart-sheet,
  .options-sheet {
    width: min(760px, calc(100% - 18px));
  }

  .home-cats-grid {
    gap: 14px;
  }
}
