/* ═══════════════════════════════════════════════════
   PRODUCT CARDS & MODAL
═══════════════════════════════════════════════════ */

/* ── PRODUCT GRID ─────────────────────────────────── */
.product-grid-wrap { min-width: 0; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-6);
}
.product-grid.list-view {
  grid-template-columns: 1fr;
}

/* ── PRODUCT CARD ─────────────────────────────────── */
.product-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur);
  cursor: pointer;
  position: relative;
}
.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--sage-light);
}
.product-card:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: 2px;
}

/* Card image */
.card-image-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--cream);
}
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.product-card:hover .card-image { transform: scale(1.04); }

/* Placeholder image when no photo */
.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  color: var(--sage);
  font-size: var(--text-sm);
  background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dark) 100%);
}
.card-image-placeholder .ph-icon { font-size: 3rem; opacity: 0.5; }

.card-badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  background: var(--brass);
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.card-badge.new { background: var(--forest); }
.card-badge.sale { background: #c0392b; }

.card-wishlist {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 34px; height: 34px;
  background: white;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--dur);
  opacity: 0;
}
.product-card:hover .card-wishlist { opacity: 1; }
.card-wishlist:hover { background: var(--forest); }

/* Card body */
.card-body {
  padding: var(--sp-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.card-type {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
}
.card-name {
  font-family: var(--display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--forest);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.card-spec {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--ink-light);
  background: var(--cream);
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.card-spec-icon { font-size: 0.75rem; }
.card-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-top: auto;
}
.card-price {
  font-family: var(--display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--forest);
}
.card-price-note {
  font-size: var(--text-xs);
  color: var(--ink-light);
}
.card-actions {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--cream-dark);
  display: flex;
  gap: var(--sp-3);
  background: var(--cream);
}
.card-actions .btn { flex: 1; font-size: var(--text-xs); padding: 0.6rem 1rem; }
.btn-details {
  background: transparent;
  color: var(--forest);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--dur);
}
.btn-details:hover {
  border-color: var(--forest);
  background: white;
}

/* List view card */
.product-grid.list-view .product-card {
  flex-direction: row;
}
.product-grid.list-view .card-image-wrap {
  width: 260px;
  flex-shrink: 0;
  aspect-ratio: auto;
}
.product-grid.list-view .card-actions {
  padding: var(--sp-5);
  border-top: none;
  border-left: 1px solid var(--cream-dark);
  flex-direction: column;
  justify-content: center;
  width: 140px;
  flex-shrink: 0;
}
.product-grid.list-view .card-body { padding: var(--sp-6); }

/* No results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-16);
  color: var(--ink-mid);
}
.no-results-icon { font-size: 3rem; margin-bottom: var(--sp-4); }
.no-results h3 {
  font-family: var(--display);
  font-size: var(--text-xl);
  margin-bottom: var(--sp-2);
  color: var(--forest);
}
.no-results button {
  color: var(--brass);
  text-decoration: underline;
  cursor: pointer;
}

/* ── PRODUCT MODAL ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,36,25,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s var(--ease);
}
.modal-overlay[hidden] { display: none; }

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

.modal-box {
  background: white;
  border-radius: var(--r-xl);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s var(--ease);
  box-shadow: var(--shadow-xl);
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 10;
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: white;
  border: 1px solid var(--border);
  font-size: 1.1rem;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur);
  box-shadow: var(--shadow-sm);
}
.modal-close:hover {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

/* Modal inner layout */
.modal-product-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 400px;
}
@media (max-width: 640px) {
  .modal-product-grid { grid-template-columns: 1fr; }
}

/* Modal gallery */
.modal-gallery {
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  overflow: hidden;
  background: var(--cream);
}
@media (max-width: 640px) {
  .modal-gallery { border-radius: var(--r-xl) var(--r-xl) 0 0; }
}
.modal-main-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.modal-main-img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
}
.modal-thumbnails {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  overflow-x: auto;
}
.modal-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--dur);
}
.modal-thumb.active { border-color: var(--forest); }
.modal-thumb:hover { border-color: var(--sage); }

/* Modal details */
.modal-details {
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.modal-type {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
}
.modal-title {
  font-family: var(--display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--forest);
  line-height: 1.2;
}
.modal-price-block {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
}
.modal-price {
  font-family: var(--display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--forest);
}
.modal-price-note {
  font-size: var(--text-xs);
  color: var(--ink-light);
}
.modal-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.modal-spec {
  background: var(--cream);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.modal-spec-label {
  font-size: var(--text-xs);
  color: var(--ink-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.modal-spec-value {
  font-weight: 600;
  color: var(--forest);
  font-size: var(--text-sm);
}
.modal-description {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  line-height: 1.7;
}
.modal-features ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.modal-features li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--ink-mid);
}
.modal-features li::before {
  content: '✓';
  color: var(--sage);
  font-weight: 700;
  flex-shrink: 0;
}
.modal-features h4 {
  font-weight: 600;
  color: var(--forest);
  margin-bottom: var(--sp-3);
  font-size: var(--text-sm);
}
.modal-cta-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* ── CHECKOUT MODAL ───────────────────────────────── */
.modal-box--checkout {
  max-width: 640px;
}
.checkout-inner {
  padding: var(--sp-8);
}
.checkout-inner h2 {
  font-family: var(--display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--forest);
  margin-bottom: var(--sp-2);
}
.checkout-sub {
  font-size: var(--text-sm);
  color: var(--ink-light);
  margin-bottom: var(--sp-6);
  line-height: 1.7;
}
.checkout-summary {
  background: var(--cream);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.checkout-summary-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--forest);
  margin-bottom: var(--sp-3);
}
.checkout-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink-mid);
}
.checkout-summary-item:last-child { border-bottom: none; }
.checkout-summary-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--forest);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 2px solid var(--border);
}
.checkout-success {
  text-align: center;
  padding: var(--sp-10) 0;
}
.success-icon {
  width: 64px; height: 64px;
  background: var(--forest);
  color: white;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto var(--sp-5);
}
.checkout-success h3 {
  font-family: var(--display);
  font-size: var(--text-2xl);
  color: var(--forest);
  margin-bottom: var(--sp-3);
}
.checkout-success p {
  font-size: var(--text-base);
  color: var(--ink-mid);
  line-height: 1.7;
  margin-bottom: var(--sp-6);
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(247,244,238,0.3);
  border-top-color: var(--cream);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
