/* ==========================================================================
   TT Shop — Component Styles
   ========================================================================== */

/* ---------- Category Card ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 4px 16px 16px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease);
}
.category-card:hover { transform: translateY(-3px); }
.category-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--primary-light), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.category-card-name { font-size: 0.72rem; font-weight: 500; color: var(--text); line-height: 1.2; }

.category-hscroll .category-card { flex: 0 0 72px; }

/* ---------- Product Grid & Card ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 4px 16px 16px;
}
.product-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.product-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--background);
}
.product-card-media-link { display: block; width: 100%; height: 100%; }
.product-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease);
}
.product-card:hover .product-card-media img { transform: scale(1.06); }

.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  z-index: 1;
}
.badge-discount { background: var(--primary); color: #fff; }
.badge-flash { background: var(--accent); color: #fff; }
.badge-new { background: var(--success); color: #fff; }
.product-badge-top-right { left: auto; right: 8px; top: 8px; }
.badge-discount + .product-badge-top-right { top: 8px; }

.wishlist-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  z-index: 1;
}
.wishlist-btn:hover { transform: scale(1.1); }
.wishlist-btn.active { color: var(--primary); }
.wishlist-btn.active i { font-weight: 900; }
.wishlist-btn.pop { animation: heartPop 320ms var(--ease); }
@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.product-card-body { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-name {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2em;
}
.product-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.product-card-rating .stars { color: var(--warning); font-size: 0.65rem; letter-spacing: 1px; }
.rating-value { font-weight: 600; color: var(--text-muted); }
.dot-sep { opacity: 0.6; }

.product-card-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price-current { font-size: 1rem; font-weight: 700; color: var(--primary); }
.price-original { font-size: 0.75rem; color: var(--text-faint); text-decoration: line-through; }

.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 6px; }
.product-card-shop {
  font-size: 0.68rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.add-cart-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.add-cart-btn:hover { background: var(--primary); color: #fff; }
.add-cart-btn:active { transform: scale(0.88); }

/* ---------- Flash Sale ---------- */
.flash-sale-section {
  background: linear-gradient(155deg, #fff 0%, var(--primary-light) 120%);
  border-radius: var(--radius-lg);
  margin: 12px 16px;
  overflow: hidden;
}
.flash-sale-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.flash-sale-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  color: var(--primary-dark);
}
.flash-sale-title i { color: var(--accent); }
.countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.countdown-box {
  background: var(--secondary);
  color: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.flash-sale-section .hscroll { padding-top: 0; }
.flash-sale-section .product-card { min-width: 152px; max-width: 152px; }

/* Horizontally-scrolling product row (e.g. home.php "สินค้ามาใหม่") — every
   card gets the same fixed width so the (already square, aspect-ratio 1/1)
   images line up at identical sizes regardless of product name length. */
.product-hscroll { scroll-padding-left: 16px; }
.product-hscroll .product-card { flex: 0 0 158px; width: 158px; }

/* ---------- Promo Banner ---------- */
.promo-banner {
  margin: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 21 / 9;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-md);
}
.promo-banner::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.6), rgba(0,0,0,0)); }
.promo-banner-content { position: relative; z-index: 1; color: #fff; padding: 0 20px; max-width: 60%; }
.promo-banner-content h3 { font-size: 1.05rem; margin-bottom: 6px; }
.promo-banner-content p { font-size: 0.78rem; opacity: 0.9; margin-bottom: 10px; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 14px 16px;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb i { font-size: 0.6rem; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ---------- Listing Toolbar (product.php) ---------- */
.listing-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.listing-toolbar::-webkit-scrollbar { display: none; }
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.toolbar-btn.active, .toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.listing-count { padding: 0 16px 8px; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Filter Sidebar / Bottom Sheet ---------- */
.filter-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 18, 0.45);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
.leftbar {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--dur-base) var(--ease);
  box-shadow: var(--shadow-lg);
}
.leftbar.open { transform: translateY(0); }
.leftbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.leftbar-header h3 { font-size: 1rem; }
.leftbar-header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.leftbar-form { overflow-y: auto; padding: 4px 16px; flex: 1; }
.filter-group { border: none; padding: 14px 0; margin: 0; border-bottom: 1px solid var(--border); }
.filter-group legend { font-weight: 600; font-size: 0.88rem; margin-bottom: 10px; padding: 0; }
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.85rem;
  cursor: pointer;
}
.filter-checkbox input { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.filter-stars { display: flex; align-items: center; gap: 4px; color: var(--warning); }
.filter-stars ~ * { color: var(--text); }
.price-range-inputs { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.price-input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 0 12px;
  background: var(--background);
}
.filter-chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  font-size: 0.76rem;
  background: var(--surface);
}
.filter-chip.active, .filter-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.leftbar-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.leftbar-actions .btn { flex: 1; }

/* ---------- Pagination / Load more ---------- */
.load-more-wrap { display: flex; justify-content: center; padding: 20px 16px 32px; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px 16px 32px;
}
.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}
.pagination-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.pagination-ellipsis { padding: 0 4px; color: var(--text-muted); font-size: 0.82rem; }

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.empty-state h3 { font-size: 1.05rem; }
.empty-state p { color: var(--text-muted); font-size: 0.86rem; max-width: 320px; margin-bottom: 16px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 13px 16px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  position: relative;
  flex-shrink: 0;
}
.tab-btn.active { color: var(--primary); font-weight: 600; }
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 16px;
  right: 16px;
  height: 2.5px;
  background: var(--primary);
  border-radius: var(--radius-pill);
}
.tab-panel { display: none; padding: 16px; }
.tab-panel.active { display: block; animation: fadeIn var(--dur-base) var(--ease); }

