/**
 * Category page: same layout and product card styling as shop
 * (product grid, cards, hover effects, animations)
 */

/* Easing and keyframes – match shop */
.page-category {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes shopFadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shopFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Page layout – full width, match shop-main */
.category-main {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 2rem 20px 3rem;
}

/* Page title – match shop-page-title */
.category-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
  animation: shopFadeInUp 0.6s var(--ease-out-expo) 0.05s both;
}

/* Grid wrapper – match shop-grid-wrap */
.category-grid-wrap {
  width: 100%;
  min-width: 0;
  animation: shopFadeIn 0.4s ease-out 0.2s both;
}

/* Product grid – same breakpoints as shop-grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 100%;
}

@media (min-width: 600px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 900px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
  }
}

@media (min-width: 1200px) {
  .category-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Product card – same as shop-grid .product-card */
.category-grid .product-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  animation: shopFadeInUp 0.5s var(--ease-out-smooth) both;
  transition: box-shadow 0.35s var(--ease-out-smooth), transform 0.35s var(--ease-out-smooth), border-color 0.3s ease, border-width 0.25s ease;
}

/* Staggered card entrance */
.category-grid .product-card:nth-child(1) { animation-delay: 0.22s; }
.category-grid .product-card:nth-child(2) { animation-delay: 0.28s; }
.category-grid .product-card:nth-child(3) { animation-delay: 0.34s; }
.category-grid .product-card:nth-child(4) { animation-delay: 0.4s; }
.category-grid .product-card:nth-child(5) { animation-delay: 0.46s; }
.category-grid .product-card:nth-child(6) { animation-delay: 0.52s; }
.category-grid .product-card:nth-child(7) { animation-delay: 0.58s; }
.category-grid .product-card:nth-child(8) { animation-delay: 0.64s; }
.category-grid .product-card:nth-child(9) { animation-delay: 0.7s; }
.category-grid .product-card:nth-child(10) { animation-delay: 0.76s; }
.category-grid .product-card:nth-child(n+11) { animation-delay: 0.82s; }

.category-grid .product-card:hover {
  box-shadow: 0 8px 24px rgba(12, 164, 140, 0.15);
  transform: translateY(-4px);
  border-color: var(--color-teal);
  border-width: 2px;
}

.category-grid .product-card .product-image-wrap {
  aspect-ratio: 1;
  min-height: 120px;
  background: linear-gradient(180deg, #f0f9f7 0%, #e8f4f2 100%);
  overflow: hidden;
  display: block;
}

.category-grid .product-card .product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 0.35rem;
  transition: transform 0.5s var(--ease-out-smooth);
}

.category-grid .product-card:hover .product-image-wrap img {
  transform: scale(1.08);
}

.category-grid .product-card .product-info {
  padding: 0.5rem 0.65rem 0.65rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.category-grid .product-card .product-name {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  color: var(--color-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-grid .product-card .product-category {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin: 0 0 0.25rem;
}

.category-grid .product-card .product-price {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.category-grid .product-card .product-price .mrp {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
  -webkit-text-fill-color: var(--color-text-muted);
  text-decoration: line-through;
  margin-left: 0.35rem;
}

.category-grid .product-card .product-rating {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: #eab308;
  letter-spacing: 0.05em;
}

/* Buttons – same as shop */
.category-grid .product-card .product-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-top: auto;
}

.category-grid .product-card .product-actions .btn,
.category-grid .product-card .product-actions button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  transition: transform 0.3s var(--ease-out-smooth), box-shadow 0.3s var(--ease-out-smooth), background 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  font-family: inherit;
}

.category-grid .product-card .product-actions button.btn {
  border: 1px solid var(--color-teal);
  background: transparent;
  color: var(--color-teal);
}

.category-grid .product-card .product-actions button.btn:hover:not(:disabled) {
  background: rgba(12, 164, 140, 0.08);
}

.category-grid .product-card .product-actions button.btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.category-grid .product-card .product-actions .btn i {
  font-size: 0.9em;
}

.category-grid .product-card .product-actions .btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 480px) {
  .category-grid .product-card .product-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .category-grid .product-card .product-actions .btn {
    width: 100%;
    min-width: unset;
  }
}

/* Empty state – match shop-empty */
.category-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--color-text-muted);
  font-size: 1rem;
  animation: shopFadeIn 0.5s var(--ease-out-smooth) 0.3s both;
}

/* Respect user motion preference */
@media (prefers-reduced-motion: reduce) {
  .category-page-title,
  .category-grid-wrap,
  .category-grid .product-card,
  .category-empty {
    animation: none !important;
  }
  .category-grid .product-card {
    transition-duration: 0.01ms !important;
  }
}
