/* Shared product cards and catalog card chrome. Homepage sections live in home-components.css. */
/* ===== PRODUCT CARDS ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 24px;
  align-items: stretch;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.product-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  text-decoration: none;
}
.product-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-product-hover);
  border-color: var(--border-product-hover);
}
.product-image,
.product-img,
.product-info {
  position: relative;
  pointer-events: none;
}
.product-card-actions,
.product-wishlist-btn,
.add-to-cart-btn,
.product-cart-btn,
.product-rating,
.product-rating-link {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.product-image {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-product-media);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px 8px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-light);
}
.product-img {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-product-media);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px 8px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-light);
}
.product-image img,
.product-img img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform var(--transition);
}
.product-card:hover .product-image img,
.product-card:hover .product-img img {
  transform: scale(1.04);
}
/* Bottom row: primary Add to Cart + compact wishlist icon */
.product-card-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  width: 100%;
}
.product-card-actions .add-to-cart-btn {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-top: 0;
}
.product-wishlist-btn {
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.product-wishlist-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-card);
}
.product-wishlist-btn.wishlisted,
.product-wishlist-btn.wishlisted:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}
.product-wishlist-btn i.fa-heart {
  transition: color 0.25s ease, transform 0.2s ease;
}
.product-wishlist-btn.wishlisted i.fa-heart {
  color: #ef4444;
}
.product-wishlist-btn:active {
  transform: scale(0.96);
}
.product-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.product-badge.sale { background: var(--danger); color: #fff; }
.product-badge.new { background: var(--success); color: #fff; }

/* Diagonal corner ribbon — opposite corner from .product-badge (start vs end) */
.product-image,
.product-img {
  --install-ribbon-size: clamp(76px, 27%, 112px);
}

.product-install-ribbon {
  position: absolute;
  z-index: 3;
  top: 0;
  inset-inline-end: 0;
  width: var(--install-ribbon-size);
  height: var(--install-ribbon-size);
  overflow: hidden;
  pointer-events: none;
}

.product-install-ribbon__band {
  position: absolute;
  top: 15px;
  inset-inline-end: -38px;
  width: 152px;
  padding: 5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  transform-origin: center;
  background: linear-gradient(
    135deg,
    rgba(8, 28, 48, 0.96) 0%,
    rgba(0, 90, 130, 0.94) 48%,
    rgba(0, 168, 210, 0.9) 100%
  );
  box-shadow:
    0 4px 14px rgba(0, 25, 45, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  border-block: 1px solid rgba(255, 255, 255, 0.1);
}

[dir="rtl"] .product-install-ribbon__band {
  inset-inline-end: auto;
  inset-inline-start: -38px;
  transform: rotate(-45deg);
}

.product-install-ribbon__text {
  display: block;
  max-width: 92%;
  padding: 0 4px;
  font-size: clamp(0.52rem, 2.1vw, 0.64rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

html[lang="en"] .product-install-ribbon__text {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-install-ribbon--detail {
  --install-ribbon-size: clamp(96px, 16%, 136px);
}

.product-install-ribbon--detail .product-install-ribbon__band {
  top: 22px;
  inset-inline-end: -44px;
  width: 188px;
  padding: 7px 0;
}

[dir="rtl"] .product-install-ribbon--detail .product-install-ribbon__band {
  inset-inline-end: auto;
  inset-inline-start: -44px;
}

.product-install-ribbon--detail .product-install-ribbon__text {
  font-size: clamp(0.58rem, 1.1vw, 0.76rem);
}

@media (max-width: 480px) {
  .product-image,
  .product-img {
    --install-ribbon-size: clamp(68px, 30%, 92px);
  }

  .product-install-ribbon__band {
    top: 13px;
    inset-inline-end: -40px;
    width: 138px;
    padding: 4px 0;
  }

  [dir="rtl"] .product-install-ribbon__band {
    inset-inline-start: -40px;
  }

  .product-install-ribbon__text {
    font-size: clamp(0.48rem, 2.4vw, 0.58rem);
  }
}

[data-theme="dark"] .product-install-ribbon__band {
  background: linear-gradient(
    135deg,
    rgba(6, 20, 36, 0.98) 0%,
    rgba(0, 75, 110, 0.96) 50%,
    rgba(0, 150, 190, 0.92) 100%
  );
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pd-magnifier-wrap {
  position: relative;
}
.product-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-card);
}
.product-category {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
  line-height: 1.4;
  min-height: calc(1.4em * 2);
  max-height: calc(1.4em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.product-name a {
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}
.product-image-placeholder {
  font-size: 3rem;
  color: var(--text-tertiary);
}
.product-price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 12px;
  min-height: 2.6rem;
}
.product-price .current { font-size: 1.15rem; font-weight: 700; color: var(--accent); }
.product-price .original { font-size: 0.9rem; color: var(--text-tertiary); text-decoration: line-through; }

.product-price-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}
.product-price-display__main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.product-price-display__current {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.product-price-display__original {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-decoration: line-through;
}
.product-price-display__badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}
.product-price-display__vat-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.2;
}
.product-price-display__before-tax {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.2;
}
.product-price-display__before-tax .price-with-currency {
  font-size: inherit;
  color: inherit;
  font-weight: 500;
}
.product-price-display--compact .product-price-display__current {
  font-size: 1.1rem;
}
.product-price-display--compact .product-price-display__before-tax {
  font-size: 0.72rem;
}

.price-vat-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.price-vat-stack__inc {
  font-weight: 700;
  color: var(--accent);
}
.price-vat-stack__original {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-decoration: line-through;
}
.price-vat-stack__ex {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.cart-summary-note {
  margin: 8px 0 14px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.price-vat-stack__hint {
  font-weight: 400;
}

.search-autocomplete-price--vat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.search-autocomplete-price-ex {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.checkout-line-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.summary-row--vat {
  font-weight: 600;
}

/* Currency: see sar-currency.css — .price-with-currency */
.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  min-height: 1.25rem;
  line-height: 1.25rem;
}
.product-rating-link {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  max-width: 100%;
  text-decoration: none;
  color: inherit;
  min-height: 1.25rem;
}
.product-rating-link:hover .product-rating-value,
.product-rating-link:hover .product-rating-count,
.product-rating-link:hover .product-rating-empty {
  color: var(--accent);
}
.product-rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}
.product-rating .fas.fa-star,
.product-rating .fas.fa-star-half-alt {
  color: #f59e0b;
  font-size: 0.75rem;
}
.product-rating .far.fa-star {
  color: var(--border);
  font-size: 0.75rem;
}
.product-rating-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, var(--text));
  white-space: nowrap;
}
.product-rating-count,
.product-rating-empty {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme='dark'] .product-rating .far.fa-star {
  color: #64748b;
}
.add-to-cart-btn,
.product-cart-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  margin-top: auto;
  white-space: nowrap;
}
.product-card-actions .add-to-cart-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.add-to-cart-btn:hover,
.product-cart-btn:hover {
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
  transform: translateY(-1px);
}
.add-to-cart-btn.in-cart,
.product-cart-btn.in-cart,
.pd-btn-cart.in-cart {
  background: var(--success, #10b981);
  border-color: var(--success, #10b981);
  color: #fff;
}
.add-to-cart-btn.in-cart:hover,
.product-cart-btn.in-cart:hover,
.pd-btn-cart.in-cart:hover {
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

/* Card variants — unified surfaces */
.product-card.homepage-card,
.product-card.related-card {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: none;
}
.product-card.homepage-card:hover,
.product-card.related-card:hover {
  box-shadow: var(--shadow-product-hover);
  border-color: var(--border-product-hover);
}
.product-card.homepage-card .product-info,
.product-card.related-card .product-info {
  background: var(--bg-card);
  padding: 16px;
}
.product-card.related-card .product-name {
  font-size: 0.95rem;
  min-height: calc(1.4em * 2);
  max-height: calc(1.4em * 2);
}
