/* ─────────────────────────────────────────────────────────────
   Techwish — mobile layout fixes (≤900px).
   Header search, 2-col product grids, category toolbar, calc nav.
   ───────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  :root {
    --tw-container-pad: 16px;
  }

  /* ── Header: logo + search + account (cart hidden via mobile-nav.css) ── */
  .tw-header .tw-logo {
    flex: 0 1 auto;
    max-width: 96px;
    min-width: 0;
    height: 32px;
  }

  .tw-header .tw-logo-img {
    height: 28px;
    max-height: 28px;
  }

  .tw-header .tw-search {
    flex: 1 1 0%;
    width: auto;
    max-width: none;
    min-width: 0;
    margin-left: 8px;
  }

  .tw-header .tw-search__form {
    height: 38px;
    padding: 0 4px 0 10px;
    gap: 4px;
    min-width: 0;
  }

  .tw-header .tw-search__input {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    font-size: 13px;
    line-height: 1.2;
  }

  .tw-header .tw-search__submit {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
  }

  .tw-header .tw-search__submit svg {
    width: 14px;
    height: 14px;
  }

  .tw-header .tw-actions {
    flex: 0 0 auto;
    margin-left: 6px;
    gap: 0;
  }

  .tw-header .tw-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
  }

  /* Bottom nav FAB — slightly smaller, less glow bleed */
  .tw-bottom-nav__fab-circle {
    width: 50px;
    height: 50px;
    margin-top: -18px;
  }

  .tw-bottom-nav__label {
    font-size: 9.5px;
  }

  /* ── Category toolbar ── */
  .tw-cat-toolbar__head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .tw-cat-toolbar__right {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .tw-cat-toolbar__pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    margin: 0 calc(-1 * var(--tw-container-pad, 16px));
    padding-left: var(--tw-container-pad, 16px);
    padding-right: var(--tw-container-pad, 16px);
    scrollbar-width: none;
  }

  .tw-cat-toolbar__pills::-webkit-scrollbar {
    display: none;
  }

  .tw-cat-toolbar__pills > li {
    flex: 0 0 auto;
  }

  .tw-cat-pill {
    white-space: nowrap;
  }

  .tw-cat-sort select {
    max-width: min(52vw, 200px);
  }

  /* ── Product grid: always 2 columns on phones ── */
  .tw-cat-grid ul.products:not(.is-list-view) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 8px;
  }

  ul.products li.product.tw-product-tile .woocommerce-loop-product__title,
  ul.products li.product.tw-product-tile__body h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: normal;
    hyphens: none;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__foot {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 36px;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px 6px;
    padding-top: 8px;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__price {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__foot a.tw-product-tile__cta {
    grid-column: 2;
    grid-row: 1;
    width: 36px;
    height: 36px;
    align-self: center;
    justify-self: end;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__omnibus {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 9px;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__amount,
  ul.products li.product.tw-product-tile .tw-product-tile__price .price {
    font-size: 14px !important;
  }

  ul.products li.product.tw-product-tile .tw-product-tile__save {
    font-size: 10px;
    padding: 3px 6px;
  }

  /* Homepage + promos: keep 2 product columns */
  .tw-home-trending__grid,
  .tw-promocje-grid__list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 8px;
  }

  /* PDP tabs — horizontal scroll */
  .tw-pdp-tabs__nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0;
    padding-bottom: 2px;
  }

  .tw-pdp-tabs__tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 12px;
  }

  /* Calculator inside PDP tab */
  .tw-pdp-tabs__panel .tw-calc {
    padding: 24px 0 32px;
    max-width: none;
  }

  .tw-pdp-tabs__panel .tw-calc__form {
    padding: 18px 14px;
  }

  .tw-pdp-tabs__panel .tw-calc__nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .tw-pdp-tabs__panel .tw-calc__nav .tw-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .tw-pdp-tabs__panel .tw-calc__nav [data-tw-calc-prev] {
    margin-right: 0;
    flex: 1 1 calc(50% - 4px);
  }

  .tw-pdp-tabs__panel .tw-calc__nav [data-tw-calc-next],
  .tw-pdp-tabs__panel .tw-calc__nav [data-tw-calc-compute] {
    margin-left: 0;
    flex: 1 1 calc(50% - 4px);
  }

  .tw-pdp-tabs__panel .tw-calc__nav [data-tw-calc-compute] {
    flex: 1 1 100%;
  }
}

@media (max-width: 900px) {
  .tw-calc__form {
    padding: 20px 16px;
  }

  .tw-calc__nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .tw-calc__nav .tw-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 12px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .tw-calc__nav [data-tw-calc-prev],
  .tw-calc__nav [data-tw-calc-next],
  .tw-calc__nav [data-tw-calc-compute] {
    margin-left: 0;
    margin-right: 0;
  }

  .tw-calc__nav [data-tw-calc-compute] {
    flex: 1 1 100%;
  }
}

@media (max-width: 380px) {
  .tw-header .tw-logo {
    max-width: 80px;
  }

  .tw-header .tw-search__input {
    font-size: 12px;
  }
}