/* ---------- Accordion ---------- */
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 4px;
  font-weight: 500;
  font-size: 0.9rem;
  text-align: left;
}
.accordion-trigger i { transition: transform var(--dur-fast) var(--ease); color: var(--text-faint); }
.accordion-item.open .accordion-trigger i { transform: rotate(180deg); }
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-base) var(--ease);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.accordion-item.open .accordion-panel { padding-bottom: 15px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 18, 0.5);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
.modal-backdrop.open { opacity: 1; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: min(420px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.92) translateY(10px);
  transition: transform var(--dur-base) var(--ease);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.modal-footer .btn { flex: 1; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 7px; }
.char-counter-hint { font-size: 0.7rem; color: var(--text-faint); text-align: right; margin-top: 4px; }
.char-counter-hint.is-near-limit { color: var(--danger); }

/* ---------- Avatar upload (profile_edit.php, store_settings.php's logo) ---------- */
.avatar-upload-group { text-align: center; margin-bottom: 22px; }
.avatar-upload { position: relative; display: inline-block; cursor: pointer; border-radius: 50%; }
.avatar-upload img {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  transition: opacity var(--dur-fast) var(--ease);
}
.avatar-upload:hover img,
.avatar-upload:focus-visible img { opacity: 0.85; }
.avatar-upload-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.avatar-upload-hint { font-size: 0.72rem; color: var(--text-faint); margin-top: 10px; }

/* ---------- Cover upload (store_settings.php) ---------- */
.cover-upload {
  display: block;
  position: relative;
  aspect-ratio: 3 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.cover-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-upload:hover img,
.cover-upload:focus-visible img { opacity: 0.85; }
.cover-upload-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
}
.cover-upload-placeholder i { font-size: 1.4rem; }
.cover-upload-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(20, 20, 25, 0.55);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.form-input-wrap { position: relative; }
.form-input, .form-select {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 0 16px;
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease);
}
textarea.form-input { height: auto; padding: 12px 16px; min-height: 90px; resize: vertical; }
.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-input.error { border-color: var(--danger); }
.form-error-msg { display: none; color: var(--danger); font-size: 0.76rem; margin-top: 6px; }
.form-input.error ~ .form-error-msg { display: block; }
.form-error-banner {
  background: rgba(255, 59, 92, 0.08);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 16px;
}
.form-error-banner ul { margin: 0; padding-left: 18px; }
.form-input-icon-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.form-checkbox-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.84rem; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.form-checkbox-row label { display: flex; align-items: center; gap: 8px; }
.form-checkbox-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-checkbox-row a { color: var(--primary); font-weight: 500; }
.form-divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 0.78rem; margin: 22px 0; }
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.social-login-row { display: flex; gap: 10px; }
.social-login-row .btn { flex: 1; background: var(--surface); border: 1.5px solid var(--border); color: var(--text); }
.social-login-row .btn i.fa-google { color: #ea4335; }
.social-login-row .btn i.fa-facebook { color: #1877f2; }

/* ---------- Auth Pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 32px 20px;
  background: linear-gradient(160deg, var(--primary) 0%, #ff8a65 55%, var(--accent) 100%);
  position: relative;
  overflow: hidden;
}
/* Two soft decorative blobs so the gradient reads as designed, not just a
   flat two-tone fill — subtle, behind everything, never intercepts clicks. */
.auth-page::before,
.auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
.auth-page::before { width: 280px; height: 280px; top: -80px; left: -90px; }
.auth-page::after { width: 220px; height: 220px; bottom: -60px; right: -70px; }

.auth-hero { width: 100%; max-width: 420px; text-align: center; color: #fff; position: relative; }
.auth-hero-logo { font-size: 1.9rem; font-weight: 700; font-family: 'Prompt', sans-serif; margin-bottom: 8px; }
.auth-hero-logo span { color: rgba(255, 255, 255, 0.85); }
.auth-hero-tagline { font-size: 0.9rem; color: rgba(255, 255, 255, 0.92); margin-bottom: 20px; }
.auth-hero-features { display: flex; justify-content: center; }
.auth-hero-feature {
  flex: 1;
  max-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
}
.auth-hero-feature i { font-size: 1.1rem; }
.auth-hero-feature span { font-size: 0.68rem; line-height: 1.4; color: rgba(255, 255, 255, 0.95); }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 32px 28px;
  position: relative;
}
.auth-logo { text-align: center; margin-bottom: 6px; font-size: 1.6rem; font-weight: 700; font-family: 'Prompt', sans-serif; }
.auth-logo span { color: var(--primary); }
.auth-welcome { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 26px; }
.auth-footer-link { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 20px; }
.auth-footer-link a { color: var(--primary); font-weight: 600; }
.auth-back { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }

@media (max-width: 380px) {
  .auth-hero-feature span { display: none; }
  .auth-hero-feature { flex: 0 0 auto; width: 44px; max-width: none; padding: 10px; }
}

/* ---------- Forgot Password Steps ---------- */
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 26px; }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--background);
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
.step-dot.active { background: var(--primary); color: #fff; }
.step-dot.done { background: var(--success); color: #fff; }
.step-line { width: 28px; height: 2px; background: var(--border); }
.step-panel { display: none; }
.step-panel.active { display: block; animation: fadeIn var(--dur-base) var(--ease); }

/* ---------- Product Detail ---------- */
.pd-gallery { position: relative; background: var(--surface); }
.pd-main-image { aspect-ratio: 1 / 1; overflow: hidden; position: relative; }
.pd-main-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.pd-main-image img.is-zoomed { transform: scale(1.8); }
.pd-thumbs { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; }
.pd-thumbs::-webkit-scrollbar { display: none; }
.pd-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; border: 2px solid transparent;
  opacity: 0.7; transition: opacity var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.pd-thumb.active { border-color: var(--primary); opacity: 1; }
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pd-info { padding: 16px; background: var(--surface); margin-top: 8px; }
.pd-shop-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--primary); background: var(--primary-light); padding: 4px 10px; border-radius: var(--radius-pill); font-weight: 600; margin-bottom: 10px; }
.pd-title { font-size: 1.15rem; line-height: 1.4; margin-bottom: 8px; }
.pd-rating-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; flex-wrap: wrap; }
.pd-rating-row .stars { color: var(--warning); }
.pd-price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.pd-price-current { font-size: 1.7rem; font-weight: 700; color: var(--primary); }
.pd-price-original { font-size: 0.95rem; color: var(--text-faint); text-decoration: line-through; }
.pd-discount-tag { background: var(--primary); color: #fff; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm); }
.pd-promo-box {
  margin-top: 14px;
  background: var(--accent-light);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #a15400;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pd-section { padding: 16px; background: var(--surface); margin-top: 8px; }
.pd-section-title { font-size: 0.95rem; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.pd-option-group { margin-bottom: 16px; }
.pd-option-label { font-size: 0.85rem; font-weight: 500; margin-bottom: 10px; display: flex; justify-content: space-between; }
.pd-option-values { display: flex; flex-wrap: wrap; gap: 8px; }
.option-pill {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  font-size: 0.82rem;
  min-height: 40px;
  display: inline-flex; align-items: center;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.option-pill.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }

.qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.qty-stepper button { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.qty-stepper button:disabled { opacity: 0.35; }
.qty-stepper input { width: 44px; text-align: center; border: none; height: 38px; background: transparent; }

.pd-shipping-row, .pd-shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.pd-shop-row img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.pd-shop-row .shop-meta { flex: 1; }
.pd-shop-row .shop-meta h4 { font-size: 0.92rem; margin-bottom: 3px; }
.pd-shop-row .shop-meta p { font-size: 0.74rem; color: var(--text-muted); }
.pd-shipping-row i { width: 22px; color: var(--primary); }
.pd-shipping-row span { font-size: 0.84rem; }

.pd-description { font-size: 0.88rem; line-height: 1.8; color: var(--text-muted); white-space: pre-line; }

.store-social-row { display: flex; gap: 10px; margin-top: 14px; }
.store-social-link {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--background);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 1px solid var(--border);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.store-social-link:hover { color: var(--primary); border-color: var(--primary); }
.spec-table { width: 100%; font-size: 0.85rem; }
.spec-table tr td { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.spec-table tr td:first-child { color: var(--text-faint); width: 40%; }
.spec-table tr td:last-child { font-weight: 500; }

.review-summary { display: flex; align-items: center; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.review-score { text-align: center; }
.review-score .score { font-size: 2.2rem; font-weight: 700; color: var(--primary); }
.review-score .stars { color: var(--warning); display: block; margin: 4px 0; }
.review-score p { font-size: 0.74rem; color: var(--text-muted); }
.review-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: none; }
.review-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.review-item-name { font-weight: 600; font-size: 0.85rem; }
.review-item .stars { color: var(--warning); font-size: 0.72rem; margin: 2px 0 6px; display: block; }
.review-item-date { color: var(--text-faint); font-size: 0.72rem; }
.review-item-comment { font-size: 0.84rem; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }

.pd-sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.pd-sticky-bar .icon-btn { border: 1px solid var(--border); flex-shrink: 0; }
.pd-sticky-bar .btn { flex: 1; padding-inline: 14px; white-space: nowrap; }

/* Very narrow phones (e.g. 320px): keep both CTAs on one row without
   overflowing by dropping the secondary button's label, icon only. */
@media (max-width: 360px) {
  .pd-sticky-bar { gap: 8px; padding-inline: 12px; }
  .pd-sticky-bar .icon-btn { width: 36px; height: 36px; }
  .pd-sticky-bar .btn-outline .btn-label { display: none; }
  .pd-sticky-bar .btn-outline { flex: 0 0 44px; padding-inline: 0; }
}

.related-products-section { margin-top: 8px; padding-top: 8px; background: var(--surface); }

/* ---------- Cart Page ---------- */
.cart-shop-group { background: var(--surface); border-radius: var(--radius-md); margin: 0 16px 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.cart-shop-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; }
.cart-shop-header input { width: 18px; height: 18px; accent-color: var(--primary); }
.cart-item { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); align-self: center; flex-shrink: 0; }
.cart-item-img { width: 78px; height: 78px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cart-item-name { font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cart-item-variant { font-size: 0.72rem; color: var(--text-faint); }
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.cart-item-price { font-weight: 700; color: var(--primary); font-size: 0.92rem; }
.cart-item-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 6px; font-size: 0.76rem; color: var(--text-faint); }
.cart-item-actions button:hover { color: var(--primary); }
.qty-stepper.sm button { width: 30px; height: 30px; font-size: 0.85rem; }
.qty-stepper.sm input { width: 34px; height: 30px; }

.cart-page .order-summary { display: none; }
.order-summary { background: var(--surface); border-radius: var(--radius-md); margin: 0 16px 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.order-summary h3 { font-size: 0.95rem; margin-bottom: 14px; }
.summary-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 6px 0; color: var(--text-muted); }
.summary-row.total { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 12px; font-weight: 700; color: var(--text); font-size: 1rem; }
.summary-row.total .value { color: var(--primary); }
.coupon-row { display: flex; gap: 8px; margin: 12px 0; }
.coupon-row input { flex: 1; }

.sticky-checkout-bar {
  position: sticky;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px rgba(0,0,0,.05);
}
.sticky-checkout-bar .select-all { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.sticky-checkout-bar .select-all input { width: 18px; height: 18px; accent-color: var(--primary); }
.sticky-checkout-total { font-size: 0.78rem; color: var(--text-muted); }
.sticky-checkout-total strong { font-size: 1.05rem; color: var(--primary); display: block; }

/* ---------- Checkout ---------- */
.checkout-section { background: var(--surface); border-radius: var(--radius-md); margin: 0 16px 12px; padding: 16px; box-shadow: var(--shadow-sm); }
/* wallet_topup.php / wallet_withdraw.php are short enough that their final
   submit button can land exactly in the fixed .bottom-nav's screen band on
   first load, before any scrolling — body's padding-bottom only reserves
   space at the true end of a page's scrollable content, it doesn't move
   content that happens to render higher up, so a real tap there hit the
   nav (z-index 90) instead of the button underneath it. Same fix pattern
   as .pd-sticky-bar (product_detail/cart): pin the section itself above
   the nav instead, so it's never overlapped at any scroll position. */
.page-wallet_topup .checkout-section:last-of-type,
.page-wallet_withdraw .checkout-section:last-of-type {
  position: sticky;
  bottom: calc(var(--bottom-nav-h) + 10px);
  z-index: 60;
}
.checkout-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 0.92rem; font-weight: 600; }
.checkout-section-title a { font-size: 0.78rem; color: var(--primary); font-weight: 500; }

.slip-required-tag { font-size: 0.66rem; font-weight: 700; color: var(--danger); background: var(--primary-light); padding: 2px 9px; border-radius: var(--radius-pill); }

/* ---------- Slip / receipt upload dropzone (wallet_topup.php) ---------- */
.slip-dropzone {
  display: block;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.slip-dropzone:hover,
.slip-dropzone:focus-visible { border-color: var(--primary); background: var(--primary-light); }
.slip-dropzone.is-dragover { border-color: var(--primary); background: var(--primary-light); }
.slip-dropzone.has-error { border-color: var(--danger); }

.slip-dropzone-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 16px; }
.slip-dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 10px;
}
.slip-dropzone-title { font-size: 0.86rem; font-weight: 600; margin-bottom: 4px; }
.slip-dropzone-hint { font-size: 0.72rem; color: var(--text-faint); }

.slip-dropzone-filled { display: flex; align-items: center; gap: 12px; padding: 12px; }
.slip-dropzone-filled img { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.slip-file-info { flex: 1; min-width: 0; }
.slip-file-name { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-file-meta { font-size: 0.72rem; color: var(--success); margin-top: 2px; }
.slip-file-meta i { margin-right: 3px; }
.slip-remove-btn { flex-shrink: 0; border: 1px solid var(--border); }

.slip-dropzone-error { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--danger); margin-top: 8px; }
.address-card { display: flex; gap: 10px; }
.address-card i { color: var(--primary); margin-top: 3px; }
.address-card strong { font-size: 0.88rem; }
.address-card p { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }
.address-tag { display: inline-block; font-size: 0.65rem; background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: var(--radius-sm); margin-left: 8px; font-weight: 600; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.radio-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.radio-option input { width: 18px; height: 18px; accent-color: var(--primary); }
.radio-option i { font-size: 1.1rem; color: var(--text-muted); width: 22px; }
.radio-option .radio-label strong { display: block; font-size: 0.86rem; }
.radio-option .radio-label span { font-size: 0.74rem; color: var(--text-faint); }

.checkout-product-row { display: flex; gap: 10px; padding: 8px 0; }
.checkout-product-row img { width: 52px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; }
.checkout-product-row .info { flex: 1; font-size: 0.8rem; }
.checkout-product-row .info p:first-child { margin-bottom: 4px; }
.checkout-product-row .price { font-size: 0.82rem; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ---------- Profile ---------- */
.profile-header {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 28px 16px 40px;
  color: #fff;
  border-radius: var(--radius-lg);
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.profile-header img { width: 64px; height: 64px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.6); object-fit: cover; flex-shrink: 0; }
.profile-header-info { flex: 1 1 150px; min-width: 0; }
.profile-header h2 { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-header p { font-size: 0.8rem; opacity: 0.9; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-header .btn { margin-left: auto; align-self: flex-start; flex-shrink: 0; }

.profile-quicklinks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: -26px 16px 8px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
}
.profile-quicklink { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.68rem; text-align: center; }
.profile-quicklink i { font-size: 1.2rem; color: var(--primary); }

.profile-menu { background: var(--surface); border-radius: var(--radius-md); margin: 0 16px 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.profile-menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item i:first-child { width: 22px; color: var(--text-muted); font-size: 1rem; }
.profile-menu-item .chevron { margin-left: auto; color: var(--text-faint); font-size: 0.8rem; }
.profile-menu-item.danger { color: var(--danger); }
.profile-menu-item.danger i:first-child { color: var(--danger); }

/* ---------- Orders ---------- */
.order-status-tabs { position: sticky; top: var(--header-h); z-index: 20; background: var(--surface); }
.order-card { background: var(--surface); border-radius: var(--radius-md); margin: 0 16px 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.order-card-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.order-card-header .order-id { font-weight: 600; }
.order-status-pill { font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }
.order-status-pill.to_pay { background: #fff2d9; color: #a15400; }
.order-status-pill.to_ship { background: #e3ecff; color: #2545c9; }
.order-status-pill.shipping { background: #fff1e0; color: var(--accent); }
.order-status-pill.completed { background: var(--success-light); color: var(--success); }
.order-status-pill.cancelled { background: #f4f4f5; color: var(--text-faint); }
.order-card-body { padding: 12px 14px; }
.order-card-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--border); }
.order-card-footer .total { font-size: 0.85rem; }
.order-card-footer .total strong { color: var(--primary); font-size: 1rem; }
.order-card-actions { display: flex; gap: 8px; }

/* ---------- Search ---------- */
.search-suggestions { padding: 4px 16px 8px; }
.search-suggestions h4 { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 10px; }
.suggested-keywords { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword-chip { padding: 8px 14px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); font-size: 0.8rem; }
.recent-search-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 0.85rem; color: var(--text-muted); }
.recent-search-item i:first-child { color: var(--text-faint); }
.recent-search-item .remove { margin-left: auto; color: var(--text-faint); }

/* ---------- Category Page ---------- */
.category-hero { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface); }
.category-hero-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.category-hero h1 { font-size: 1.15rem; }
.category-hero p { font-size: 0.8rem; color: var(--text-muted); }
.subcategory-hscroll .toolbar-btn { flex-shrink: 0; }

/* ---------- 404 ---------- */
.error-page {
  text-align: center;
  padding: 60px 24px;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.error-page .code { font-size: 5rem; font-weight: 800; color: var(--primary); font-family: 'Prompt', sans-serif; line-height: 1; }
.error-page h2 { margin: 10px 0 8px; }
.error-page p { color: var(--text-muted); margin-bottom: 20px; }

/* ---------- PWA install banner (js/pwa-install.js) ---------- */
.pwa-banner { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 1200; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #111; color: #fff; border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.35); max-width: 480px; margin: 0 auto; }
.pwa-banner-icon { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.pwa-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; }
.pwa-banner-text strong { font-size: 14px; }
.pwa-banner-text span { opacity: .8; }
.pwa-banner .icon-btn { color: #fff; flex-shrink: 0; }

/* Auth pages: logo mark centred with the wordmark; no bottom-nav reserve
   (nav isn't rendered here) so no white strip under the gradient. */
.auth-hero-logo, .auth-logo { display: flex; align-items: center; justify-content: center; }
.auth-logo-mark { width: 1.5em; height: 1.5em; border-radius: 9px; flex: none; margin-right: 10px; }
body.page-login, body.page-register, body.page-forgot, body.page-logout {
  padding-bottom: 0;
  background: #ff8a65;
}
.auth-page { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
