/**
 * Shop page: top filter bar + full-width product grid (matches homepage product card styling)
 * Professional transitions and load animations
 */

/* Easing and keyframes */
.page-shop {
  --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 */
.shop-main {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 2rem 20px 3rem;
}

/* Page load animations */
.shop-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;
}

.shop-top-bar {
  animation: shopFadeInUp 0.6s var(--ease-out-expo) 0.15s both;
}

.shop-grid-wrap {
  animation: shopFadeIn 0.4s ease-out 0.2s both;
}

/* Top filter bar – single row, space-between */
.shop-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.shop-top-bar-search {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.shop-search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
  transition: border-color 0.25s var(--ease-out-smooth), box-shadow 0.25s var(--ease-out-smooth);
}

.shop-search-input::placeholder {
  color: var(--color-text-muted);
}

.shop-search-input:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(12, 164, 140, 0.15);
}

.shop-top-bar-filters {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.75rem;
}

.shop-filter-select {
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 10L3 5h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.25s var(--ease-out-smooth), box-shadow 0.25s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}

.shop-filter-select:hover,
.shop-filter-select:focus {
  outline: none;
  border-color: var(--color-teal);
}

.shop-filter-select:focus {
  box-shadow: 0 0 0 3px rgba(12, 164, 140, 0.15);
}

/* Product grid – full width */
.shop-grid-wrap {
  width: 100%;
  min-width: 0;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 100%;
}

@media (min-width: 600px) {
  .shop-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 900px) {
  .shop-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
  }
}

@media (min-width: 1200px) {
  .shop-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Product card – flex column so content (and buttons) stay inside card */
.shop-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 */
.shop-grid .product-card:nth-child(1) { animation-delay: 0.22s; }
.shop-grid .product-card:nth-child(2) { animation-delay: 0.28s; }
.shop-grid .product-card:nth-child(3) { animation-delay: 0.34s; }
.shop-grid .product-card:nth-child(4) { animation-delay: 0.4s; }
.shop-grid .product-card:nth-child(5) { animation-delay: 0.46s; }
.shop-grid .product-card:nth-child(6) { animation-delay: 0.52s; }
.shop-grid .product-card:nth-child(7) { animation-delay: 0.58s; }
.shop-grid .product-card:nth-child(8) { animation-delay: 0.64s; }
.shop-grid .product-card:nth-child(9) { animation-delay: 0.7s; }
.shop-grid .product-card:nth-child(10) { animation-delay: 0.76s; }
.shop-grid .product-card:nth-child(n+11) { animation-delay: 0.82s; }

.shop-grid .product-card:hover {
  box-shadow: 0 8px 24px rgba(12, 164, 140, 0.15);
  transform: translateY(-4px);
  border-color: var(--color-teal);
}

.shop-grid .product-card .product-image-wrap {
  aspect-ratio: 1;
  min-height: 120px;
  background: linear-gradient(180deg, #f0f9f7 0%, #e8f4f2 100%);
  overflow: hidden;
  display: block;
}

.shop-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);
}

.shop-grid .product-card:hover .product-image-wrap img {
  transform: scale(1.08);
}

.shop-grid .product-card .product-info {
  padding: 0.5rem 0.65rem 0.65rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.shop-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;
}

.shop-grid .product-card .product-category {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin: 0 0 0.25rem;
}

.shop-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;
}

.shop-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;
}

.shop-grid .product-card .product-rating {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: #eab308;
  letter-spacing: 0.05em;
}

/* Buttons – contained in card, one row */
.shop-grid .product-card .product-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-top: auto;
}

.shop-grid .product-card .product-actions .btn,
.shop-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;
}

.shop-grid .product-card .product-actions button.btn {
  border: 1px solid var(--color-teal);
  background: transparent;
  color: var(--color-teal);
}

.shop-grid .product-card .product-actions button.btn:hover:not(:disabled) {
  background: rgba(12, 164, 140, 0.08);
}

.shop-grid .product-card .product-actions button.btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.shop-grid .product-card .product-actions .btn i {
  font-size: 0.9em;
}

.shop-grid .product-card .product-actions .btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 480px) {
  .shop-grid .product-card .product-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .shop-grid .product-card .product-actions .btn {
    width: 100%;
    min-width: unset;
  }
}

.shop-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) {
  .shop-page-title,
  .shop-top-bar,
  .shop-grid-wrap,
  .shop-grid .product-card,
  .shop-empty {
    animation: none !important;
  }
  .shop-grid .product-card,
  .shop-search-input,
  .shop-filter-select {
    transition-duration: 0.01ms !important;
  }
}
