/**
 * AZADIGI Shop Catalog, Product Cards & Quick View Modal Styles
 *
 * @package AZADIGI_Core
 */

/* ==========================================================================
   1. Category Hero Banner
   ========================================================================== */
.az-category-hero-section {
  margin-top: clamp(24px, 4vw, 40px);
  margin-bottom: clamp(20px, 3vw, 36px);
}

.az-category-hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 12px;
  background-color: var(--az-ivory-warm, #f8f6f0);
  border: 1px solid rgba(12, 21, 39, 0.08);
}

.az-category-hero-content {
  flex: 1;
  min-width: 0;
}

.az-category-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.az-category-count-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--az-text-muted, #64748b);
  background: rgba(12, 21, 39, 0.06);
  padding: 4px 10px;
  border-radius: 999px;
}

.az-category-hero-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--az-navy, #0c1527);
  margin: 0 0 10px 0;
  line-height: 1.25;
}

.az-category-hero-desc {
  font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
  line-height: 1.6;
  color: var(--az-text, #1e293b);
  margin: 0;
  max-width: 720px;
}

.az-category-hero-media {
  max-width: 180px;
  flex-shrink: 0;
}

.az-category-hero-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

/* ==========================================================================
   2. Filter Navigation Bar
   ========================================================================== */
.az-filter-nav {
  margin-bottom: 24px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 6px;
}

.az-filter-chips {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.az-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--az-navy, #0c1527);
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.az-filter-chip .dashicons {
  font-size: 1.125rem;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--az-text-muted, #64748b);
  transition: color 0.2s ease;
}

.az-filter-chip:hover {
  border-color: var(--az-green, #00b865);
  color: var(--az-green-dark, #009452);
  background-color: rgba(0, 184, 101, 0.04);
}

.az-filter-chip.is-active {
  background-color: var(--az-navy, #0c1527);
  color: #ffffff;
  border-color: var(--az-navy, #0c1527);
  box-shadow: 0 4px 12px rgba(12, 21, 39, 0.15);
}

.az-filter-chip.is-active .dashicons {
  color: var(--az-aqua, #00d2d3);
}

/* ==========================================================================
   3. Catalog Toolbar & Sorting
   ========================================================================== */
.az-catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.az-catalog-count {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--az-navy, #0c1527);
}

.az-sort-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.az-sort-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--az-text-muted, #64748b);
}

.az-sort-select {
  padding: 8px 14px;
  min-height: 40px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--az-navy, #0c1527);
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.az-sort-select:focus {
  border-color: var(--az-green, #00b865);
  box-shadow: 0 0 0 2px rgba(0, 184, 101, 0.2);
}

/* ==========================================================================
   4. Loading & Empty States
   ========================================================================== */
.az-catalog-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.az-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(0, 184, 101, 0.2);
  border-top-color: var(--az-green, #00b865);
  border-radius: 50%;
  animation: azSpin 0.7s linear infinite;
}

.az-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes azSpin {
  to { transform: rotate(360deg); }
}

.az-catalog-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.az-catalog-empty, .az-catalog-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: clamp(48px, 8vw, 80px) 24px;
  background-color: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  margin: 20px 0;
}

.az-empty-icon {
  font-size: 3rem;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 16px auto;
  color: #94a3b8;
}

.az-empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--az-navy, #0c1527);
  margin: 0 0 8px 0;
}

.az-empty-desc {
  font-size: 0.9375rem;
  color: var(--az-text-muted, #64748b);
  max-width: 480px;
  margin: 0 auto 20px auto;
  line-height: 1.6;
}

/* ==========================================================================
   5. Product Grid & Cards
   ========================================================================== */
.az-catalog-container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

.az-catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.5vw, 32px);
  margin-bottom: 48px;
  width: 100%;
}

.az-product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(12, 21, 39, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.az-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(12, 21, 39, 0.12);
}

/* Fixed ratio image frame: object-fit: contain, centered horizontally & vertically */
.az-product-image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #f1f5f9;
}

.az-product-image-link {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.az-product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

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

.az-product-image-fallback {
  font-size: 2.5rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.az-product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: var(--az-navy, #0c1527);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.az-btn-quickview {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  background: rgba(12, 21, 39, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.az-product-card:hover .az-btn-quickview,
.az-product-card:focus-within .az-btn-quickview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.az-btn-quickview:hover,
.az-btn-quickview:focus {
  background: var(--az-green, #00b865);
  border-color: var(--az-green, #00b865);
  color: #ffffff;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 184, 101, 0.35);
}

/* Card Body */
.az-product-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.az-product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.az-product-category-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--az-text-muted, #64748b);
  letter-spacing: 0.04em;
}

.az-guarantee-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--az-green-dark, #009452);
  background-color: rgba(0, 184, 101, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.az-product-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 8px 0;
}

.az-product-title a {
  color: var(--az-navy, #0c1527);
  text-decoration: none;
  transition: color 0.2s ease;
}

.az-product-title a:hover {
  color: var(--az-green, #00b865);
}

.az-product-excerpt {
  font-size: 0.875rem;
  color: var(--az-text-muted, #64748b);
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex: 1;
}

.az-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
}

.az-product-pricing {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.az-price-sale {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--az-navy, #0c1527);
}

.az-price-struck {
  font-size: 0.875rem;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 500;
}

.az-discount-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  background-color: #fee2e2;
  color: #b91c1c;
  padding: 2px 6px;
  border-radius: 4px;
}

.az-btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
  min-height: 36px;
}

/* ==========================================================================
   6. Accessible Quick View Modal (<dialog>)
   ========================================================================== */
.az-quickview-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 860px;
  width: 90%;
  max-height: 90vh;
  box-shadow: 0 24px 48px -12px rgba(12, 21, 39, 0.25);
  background: #ffffff;
  color: var(--az-text, #1e293b);
  position: fixed;
  inset: 0;
  margin: auto;
  overflow: hidden;
  z-index: 10000;
}

.az-quickview-dialog::backdrop {
  background: rgba(12, 21, 39, 0.65);
  backdrop-filter: blur(4px);
}

.az-qv-container {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.az-qv-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--az-navy, #0c1527);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
}

.az-qv-close-btn:hover {
  background: #e2e8f0;
  color: #b91c1c;
}

.az-qv-body {
  overflow-y: auto;
  padding: clamp(24px, 4vw, 40px);
  -webkit-overflow-scrolling: touch;
}

.az-qv-loading, .az-qv-error {
  text-align: center;
  padding: 60px 20px;
}

.az-qv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 36px);
  align-items: start;
}

.az-qv-img-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.az-qv-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.az-qv-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--az-navy, #0c1527);
  margin: 10px 0 14px 0;
  line-height: 1.25;
}

.az-qv-pricing {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.az-qv-price-sale {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--az-green-dark, #009452);
}

.az-qv-price-regular {
  font-size: 1.125rem;
  color: #94a3b8;
}

.az-qv-desc {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--az-text, #1e293b);
  margin-bottom: 20px;
}

.az-qv-subtitle {
  font-size: 0.9375rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--az-navy, #0c1527);
  letter-spacing: 0.04em;
  margin: 0 0 10px 0;
}

.az-qv-benefits-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
}

.az-qv-benefits-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 6px;
  color: var(--az-text, #1e293b);
}

.az-qv-benefits-list li .dashicons {
  color: var(--az-green, #00b865);
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Actions Form */
.az-qv-actions-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.az-qv-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.az-qv-qty-wrapper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  flex-shrink: 0;
}

.az-qv-add-to-cart-btn,
.az-qv-buy-now-btn {
  flex: 1 1 auto;
  min-width: 130px;
  height: 44px;
  padding: 0 16px;
  font-size: 0.9375rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.az-qv-row-whatsapp {
  width: 100%;
}

.az-btn-whatsapp {
  background: #25D366;
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 8px;
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none !important;
  width: 100%;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  border: 1px solid #20ba59;
}

.az-btn-whatsapp:hover {
  background: #20ba59;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  transform: translateY(-1px);
}

.az-btn-whatsapp .az-wa-svg {
  flex-shrink: 0;
}

.az-qty-btn {
  width: 44px;
  height: 44px;
  background: #f8fafc;
  border: none;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--az-navy, #0c1527);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.az-qty-btn:hover {
  background: #e2e8f0;
}

.az-qty-input {
  width: 44px;
  height: 44px;
  border: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--az-navy, #0c1527);
  outline: none;
  -moz-appearance: textfield;
}

.az-qty-input::-webkit-outer-spin-button,
.az-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.az-btn-accent {
  background-color: var(--az-navy, #0c1527);
  color: #ffffff;
}

.az-btn-accent:hover {
  background-color: #1e293b;
  color: #ffffff;
}

.az-qv-feedback {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.az-feedback-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.az-feedback-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.az-qv-footer-link {
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.az-link-more {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--az-navy, #0c1527);
  text-decoration: none;
}

.az-link-more:hover {
  color: var(--az-green, #00b865);
}

body.az-dialog-open {
  overflow: hidden !important;
}

/* ==========================================================================
   7. Responsive Design Rules (Tablet & Mobile Scale)
   ========================================================================== */
@media (max-width: 991px) {
  .az-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .az-category-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .az-category-hero-media {
    max-width: 100%;
    width: 100%;
  }

  .az-qv-grid {
    grid-template-columns: 1fr;
  }

  .az-qv-img-frame {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 640px) {
  .az-catalog-grid {
    grid-template-columns: 1fr; /* Clean single column for mobile readability */
  }

  .az-filter-nav {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
  }

  .az-filter-chips {
    flex-wrap: nowrap; /* Horizontal swipeable chips on phone */
  }

  .az-qv-actions-form {
    flex-direction: column;
    align-items: stretch;
  }

  .az-qv-row-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .az-qv-qty-wrapper {
    align-self: flex-start;
  }

  .az-qv-add-to-cart-btn,
  .az-qv-buy-now-btn,
  .az-qv-whatsapp-btn {
    width: 100%;
    justify-content: center;
  }
}
