/* ============================================================
   PRODUCT CARD & SINGLE PRODUCT STYLES
   segma-commerce-theme/assets/css/product.css
   ============================================================ */

/* ── PRODUCT GRID ────────────────────────────────────────────── */
.products-section,
.segma-archive-products {
  padding: 20px 0 40px;
}

.segma-products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: start;
}

.no-products {
  text-align: center;
  color: var(--clr-text-muted);
  padding: 40px;
  grid-column: 1/-1;
}

/* ── PRODUCT CARD ────────────────────────────────────────────── */
.product-card {
  background: var(--clr-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Discount badge */
.product-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--clr-badge-bg);
  color: var(--clr-badge-text);
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  box-shadow: 0 2px 6px rgba(255,81,0,0.35);
}

/* Image */
.product-card__image-link {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f9f9f9;
}

.product-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.product-card:hover .product-card__img {
  transform: scale(1.04);
}

/* Info */
.product-card__info {
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

/* Title */
.product-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--clr-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.product-card__title a { color: inherit; }
.product-card__title a:hover { color: var(--clr-primary); }

/* Price */
.product-card__price-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.price-old {
  font-size: 11px;
  color: var(--clr-price-old);
  text-decoration: line-through;
}

.price-new {
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-price-new);
}

/* WC price override */
.product-card__price-wrap .woocommerce-Price-amount { font-size: inherit; }

/* WC prices in product card */
.price-old .woocommerce-Price-amount { text-decoration: line-through; color: var(--clr-price-old); }
.price-new .woocommerce-Price-amount { color: var(--clr-price-new); }

/* Add to Cart */
.product-card__atc {
  margin-top: auto;
  font-size: 12px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
}

.product-card__atc.loading {
  opacity: 0.7;
  pointer-events: none;
}

.product-card__atc.added {
  background: #27ae60;
}

/* ── SUBCATEGORY PILLS ───────────────────────────────────────── */
.subcategory-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.subcat-pill {
  display: inline-block;
  background: var(--clr-white);
  border: 1.5px solid var(--clr-primary);
  color: var(--clr-primary);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.subcat-pill:hover {
  background: var(--clr-primary);
  color: var(--clr-white);
}

/* ── PAGINATION ─────────────────────────────────────────────── */
.wc-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.wc-pagination a,
.wc-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--clr-border);
  color: var(--clr-text);
  transition: all var(--transition);
}

.wc-pagination a:hover,
.wc-pagination .current {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: var(--clr-white);
}

/* ── SINGLE PRODUCT ────────────────────────────────────────── */
.segma-single-product {
  padding: 24px 0 48px;
}

.sp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Images (right column in RTL) */
.sp-images { order: 1; }
.sp-info    { order: 2; }

.sp-main-image-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f9f9f9;
  margin-bottom: 10px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s;
}

/* Thumbnails */
.sp-thumbnails {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--clr-border);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: #f9f9f9;
  transition: border-color var(--transition);
  flex-shrink: 0;
}

.sp-thumb:hover { border-color: var(--clr-primary); }

.sp-thumb.is-active {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 2px rgba(255,81,0,0.25);
}

.sp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info Panel */
.sp-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 12px;
  line-height: 1.4;
}

.sp-price-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sp-badge {
  background: var(--clr-white);
  color: var(--clr-primary);
  border: 1px solid var(--clr-primary);
  font-size: 14px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sp-price-old {
  font-size: 15px;
  color: var(--clr-price-old);
  text-decoration: line-through;
}

.sp-price-new {
  font-size: 22px;
  font-weight: 700;
  color: var(--clr-price-new);
}

.sp-price-native {
  font-size: 22px;
  font-weight: 700;
  color: var(--clr-price-new);
}

.sp-price-native del {
  font-size: 15px;
  color: var(--clr-price-old);
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 8px;
}

.sp-price-native ins {
  text-decoration: none;
}

.sp-price-old .woocommerce-Price-amount { text-decoration: line-through; color: var(--clr-price-old); }
.sp-price-new .woocommerce-Price-amount { color: var(--clr-price-new); font-size: inherit; }

/* Short Description */
.sp-short-desc {
  font-size: 14px;
  color: #444;
  line-height: 1.7;
  margin-bottom: 20px;
  border-right: 3px solid var(--clr-primary);
  padding-right: 12px;
}

.sp-short-desc p { margin-bottom: 6px; }
.sp-short-desc ul { padding-right: 18px; }
.sp-short-desc li { list-style: disc; }

/* Buttons */
.sp-atc-btn {
  font-size: 15px;
  padding: 12px 24px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
}

.sp-atc-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.sp-atc-btn.added {
  background: #27ae60;
}

.sp-checkout-btn {
  font-size: 15px;
  padding: 10px 24px;
  margin-bottom: 16px;
}

/* Trust Badges */
.sp-trust-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.trust-badge {
  font-size: 12px;
  color: var(--clr-text-muted);
  background: #f5f5f5;
  padding: 4px 12px;
  border-radius: 20px;
}

/* Full description */
.sp-description {
  font-size: 14px;
  color: #444;
  line-height: 1.8;
  border-top: 1px solid var(--clr-border);
  padding-top: 16px;
  margin-top: 8px;
}

.sp-description h2,
.sp-description h3 { font-size: 16px; margin: 12px 0 6px; }
.sp-description p  { margin-bottom: 10px; }
.sp-description img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }

