/* Extracted from woocommerce/archive-product.php inline styles
   Controls the archive header layout, pills and responsive behaviour
*/

/* Grid container for cards - fixed column counts so every row matches */
.alotyre-results,
.woocommerce ul.products.columns-4,
.woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
  justify-items: stretch;
  width: 100%;
  max-width: 100% !important;
  box-sizing: border-box;
  margin: 0;
  list-style: none;
  padding: 0 16px;
  float: none !important;
  clear: both;
}

/* Let the shop archive span the full viewport width (override theme's boxed .site-main) */
.woocommerce.archive .site-main,
.woocommerce-products-page .site-main,
body.woocommerce-page:not(.elementor-page) .site-main,
.woocommerce .page-content,
.woocommerce #main > .page-content {
  max-width: 100% !important;
  width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  box-sizing: border-box;
}
.woocommerce ul.products.columns-4,
.woocommerce ul.products {
  max-width: 100% !important;
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
  .alotyre-results,
  .woocommerce ul.products.columns-4,
  .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0 10px;
  }
}
@media (max-width: 380px) {
  .alotyre-results,
  .woocommerce ul.products.columns-4,
  .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Neutralize WooCommerce clearfix pseudo-elements that hijack grid cells */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce ul.products.columns-4::before,
.woocommerce ul.products.columns-4::after,
.alotyre-results::before,
.alotyre-results::after {
  content: none !important;
  display: none !important;
  grid-area: auto !important;
}
.alotyre-results {
  padding: 0 10px;
}
.alotyre-results--pairs {
  grid-template-columns: 1fr;
}

/* Only cards / product items participate in the grid */
.alotyre-results > :not(.alotyre-tire-card):not(.alotyre-pair-box):not(.alotyre-empty) {
  display: none !important;
}

.alotyre-results > .alotyre-tire-card,
.alotyre-results > .alotyre-pair-box,
.woocommerce ul.products > li.product {
  width: 100%;
  max-width: none;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
  height: auto;
  display: flex;
  flex-direction: column;
}

/* Equal-height tire cards */
.alotyre-tire-card {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* WooCommerce pagination */
.woocommerce nav.woocommerce-pagination,
.woocommerce-pagination {
  display: block !important;
  width: 100%;
  max-width: 100%;
  margin: 28px auto 16px;
  padding: 0 16px;
  box-sizing: border-box;
  clear: both;
  text-align: center;
  float: none !important;
}
.woocommerce nav.woocommerce-pagination ul,
.woocommerce-pagination ul.page-numbers,
.woocommerce-pagination ul {
  display: inline-flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  float: none !important;
  width: auto !important;
}
.woocommerce nav.woocommerce-pagination ul li,
.woocommerce-pagination ul li {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  float: none !important;
  overflow: visible !important;
}
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span,
.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span,
.woocommerce-pagination .page-numbers {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #e5e7eb !important;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none !important;
  box-sizing: border-box;
  line-height: 1;
}
.woocommerce nav.woocommerce-pagination ul li a:hover,
.woocommerce-pagination ul li a:hover,
.woocommerce-pagination a.page-numbers:hover {
  background: #f3f4f6;
  border-color: #d1d5db !important;
  color: #111827;
}
.woocommerce nav.woocommerce-pagination ul li span.current,
.woocommerce-pagination ul li span.current,
.woocommerce-pagination span.page-numbers.current {
  background: #dc2626;
  border-color: #dc2626 !important;
  color: #fff;
}

/* Styles from your archive-product.php */
.alotyre-tyres-wrap {
  /* sticky header with full-width background while keeping inner centered */
  /* top uses a CSS variable so we can offset below any fixed site header */
  position: sticky;
  top: var(--alotyre-top-offset, 0px);
  width: 100%;
  left: 0;
  background: #f8f8fb;
  box-sizing: border-box;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
}
.alotyre-tyres-inner {
  /* centered inner container that preserves previous appearance */
  max-width: 1520px;
  margin: 18px auto 28px;
  padding: 16px;
  padding-top: 18px; /* breathing room when sticky */
  border-radius: 12px;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
}
.alotyre-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
}
.alotyre-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
@media (max-width: 800px) {
  .alotyre-controls {
    grid-template-columns: 1fr 1fr;
  }
}
.alotyre-control label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.alotyre-control select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}
.alotyre-btn {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  height: 40px;
  font-family: outfit;
}
.alotyre-btn:hover {
  opacity: 0.95;
}
.alotyre-empty {
  padding: 12px;
  color: #6b7280;
  grid-column: 1/-1;
  text-align: center;
  width: 100%;
}
.alotyre-errors {
  color: #b91c1c;
  margin-top: 10px;
}

/* Consistent pill and Filter button styles */
.alotyre-pill,
#alotyre-open-filters {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 160px !important;
  height: 48px !important;
  padding: 0 20px !important;
  border-radius: 12px !important;
  border: 2px solid #e6e6e6 !important;
  background: #f8fafc !important;
  color: #111827 !important;
  font-weight: 700 !important;
  box-sizing: border-box !important;
}
.alotyre-pill:hover,
#alotyre-open-filters:hover {
  opacity: 0.95;
}

/* Keep the top mode buttons distinct but size them to match visually */
.alotyre-mode-btn {
  min-width: 160px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ensure the top switch/pills/filters align left->center->right even inside RTL page */
.alotyre-switch-wrap {
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.alotyre-mode-pills {
  margin: 0 auto;
}
.alotyre-mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.alotyre-mode-toggle-m {
  display: none;
}

/* Mobile layout tweaks: make mode buttons share a single row and hide size pills */
@media (max-width: 600px) {
  /* Hide the inline size pills on small screens to save space */
  .alotyre-pills-size,
  .alotyre-pills-vehicle {
    display: none !important;
  }

  /* Place the two mode buttons side-by-side, each taking 50% */
  .alotyre-mode-toggle-m {
    width: 100%;
  }
  .alotyre-mode-toggle-m .alotyre-mode-btn {
    flex: 0 0 50%;
    max-width: 50%;
    box-sizing: border-box;
    min-width: 0; /* allow shrinking past the desktop min-width */
    margin: 0; /* remove gaps handled by container */
  }

  /* Make the filters button span the full width on its own row */
  #alotyre-open-filters {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .alotyre-switch-wrap-m {
    gap: 8px;
  }

  .alotyre-filter-btns {
    width: 100%;
  }

  .alotyre-tyres-wrap {
    top: 0px !important;
  }
  .alotyre-mode-toggle-m {
    display: flex;
  }
  .alotyre-mode-toggle {
    display: none;
  }
}

/* WhatsApp "Check The Price" button on product cards */
.alotyre-card-actions {
  padding: 14px;
  border-top: 1px solid #f3f4f6;
  margin-top: auto;
}

.alotyre-whatsapp-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, #25d366 0%, #128c7e 100%);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.4px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.2);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  box-sizing: border-box;
}

.alotyre-whatsapp-price:hover,
.alotyre-whatsapp-price:focus {
  color: #fff;
  background: linear-gradient(90deg, #128c7e 0%, #25d366 100%);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.28);
  transform: translateY(-1px);
}

.alotyre-whatsapp-price--pair {
  width: auto;
  min-width: 200px;
  white-space: nowrap;
}

.alotyre-whatsapp-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
