/* ==========================================================================
   KAYAN LUXURY FASHION — REUSABLE PRODUCT CARD
   ========================================================================== */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.4s var(--ease-out-quart), box-shadow 0.4s var(--ease-out-quart);
  will-change: transform;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
}

/* Image Container */
.product-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background-color: var(--color-bg-secondary);
}

.product-card-img-primary,
.product-card-img-secondary {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out-quart), opacity 0.5s ease;
}

.product-card-img-secondary {
  opacity: 0;
  pointer-events: none;
}

.product-card:hover .product-card-img-primary {
  transform: scale(1.05);
}

.product-card:hover .product-card-img-secondary {
  opacity: 1;
  transform: scale(1.05);
}

/* Badge Stack */
.product-badge-stack {
  position: absolute;
  top: var(--space-xs);
  inset-inline-start: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 3;
}

.product-badge {
  padding: 3px 8px;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-xs);
  line-height: 1.2;
}

.badge-new {
  background-color: var(--brand-obsidian-ink);
  color: var(--brand-raw-alabaster);
}

.badge-sale {
  background-color: var(--color-sale);
  color: #FFFFFF;
}

.badge-exclusive {
  background-color: var(--color-accent);
  color: #FFFFFF;
}

.badge-eco {
  background-color: #059669;
  color: #FFFFFF;
}

/* Wishlist Heart Button */
.product-wishlist-btn {
  position: absolute;
  top: var(--space-xs);
  inset-inline-end: var(--space-xs);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface-glass);
  backdrop-filter: blur(8px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  z-index: 3;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring), color var(--duration-fast);
}

.product-wishlist-btn:hover {
  transform: scale(1.15);
  color: var(--color-sale);
}

.product-wishlist-btn.active {
  color: var(--color-sale);
}

.product-wishlist-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  transition: fill var(--duration-fast);
}

.product-wishlist-btn.active svg {
  fill: var(--color-sale);
}

/* Quick Actions Overlay (Quick View & Quick Add) */
.product-quick-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 4;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out-quart);
  display: flex;
  flex-direction: column;
}

.product-card:hover .product-quick-actions,
.product-card:focus-within .product-quick-actions {
  transform: translateY(0);
}

.product-quick-view-btn {
  background: rgba(18, 18, 20, 0.85);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  padding: 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color var(--duration-fast);
}

.product-quick-view-btn:hover {
  background: var(--color-primary);
}

/* Quick Add Size Panel */
.product-quick-add-panel {
  background: var(--color-surface);
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--color-border);
}

.quick-add-label {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-text-subtle);
}

.quick-add-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.size-chip {
  padding: 4px 8px;
  font-size: var(--text-2xs);
  font-weight: 700;
  border-radius: var(--radius-xs);
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.size-chip:hover {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}

.size-chip.disabled {
  opacity: 0.35;
  text-decoration: line-through;
  cursor: not-allowed;
  pointer-events: none;
}

/* Card Body / Details */
.product-card-body {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Swatches */
.product-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.color-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform var(--duration-fast) var(--ease-spring);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.color-swatch-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color var(--duration-fast);
}

.color-swatch-dot.active::after,
.color-swatch-dot:hover::after {
  border-color: var(--color-text);
}

.color-swatch-dot:hover {
  transform: scale(1.15);
}

.product-brand {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-subtle);
  font-weight: 700;
}

.product-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-name a:hover {
  color: var(--color-accent);
}

/* Rating */
.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
}

.star-rating {
  display: inline-flex;
  color: #F59E0B;
}

/* Price block */
.product-price-row {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: 2px;
}

.product-price {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

.product-price-original {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  text-decoration: line-through;
}

.product-discount-tag {
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--color-sale);
  background: var(--color-sale-subtle);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   Mobile & Tablet Responsiveness for Product Cards
   ========================================================================== */

@media (max-width: 768px) {
  .product-card {
    border-radius: var(--radius-sm);
  }

  .product-card-body {
    padding: 10px 8px;
    gap: 2px;
  }

  .product-brand {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  .product-name {
    font-size: 13px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
  }

  .product-price {
    font-size: 13px;
  }

  .product-price-original {
    font-size: 11px;
  }

  .product-badge {
    font-size: 8.5px;
    padding: 2px 6px;
    letter-spacing: 0.04em;
  }

  .product-wishlist-btn {
    width: 32px;
    height: 32px;
    top: 6px;
    inset-inline-end: 6px;
  }

  .product-wishlist-btn svg {
    width: 16px;
    height: 16px;
  }

  .product-quick-actions {
    display: none; /* Hide desktop hover actions on touch for clean mobile UI */
  }

  .product-swatches {
    gap: 4px;
    margin-bottom: 2px;
  }

  .color-swatch-dot {
    width: 10px;
    height: 10px;
  }
}

/* Touch device specific adjustments */
@media (hover: none) {
  .product-card-img-secondary {
    display: none; /* Prevent sticky hover flickering on phone touch */
  }
  
  .product-card:hover .product-card-img-primary {
    transform: none;
  }
}
