/* =============================================================
   InfoHub Store — catalog and product page
   Styles WooCommerce's native loop/product markup; depends on base.css.
   ============================================================= */

/* Toolbar: result count + ordering. */
.ih-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.ih-store .woocommerce-result-count {
  margin: 0;
  color: hsl(var(--ih-muted-foreground));
}

.ih-store .woocommerce-ordering { margin: 0; }
.ih-store .woocommerce-ordering select { width: auto; min-width: 220px; cursor: pointer; }

.ih-store .term-description,
.ih-store .page-description {
  margin-bottom: 24px;
  color: hsl(var(--ih-muted-foreground));
}

/* Product grid. */
.ih-store ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ih-store ul.products::before,
.ih-store ul.products::after { content: none; }

/* Product card: image, name, price, Pix price and the buttons chosen in
   the panel (Loja › Card do produto). */
.ih-store ul.products li.product {
  position: relative;
  display: flex;
  flex-direction: column;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid hsl(var(--ih-border));
  border-radius: 16px;
  background-color: hsl(var(--ih-card));
  overflow: hidden;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.ih-store ul.products li.product:hover,
.ih-store ul.products li.product:focus-within {
  border-color: hsl(var(--ih-primary) / 0.45);
  box-shadow: 0 12px 28px rgb(15 23 42 / 0.08);
  transform: translateY(-2px);
}

.ih-store ul.products li.product .woocommerce-loop-product__link {
  display: flex;
  flex: 1;
  flex-direction: column;
  color: hsl(var(--ih-foreground));
  text-decoration: none;
}

.ih-store ul.products li.product img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background-color: hsl(var(--ih-muted));
  border-bottom: 1px solid hsl(var(--ih-border));
  transition: transform 320ms ease;
}

.ih-store ul.products li.product:hover img { transform: scale(1.03); }

