/* ═══════════════════════════════════════════════════════
   SAFEGATE — store-front.css
   Public storefront (store.html + store-product.html).
   Loaded on top of pay.css — reuses its theme tokens, header,
   buttons, .state-card etc.
═══════════════════════════════════════════════════════ */

.shop-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ── Shop header ── */
.shop-banner {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--blue), #8b94f0);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}
.shop-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.35) 100%);
}

.shop-header {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: -32px;
  margin-left: 16px;
  padding-right: 16px;
  position: relative;
}
.shop-seller-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #8b94f0);
  border: 4px solid var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  font-family: inherit;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.shop-seller-avatar:hover { transform: scale(1.05); opacity: 0.9; }
.shop-seller-avatar img { width: 100%; height: 100%; object-fit: cover; }

.shop-banner { cursor: pointer; transition: opacity 0.15s ease; }
.shop-banner:hover { opacity: 0.92; }

/* ── Lightbox ── */
.lightbox-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,7,12,0.9);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox-backdrop.open { opacity: 1; pointer-events: auto; }
.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.18); }

.shop-header-info { padding-bottom: 4px; }
.shop-name {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.shop-bio {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.5;
}

/* ── Search ── */
.shop-search-wrap {
  position: relative;
  margin: 24px 0 20px;
}
.shop-search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.shop-search {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
}
.shop-search:focus { outline: none; border-color: var(--blue); }

/* ── Category filter bar ── */
.shop-category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.shop-category-chip {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.shop-category-chip:hover { border-color: var(--border-hi); color: var(--text-primary); }
.shop-category-chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.shop-category-chip.sale-chip.active { background: var(--danger, #E5534B); border-color: var(--danger, #E5534B); }

/* ── Product grid ── */
.shop-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 12px;
}
@media (min-width: 480px) { .shop-product-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 760px) { .shop-product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1040px) { .shop-product-grid { grid-template-columns: repeat(5, 1fr); } }

/* ── Category sections (default "All" browsing view) ── */
.shop-category-section { margin-bottom: 36px; }
.shop-category-section:last-child { margin-bottom: 0; }
.shop-category-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.shop-category-section-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.shop-category-section-count {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.shop-product-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color var(--tr, 0.2s), transform var(--tr, 0.2s);
  text-decoration: none;
}
.shop-product-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }

.shop-product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  position: relative;
}
.shop-product-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-product-sale-tag {
  position: absolute; top: 8px; left: 8px;
  background: var(--danger, #E5534B);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.shop-product-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.shop-product-category {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shop-product-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.shop-product-price { font-size: 0.9rem; font-weight: 700; color: var(--blue); display: flex; align-items: baseline; gap: 6px; }
.shop-product-price.on-sale { color: var(--danger, #E5534B); }
.shop-product-compare-price { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); text-decoration: line-through; }

.shop-product-add {
  margin-top: 4px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.shop-product-add:hover { background: rgba(94,104,230,0.1); }

.shop-empty {
  text-align: center;
  padding: 60px 16px;
  color: var(--text-muted);
}
.shop-empty i { margin-bottom: 8px; opacity: 0.6; }

.shop-trust-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 14px 16px;
  background: rgba(94,104,230,0.06);
  border: 1px solid rgba(94,104,230,0.2);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.shop-trust-note i { color: var(--blue); flex-shrink: 0; }

/* ── Cart FAB ── */
.cart-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(94,104,230,0.4);
  z-index: 500;
}
.cart-fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  border-radius: var(--radius-full);
  background: var(--danger, #E5534B);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-base);
}

/* ── Cart drawer ── */
.cart-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,7,12,0.6);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.cart-drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--glass-bg);
  border-left: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s;
}
.cart-drawer-backdrop.open .cart-drawer { transform: translateX(0); }

.cart-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-drawer-header h3 { font-family: var(--font-head); font-size: 1rem; color: var(--text-primary); }

.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }

.cart-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--text-muted);
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cart-item-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-price { font-size: 0.75rem; color: var(--text-muted); }
.cart-item-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; align-self: flex-start;
}
.cart-item-remove:hover { color: var(--danger, #E5534B); }

.qty-stepper {
  display: flex; align-items: center; gap: 8px;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
}
.qty-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.qty-value { font-size: 0.78rem; font-weight: 600; min-width: 14px; text-align: center; }

.cart-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  padding: 40px 16px;
}

.cart-drawer-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}
.cart-subtotal-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.cart-subtotal-row strong { color: var(--blue); font-size: 1.1rem; }

/* ── Product detail page ── */
.product-detail-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (max-width: 760px) {
  .product-detail-wrap { grid-template-columns: 1fr; }
}

.pd-gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.pd-gallery-main img { width: 100%; height: 100%; object-fit: cover; }

.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumb {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.7;
}
.pd-thumb.active { border-color: var(--blue); opacity: 1; }
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pd-info { display: flex; flex-direction: column; }
.pd-shop-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 8px;
}
.pd-shop-link:hover { color: var(--blue); }
.pd-category-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
  background: rgba(94,104,230,0.1);
  border: 1px solid rgba(94,104,230,0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-decoration: none;
  margin-bottom: 10px;
}
.pd-category-tag:hover { background: rgba(94,104,230,0.18); }
.pd-name { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.pd-price { font-size: 1.3rem; font-weight: 800; color: var(--blue); margin-bottom: 16px; display: flex; align-items: baseline; gap: 10px; }
.pd-price.on-sale { color: var(--danger, #E5534B); }
.pd-price-compare { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); text-decoration: line-through; }
.pd-desc { font-size: 0.88rem; color: var(--text-body); line-height: 1.7; margin-bottom: 20px; white-space: pre-wrap; }

.pd-qty-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.pd-qty-row .qty-stepper { padding: 4px; }
.pd-qty-row .qty-btn { width: 28px; height: 28px; font-size: 1rem; }
.pd-qty-row .qty-value { font-size: 0.95rem; min-width: 20px; }

.pd-actions { display: flex; gap: 12px; margin-bottom: 24px; }
.pd-actions .btn-primary, .pd-actions .btn-secondary { flex: 1; justify-content: center; }

.spin { animation: spinIcon 0.8s linear infinite; }
@keyframes spinIcon { to { transform: rotate(360deg); } }

.modal-close {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text-primary); border-color: var(--border-hi); }

/* Browsers without backdrop-filter support fall back to a solid card. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .shop-product-card, .cart-drawer {
    background: var(--bg-card);
  }
}