/* ── RESPONSIVE PRODUCT GRID ───────────────────────────────── */
@media (max-width: 1024px) {
  .segma-products-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .segma-products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .sp-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .sp-info { display: contents; }
  .sp-title { order: 1; font-size: 16px; margin-bottom: 5px; }
  .sp-price-wrap { order: 2; margin-bottom: 10px; }
  .sp-images { order: 3; margin-bottom: 15px; }
  .sp-short-desc { order: 4; }
  .sp-variation-custom-label { order: 5; }
  .sp-add-to-cart-wrapper { order: 6; }
  #sp-quick-checkout { order: 7; }
  .sp-trust-badges { order: 8; }
  .sp-description { order: 9; }

  .sp-price-native { font-size: 18px; }
}

@media (max-width: 360px) {
  .segma-products-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .product-card__title { font-size: 11px; }
  .product-card__atc { font-size: 11px; padding: 7px 4px; }
}

/* ── WOOCOMMERCE FORM STYLES ───────────────────────────────── */
.sp-add-to-cart-wrapper form.cart {
  margin-bottom: 20px;
}
.sp-add-to-cart-wrapper .single_add_to_cart_button {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  font-size: 16px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  width: 100%;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
  font-weight: 700;
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sp-add-to-cart-wrapper .single_add_to_cart_button:hover {
  opacity: 0.9;
}
.sp-add-to-cart-wrapper .variations {
  width: 100%;
  margin-bottom: 15px;
}
.sp-add-to-cart-wrapper .variations td {
  padding-bottom: 10px;
  display: block;
}
.sp-add-to-cart-wrapper .variations label {
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}
.sp-add-to-cart-wrapper .variations select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
}
.sp-add-to-cart-wrapper .woocommerce-variation-price {
  margin-bottom: 15px;
}
.sp-add-to-cart-wrapper .woocommerce-variation-price .price {
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-price-new);
}
.sp-add-to-cart-wrapper .segma-quantity-wrapper {
  margin-bottom: 20px;
  display: inline-block;
}
.sp-add-to-cart-wrapper .segma-quantity-label {
  display: block;
  font-size: 14px;
  color: var(--clr-text);
  margin-bottom: 5px;
  text-align: center;
}
.sp-add-to-cart-wrapper .segma-quantity-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 44px;
  width: 140px;
  margin: 0;
  background: var(--clr-white);
}
.sp-add-to-cart-wrapper .segma-qty-btn {
  background: transparent;
  border: none;
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #666;
  transition: background 0.2s;
}
.sp-add-to-cart-wrapper .segma-qty-btn:hover {
  background: #f5f5f5;
  color: #000;
}
.sp-add-to-cart-wrapper .segma-qty-input {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  -moz-appearance: textfield;
  padding: 0;
  margin: 0;
}
.sp-add-to-cart-wrapper .segma-qty-input::-webkit-outer-spin-button,
.sp-add-to-cart-wrapper .segma-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sp-variation-custom-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 12px;
}

/* Hide default select and labels */
.sp-add-to-cart-wrapper table.variations {
  border: none;
  width: 100%;
  margin-bottom: 20px;
}
.sp-add-to-cart-wrapper table.variations td.label,
.sp-add-to-cart-wrapper table.variations th.label,
.sp-add-to-cart-wrapper table.variations th {
  display: none !important; /* Hide default 'Size' label because we use custom one */
}
.sp-add-to-cart-wrapper table.variations select {
  display: none !important;
}
.reset_variations {
  display: none !important; /* Hide "إزالة" text */
}

/* Custom Visual Radio Buttons Container */
.segma-variation-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segma-var-radio {
  border: 1.5px solid var(--clr-border);
  background: var(--clr-white);
  color: var(--clr-text);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 50px;
  text-align: center;
}

.segma-var-radio:hover {
  border-color: #999;
}

.segma-var-radio.selected {
  border-color: var(--clr-primary);
  background: var(--clr-primary);
  color: var(--clr-white);
}

.segma-var-radio.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Mobile Sticky CTA */
.segma-mobile-sticky-cta {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--clr-white);
  padding: 10px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 999;
}

.segma-mobile-sticky-cta .btn-primary {
  width: 100%;
  margin: 0;
  font-size: 18px;
  height: 50px;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .segma-single-product {
    padding-bottom: 80px; /* Space for sticky button */
  }
  .segma-mobile-sticky-cta {
    display: block;
  }
}
