/* =========================================================
   ZooMag phone category page fix — 2026-05-16
   Improves category controls, product grid and product-card buttons on phones.
   ========================================================= */

@media (max-width: 767.98px) {
  #product-category.zoomag-category-page {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow-x: hidden !important;
  }

  #product-category > .row.g-4,
  #product-category .zm-category-native-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  #product-category #content.zoomag-category-content,
  #product-category #content,
  #product-category #column-left,
  #product-category #column-right {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 1 !important;
  }

  #product-category .zoomag-category-header {
    margin-top: 6px !important;
    padding: 16px 14px !important;
    border-radius: 18px !important;
  }

  #product-category .zoomag-category-title-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    text-align: center !important;
  }

  #product-category .zoomag-category-title {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
    line-height: 1.18 !important;
    margin: 0 !important;
    overflow-wrap: anywhere !important;
  }

  #product-category .zoomag-category-stats {
    width: 100% !important;
    margin-top: 12px !important;
  }

  #product-category ul.zm-info-unique-breadcrumb,
  #product-category .zm-ui-breadcrumbs {
    height: auto !important;
    min-height: 44px !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  #product-category ul.zm-info-unique-breadcrumb::-webkit-scrollbar,
  #product-category .zm-ui-breadcrumbs::-webkit-scrollbar {
    display: none !important;
  }

  #product-category .zoomag-controls-panel {
    padding: 14px !important;
    margin: 18px 0 !important;
    border-radius: 18px !important;
    overflow: visible !important;
  }

  #product-category .zoomag-controls-panel > .row,
  #product-category .zoomag-controls-panel .row.g-3 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    margin: 0 !important;
    width: 100% !important;
  }

  #product-category .zoomag-controls-panel [class*="col-"],
  #product-category .zoomag-controls-panel .col-auto {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #product-category .zoomag-control-group,
  #product-category .zoomag-compare-btn,
  #product-category .zoomag-view-toggle,
  #product-category .zoomag-select-group,
  #product-category .zoomag-select-wrapper,
  #product-category .zoomag-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #product-category .zoomag-compare-btn {
    min-height: 44px !important;
    margin-bottom: 0 !important;
    justify-content: center !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  #product-category .zoomag-view-toggle {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 6px !important;
    border-radius: 14px !important;
  }

  #product-category .zoomag-view-btn {
    width: 100% !important;
    min-height: 42px !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
    justify-content: center !important;
    transform: none !important;
  }

  #product-category .zoomag-select-group {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    align-items: stretch !important;
  }

  #product-category .zoomag-select-label {
    font-size: 13px !important;
    justify-content: flex-start !important;
    white-space: normal !important;
  }

  #product-category .zoomag-select {
    height: 44px !important;
    padding: 9px 40px 9px 12px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #product-category .zoomag-products-container,
  #product-category .zoomag-products-grid {
    width: 100% !important;
    max-width: 100% !important;
    margin: 16px 0 !important;
  }

  #product-category .zoomag-product-item {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 0 !important;
  }

  #product-category .zoomag-products-footer {
    padding: 14px !important;
    border-radius: 18px !important;
  }

  #product-category .zoomag-results-content {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

/* Real phones: one product per row. This keeps product buttons readable. */
@media (max-width: 575.98px) {
  #product-category .zoomag-products-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  #product-category .petz-product-card,
  #product-category .product-layout .petz-product-card,
  #product-category .product-grid .petz-product-card,
  #product-category #content .petz-product-card,
  #product-category .row .petz-product-card,
  #product-category .col-xs-6 .petz-product-card,
  #product-category .col-sm-4 .petz-product-card,
  #product-category .col-md-3 .petz-product-card,
  #product-category .col-lg-3 .petz-product-card {
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 18px !important;
  }

  #product-category .petz-content-section {
    padding: 12px 13px 14px !important;
    gap: 9px !important;
  }

  #product-category .petz-product-name,
  #product-category .petz-product-name a {
    min-height: 0 !important;
  }

  #product-category .petz-product-name a {
    -webkit-line-clamp: 3 !important;
    font-size: 14px !important;
    line-height: 1.28 !important;
  }

  #product-category .petz-features {
    max-height: none !important;
  }

  #product-category .petz-quantity-control {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 10px !important;
    align-items: center !important;
  }

  #product-category .petz-quantity-selector {
    min-height: 38px !important;
    padding: 4px !important;
    border-radius: 12px !important;
  }

  #product-category .petz-qty-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
  }

  #product-category .petz-qty-input {
    width: 36px !important;
    height: 32px !important;
    font-size: 14px !important;
  }

  #product-category .petz-action-buttons {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  #product-category .petz-btn-primary,
  #product-category .petz-cart-btn {
    width: 100% !important;
    min-height: 44px !important;
    padding: 10px 14px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  #product-category .petz-secondary-actions {
    width: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, 42px) !important;
    gap: 8px !important;
    justify-content: end !important;
  }

  #product-category .petz-secondary-actions .petz-btn-secondary,
  #product-category .petz-btn-secondary {
    width: 42px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 14px !important;
    flex: none !important;
  }
}

/* Small but still tablet-like phones may keep two columns; make buttons compact. */
@media (min-width: 576px) and (max-width: 767.98px) {
  #product-category .zoomag-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  #product-category .petz-product-card {
    height: auto !important;
    min-height: 0 !important;
  }

  #product-category .petz-action-buttons {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #product-category .petz-secondary-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #product-category .petz-cart-btn,
  #product-category .petz-btn-secondary {
    min-height: 42px !important;
    border-radius: 13px !important;
  }
}