.ih-store ul.products li.product .woocommerce-loop-product__title,
.ih-store ul.products li.product .woocommerce-loop-category__title {
  display: -webkit-box;
  min-height: 2.8em;
  margin: 0;
  padding: 16px 18px 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ih-store ul.products li.product .star-rating { margin: 6px 18px 0; }

.ih-store ul.products li.product .price {
  display: block;
  margin-top: auto;
  padding: 10px 18px 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ih-store ul.products li.product .price del { margin-right: 6px; font-size: 13px; letter-spacing: 0; }

/* Pix price. */
.ih-pix-price {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 18px 0 !important;
  padding: 8px 10px;
  border-radius: 10px;
  background-color: hsl(var(--ih-success) / 0.09);
  color: hsl(142 72% 27%);
  font-size: 13px;
  line-height: 1.3;
}

.ih-pix-price .ih-icon { flex-shrink: 0; }
.ih-pix-price__text { min-width: 0; }
.ih-pix-price strong { font-size: 14px; font-weight: 700; }
.ih-pix-price small { display: block; font-size: 11px; opacity: 0.85; }

/* Buttons. */
.ih-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 18px;
}

.ih-store .ih-card-actions .button,
.ih-store .ih-card-actions .added_to_cart {
  width: 100%;
  margin: 0;
  white-space: normal;
}

.ih-store .ih-card-actions .ih-card-buy { min-height: 42px; font-weight: 600; }

.ih-store .ih-card-actions .ih-card-cart {
  border-color: hsl(var(--ih-border));
  background-color: hsl(var(--ih-card));
  color: hsl(var(--ih-foreground));
}

.ih-store .ih-card-actions .ih-card-cart:hover {
  opacity: 1;
  border-color: hsl(var(--ih-primary) / 0.5);
  background-color: hsl(var(--ih-primary) / 0.06);
  color: hsl(var(--ih-foreground));
}

.ih-store .ih-card-actions .ih-card-cart.added { border-color: hsl(var(--ih-success) / 0.5); color: hsl(142 72% 29%); }

.ih-store .ih-card-actions .ih-card-whatsapp {
  min-height: 36px;
  border-color: transparent;
  background-color: transparent;
  color: hsl(142 72% 29%);
  font-size: 13px;
}

.ih-store .ih-card-actions .ih-card-whatsapp:hover { opacity: 1; background-color: hsl(142 70% 45% / 0.1); }

/* "Ver carrinho" link WooCommerce adds after an AJAX add to cart. */
.ih-store .ih-card-actions .added_to_cart {
  min-height: 0;
  padding: 2px 0 0;
  border: 0;
  background: none;
  color: hsl(var(--ih-primary));
  font-size: 13px;
  font-weight: 600;
}

.ih-store .ih-card-actions .added_to_cart:hover { background: none; color: hsl(var(--ih-primary)); text-decoration: underline; }

.ih-store .onsale {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 2px 10px;
  border-radius: 9999px;
  background-color: hsl(var(--ih-primary));
  color: hsl(var(--ih-primary-foreground));
  font-size: 12px;
  font-weight: 600;
}

/* Star rating without WooCommerce's icon font. */
.ih-store .star-rating {
  position: relative;
  display: inline-block;
  width: 5.4em;
  height: 1.2em;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.ih-store .star-rating::before {
  content: '★★★★★';
  position: absolute;
  inset: 0;
  color: hsl(var(--ih-border));
}

.ih-store .star-rating span {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: transparent;
  white-space: nowrap;
}

.ih-store .star-rating span::before {
  content: '★★★★★';
  position: absolute;
  inset: 0 auto 0 0;
  color: hsl(var(--ih-warning));
}

/* Single product — base grid and cards; product.css holds the page design. */
.ih-page--product div.product {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.ih-page--product .woocommerce-product-gallery {
  position: relative;
  border: 1px solid hsl(var(--ih-border));
  border-radius: var(--ih-radius-lg);
  background-color: hsl(var(--ih-card));
  overflow: hidden;
}

.ih-page--product .woocommerce-product-gallery__wrapper { margin: 0; }
.ih-page--product .woocommerce-product-gallery img { display: block; width: 100%; }

.ih-page--product .woocommerce-product-gallery__trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.ih-page--product .flex-control-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0;
  padding: 8px;
  list-style: none;
}

.ih-page--product .flex-control-thumbs img { border-radius: 6px; cursor: pointer; opacity: 0.6; }
.ih-page--product .flex-control-thumbs img.flex-active,
.ih-page--product .flex-control-thumbs img:hover { opacity: 1; }

.ih-page--product .summary {
  padding: 24px;
  border: 1px solid hsl(var(--ih-border));
  border-radius: var(--ih-radius-lg);
  background-color: hsl(var(--ih-card));
}

.ih-page--product .summary .price {
  margin-bottom: 16px;
  font-size: 24px;
  font-weight: 700;
}

.ih-page--product .woocommerce-product-details__short-description {
  margin-bottom: 20px;
  color: hsl(var(--ih-muted-foreground));
}

.ih-page--product form.cart {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.ih-page--product form.cart .button { flex: 1; min-width: 180px; }

.ih-page--product .product_meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--ih-border));
  color: hsl(var(--ih-muted-foreground));
  font-size: 13px;
}

.ih-page--product .woocommerce-tabs,
.ih-page--product .related,
.ih-page--product .upsells { grid-column: 1 / -1; }

.ih-page--product .woocommerce-tabs ul.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 0 16px;
  padding: 4px;
  border-radius: var(--ih-radius);
  background-color: hsl(var(--ih-muted));
  list-style: none;
}

.ih-page--product .woocommerce-tabs ul.tabs a {
  display: block;
  padding: 6px 14px;
  border-radius: calc(var(--ih-radius) - 2px);
  color: hsl(var(--ih-muted-foreground));
  font-weight: 500;
  text-decoration: none;
}

.ih-page--product .woocommerce-tabs ul.tabs li.active a {
  background-color: hsl(var(--ih-card));
  color: hsl(var(--ih-foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.ih-page--product .woocommerce-Tabs-panel {
  padding: 24px;
  border: 1px solid hsl(var(--ih-border));
  border-radius: var(--ih-radius-lg);
  background-color: hsl(var(--ih-card));
}

.ih-page--product .related > h2,
.ih-page--product .upsells > h2 { margin-bottom: 16px; }

@media (max-width: 768px) {

  .ih-store ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  .ih-store ul.products li.product .woocommerce-loop-product__title { padding: 12px 12px 0; font-size: 14px; }
  .ih-store ul.products li.product .price { padding: 8px 12px 0; font-size: 18px; }
  .ih-pix-price { margin: 8px 12px 0 !important; }
  .ih-card-actions { padding: 12px; }

  .ih-store .woocommerce-ordering,
  .ih-store .woocommerce-ordering select { width: 100%; }

  .ih-page--product div.product { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

@media (max-width: 460px) {
  .ih-store ul.products { grid-template-columns: minmax(0, 1fr); }
}
