/**
 * Product Card Styles
 * Modern BEM structure with React-inspired design
 * Uses system design tokens from style.css
 *
 * @package Flavor_Starter
 * @version 1.0.0
 */

/* ========================================
   Product Card - Base
   ======================================== */
.ta_product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--border-subtle, #f3f4f6);
  overflow: hidden;
  transition: all var(--transition-normal, 200ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

.ta_product-card:hover {
  border-color: var(--border-default, #e5e7eb);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.ta_product-card--out-of-stock {
  opacity: 0.7;
}

.ta_product-card--out-of-stock .ta_product-card__media {
  filter: grayscale(0.5);
}

/* ========================================
   Media Section
   ======================================== */
.ta_product-card__media {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
  background: var(--gray-50, #f9fafb);
}

.ta_product-card__link {
  position: absolute;
  inset: 0;
  display: block;
}

.ta_product-card__image-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ta_product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.4s var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

.ta_product-card__image--primary {
  position: relative;
  z-index: 2;
}

.ta_product-card__image--hover {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
}

.ta_product-card:hover .ta_product-card__image--hover {
  opacity: 1;
  z-index: 3;
}

.ta_product-card:hover .ta_product-card__image--primary {
  opacity: 0;
}

/* ========================================
   Badges
   ======================================== */
.ta_product-card__badges {
  position: absolute;
  top: var(--space-3, 12px);
  left: var(--space-3, 12px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
}

.ta_product-card__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1, 4px);
  padding: 0.25rem 0.625rem;
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--font-semibold, 600);
  line-height: 1.2;
  border-radius: var(--radius-md, 6px);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.ta_product-card__badge--sale {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}

.ta_product-card__badge--out-of-stock {
  background: rgba(107, 114, 128, 0.95);
  color: #ffffff;
}

.ta_product-card__badge--featured {
  background: rgba(245, 158, 11, 0.95);
  color: #ffffff;
}

.ta_product-card__badge-icon {
  flex-shrink: 0;
}

/* ========================================
   Quick Actions
   ======================================== */
.ta_product-card__quick-actions {
  position: absolute;
  top: var(--space-3, 12px);
  right: var(--space-3, 12px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
  opacity: 0;
  transform: translateX(8px);
  transition: all var(--transition-normal, 200ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

.ta_product-card:hover .ta_product-card__quick-actions {
  opacity: 1;
  transform: translateX(0);
}

.ta_product-card__action {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--gray-700, #374151);
  cursor: pointer;
  transition: all var(--transition-fast, 150ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ta_product-card__action:hover {
  background: var(--primary-color, var(--primary, #3b82f6));
  color: #ffffff;
  transform: scale(1.1);
}

.ta_product-card__action:focus-visible {
  outline: 2px solid var(--primary-color, var(--primary, #3b82f6));
  outline-offset: 2px;
}

.ta_product-card__action svg {
  flex-shrink: 0;
}

/* ========================================
   Content Section
   ======================================== */
.ta_product-card__content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-4, 16px);
  gap: var(--space-2, 8px);
}

/* Category */
.ta_product-card__category {
  display: inline-block;
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--font-medium, 500);
  color: var(--primary-color, var(--primary, #3b82f6));
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-fast, 150ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

.ta_product-card__category:hover {
  color: var(--primary-color, var(--primary-dark, #2563eb));
}

/* Title */
.ta_product-card__title {
  margin: 0;
  font-size: var(--text-base, 1rem);
  font-weight: var(--font-semibold, 600);
  line-height: var(--leading-snug, 1.375);
  color: var(--text-primary, #111827);
}

.ta_product-card__title-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast, 150ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));

  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ta_product-card__title-link:hover {
  color: var(--primary-color, var(--primary, #3b82f6));
}

/* Rating */
.ta_product-card__rating {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  margin-top: var(--space-1, 4px);
}

.ta_product-card__stars {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ta_product-card__star {
  flex-shrink: 0;
}

.ta_product-card__star--filled {
  color: var(--warning, #f59e0b);
}

.ta_product-card__star--half {
  color: var(--warning, #f59e0b);
}

.ta_product-card__star--empty {
  color: var(--gray-300, #d1d5db);
}

.ta_product-card__rating-count {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-secondary, #6b7280);
}

/* Footer (Price & CTA) */
.ta_product-card__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3, 12px);
  margin-top: auto;
  padding-top: var(--space-3, 12px);
  border-top: 1px solid var(--border-subtle, #f3f4f6);
}

/* Price */
.ta_product-card__price-wrapper {
  display: flex;
  align-items: baseline;
  gap: var(--space-1, 4px);
}

.ta_product-card__price {
  font-size: var(--text-lg, 1.125rem);
  font-weight: var(--font-bold, 700);
  color: var(--primary-color, var(--primary, #3b82f6));
  line-height: 1;
}

.ta_product-card__price ins {
  text-decoration: none;
  color: var(--danger, #ef4444);
}

.ta_product-card__price del {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--font-normal, 400);
  color: var(--text-muted, #9ca3af);
  margin-right: var(--space-2, 8px);
}

.ta_product-card__price .amount {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.ta_product-card__price-note {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-secondary, #6b7280);
}

/* Contact */
.ta_product-card__contact {
  flex: 1;
}

.ta_product-card__contact-text {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--font-medium, 500);
  color: var(--primary);
}

/* CTA Button */
.ta_product-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1, 4px);
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--font-medium, 500);
  color: #ffffff;
  background: var(--secondary);
  border: none;
  border-radius: var(--radius-md, 6px);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
  white-space: nowrap;
  width: 100%;
}

.ta_product-card__cta:hover {
  background: var(--primary-color, var(--primary-dark, #2563eb));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #ffffff;
}

.ta_product-card__cta:focus-visible {
  outline: 2px solid var(--primary-color, var(--primary, #3b82f6));
  outline-offset: 2px;
}

.ta_product-card__cta-icon {
  flex-shrink: 0;
  transition: transform var(--transition-fast, 150ms)
    var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

.ta_product-card__cta:hover .ta_product-card__cta-icon {
  transform: translateX(2px);
}

/* ========================================
   Responsive
   ======================================== */
@media (min-width: 768px) {
  .ta_product-card__content {
    padding: var(--space-5, 20px);
  }

  .ta_product-card__title {
    font-size: var(--text-lg, 1.125rem);
  }

  .ta_product-card__price {
    font-size: var(--text-xl, 1.25rem);
  }
}

@media (max-width: 575px) {
  /* Compact vertical card for 2-column mobile grid */
  .ta_product-card {
    border-radius: var(--radius-md, 8px);
  }

  .ta_product-card__content {
    padding: var(--space-2, 8px);
    gap: var(--space-1, 4px);
  }

  .ta_product-card__title {
    font-size: var(--text-xs, 0.75rem);
  }

  .ta_product-card__title-link {
    -webkit-line-clamp: 2;
  }

  /* Hide rating on mobile to save space */
  .ta_product-card__rating {
    display: none;
  }

  .ta_product-card__footer {
    gap: var(--space-2, 8px);
    padding-top: var(--space-2, 8px);
  }

  .ta_product-card__price {
    font-size: var(--text-sm, 0.875rem);
  }

  .ta_product-card__price del {
    display: none;
  }

  .ta_product-card__price-note {
    display: none;
  }

  .ta_product-card__cta {
    padding: 0.375rem 0.5rem;
    font-size: var(--text-xs, 0.75rem);
  }

  .ta_product-card__cta span {
    display: none;
  }

  .ta_product-card__cta-icon {
    margin: 0;
  }

  /* Badges - smaller on mobile */
  .ta_product-card__badges {
    top: var(--space-2, 8px);
    left: var(--space-2, 8px);
  }

  .ta_product-card__badge {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
  }

  /* Quick actions - hide on mobile */
  .ta_product-card__quick-actions {
    display: none;
  }

  /* Hover effects - disable transform on mobile */
  .ta_product-card:hover {
    transform: none;
  }
}

/* ========================================
   Grid Compatibility (Flatsome)
   ======================================== */
.product-card-wrapper {
  height: 100%;
}

.product-card-wrapper .col-inner {
  height: 100%;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ta_product-card {
  animation: fadeInUp 0.4s var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));
}

/* Stagger animation for grid items */
.products .product-card-wrapper:nth-child(1) .ta_product-card {
  animation-delay: 0ms;
}
.products .product-card-wrapper:nth-child(2) .ta_product-card {
  animation-delay: 50ms;
}
.products .product-card-wrapper:nth-child(3) .ta_product-card {
  animation-delay: 100ms;
}
.products .product-card-wrapper:nth-child(4) .ta_product-card {
  animation-delay: 150ms;
}
.products .product-card-wrapper:nth-child(5) .ta_product-card {
  animation-delay: 200ms;
}
.products .product-card-wrapper:nth-child(6) .ta_product-card {
  animation-delay: 250ms;
}
