/* ═══════════════════════════════════════════════════════════════════════════
   Template Design System – override these variables per shop in <style>
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --primary:        #1e40af;
  --primary-dark:   #1d4ed8;
  --primary-light:  #dbeafe;
  --accent:         #dc2626;
  --accent-light:   #fee2e2;
  --nav-bg:         #0f172a;
  --nav-text:       rgba(255,255,255,.85);
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.07);
  --shadow:         0 2px 8px rgba(0,0,0,.09);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:      0 12px 32px rgba(0,0,0,.13);
  --transition:     .18s ease;
}

/* ─── Reset / Base ────────────────────────────────────────────────────────── */
body { background: var(--surface-2); color: var(--text); }
a    { color: var(--primary); }

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.site-nav {
  background: var(--nav-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.site-nav .navbar-brand { font-weight: 700; font-size: 1.3rem; color: #fff !important; letter-spacing: -.3px; }
.site-nav .nav-link      { color: var(--nav-text) !important; font-size: .875rem; padding: .5rem .8rem; transition: color var(--transition); }
.site-nav .nav-link:hover { color: #fff !important; }
.site-nav .nav-link.active { color: #fff !important; font-weight: 600; }
.site-nav .dropdown-menu { border: none; box-shadow: var(--shadow-lg); border-radius: var(--radius); }
.site-nav .navbar-toggler { color: #fff; border-color: rgba(255,255,255,.4); }
.site-nav .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(255,255,255,0.9)' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); }

/* ─── Hero ────────────────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--nav-bg) 0%, #1e3a5f 100%);
  color: #fff;
  padding: 4rem 0 3.5rem;
}
.page-hero-sm { padding: 2.5rem 0 2rem; }
.shop-hero {
  background: linear-gradient(to right, var(--nav-bg), #1e293b);
  color: #fff;
  padding: 5rem 0 4rem;
}

/* ─── Cards – general ─────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}

/* ─── Shop cards (shops.html) ─────────────────────────────────────────────── */
.shop-card { overflow: hidden; }
.shop-card .shop-logo {
  width: 72px; height: 72px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 4px;
  flex-shrink: 0;
}
.shop-logo-placeholder {
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

/* ─── Category cards (shop-index.html) ───────────────────────────────────── */
.category-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius) !important;
  min-height: 240px;
  cursor: pointer;
}
.category-card img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.category-card:hover img { transform: scale(1.05); }
.category-card .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.15) 60%, transparent 100%);
}
.category-card .cat-body {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1.5rem;
  color: #fff;
}
.category-card .cat-body h3 { font-weight: 700; margin-bottom: .5rem; }
.category-card .sub-tags .badge { opacity: .85; font-weight: 400; font-size: .75rem; }

/* ─── Product cards (category.html, product.html) ────────────────────────── */
.product-card { overflow: hidden; }
.product-card .product-img-wrap {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1;
}
.product-card .product-img-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: .75rem;
  transition: transform .25s ease;
}
.product-card:hover .product-img-wrap img { transform: scale(1.04); }
.product-card .badge-corner {
  position: absolute; top: .6rem; left: .6rem;
}
.product-card .wish-btn {
  position: absolute; top: .6rem; right: .6rem;
  background: rgba(255,255,255,.9);
  border: none; border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity var(--transition);
  color: var(--text-muted);
}
.product-card:hover .wish-btn { opacity: 1; }
.product-card .product-meta { font-size: .78rem; color: var(--text-muted); margin-bottom: .25rem; }
.product-card .product-name { font-size: .9rem; font-weight: 600; line-height: 1.35; margin-bottom: .5rem; }
.product-card .price        { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.product-card .price-old    { font-size: .8rem; color: var(--text-muted); text-decoration: line-through; }

/* List view */
#product-grid.product-list-view > .col {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}
#product-grid.product-list-view .product-card {
  flex-direction: row;
  align-items: stretch;
}
#product-grid.product-list-view .product-card .product-img-wrap {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  flex-shrink: 0;
  aspect-ratio: unset;
}
#product-grid.product-list-view .product-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

/* ─── Filter sidebar ──────────────────────────────────────────────────────── */
.filter-sidebar { position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow-y: auto; }
.filter-sidebar::-webkit-scrollbar { width: 4px; }
.filter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.filter-section { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.filter-section:last-child { border-bottom: none; }
.filter-section h6 { font-weight: 600; font-size: .85rem; margin-bottom: .75rem; color: var(--text); }
.filter-check { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; cursor: pointer; }
.filter-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.filter-check .filter-label { font-size: .875rem; flex: 1; }
.filter-check .filter-count { font-size: .75rem; color: var(--text-muted); }
.show-more-btn { font-size: .8rem; color: var(--primary); border: none; background: none; padding: 0; cursor: pointer; }

/* Active filter chips */
.filter-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 20px; padding: .25rem .7rem;
  font-size: .8rem; font-weight: 500;
  border: 1px solid #bfdbfe;
}
.filter-chip .chip-remove { background: none; border: none; padding: 0; line-height: 1; cursor: pointer; color: inherit; font-size: .9rem; }

/* ─── Price range slider ──────────────────────────────────────────────────── */
.price-display { display: flex; justify-content: space-between; font-size: .875rem; font-weight: 600; margin-bottom: .75rem; }
.range-wrapper { position: relative; height: 28px; }
.range-input {
  position: absolute; width: 100%; height: 4px;
  top: 50%; transform: translateY(-50%);
  background: none; -webkit-appearance: none; appearance: none;
  pointer-events: none; z-index: 3;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  height: 18px; width: 18px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer; pointer-events: auto;
}
.range-input::-moz-range-thumb {
  height: 18px; width: 18px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer; pointer-events: auto;
}
.range-track { position: absolute; height: 4px; background: var(--border); border-radius: 2px; width: 100%; top: 50%; transform: translateY(-50%); z-index: 1; }
.range-fill  { position: absolute; height: 100%; background: var(--primary); border-radius: 2px; }

/* ─── Sort / toolbar ──────────────────────────────────────────────────────── */
.product-toolbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem 1rem; }
.view-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .25rem .5rem; cursor: pointer; color: var(--text-muted); transition: all var(--transition); }
.view-btn.active, .view-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Product placeholder image ─────────────────────────────────────────── */
.img-placeholder { background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 3rem; aspect-ratio: 1; }

/* ─── Product detail ──────────────────────────────────────────────────────── */
.gallery-main {
  aspect-ratio: 1; background: var(--surface-2);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 1rem; }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.gallery-thumb {
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  overflow: hidden; cursor: pointer;
  background: var(--surface-2);
  transition: border-color var(--transition);
}
.gallery-thumb:hover, .gallery-thumb.active { border-color: var(--primary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.price-block .price-current { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.price-block .price-shipping { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

.product-specs-table th { font-weight: 400; color: var(--text-muted); width: 45%; white-space: nowrap; }
.product-specs-table td { font-weight: 500; }

/* ─── Similar products slider ────────────────────────────────────────────── */
.slider-prev, .slider-next {
  transition: all var(--transition);
}
.slider-prev:disabled, .slider-next:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.product-slider {
  display: flex; gap: 1rem;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: .25rem .1rem 1rem;
}
.product-slider::-webkit-scrollbar { display: none; }
.product-slide { flex: 0 0 210px; scroll-snap-align: start; }

/* ─── Content page ────────────────────────────────────────────────────────── */
.content-section { padding: 3rem 0; }
.content-section + .content-section { border-top: 1px solid var(--border); }
.content-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.content-img img { width: 100%; height: auto; display: block; }
.faq-item .accordion-button { font-weight: 600; }
.faq-item .accordion-button:not(.collapsed) { color: var(--primary); background: var(--primary-light); }
.cta-section {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--nav-bg) 100%);
  color: #fff; border-radius: var(--radius); padding: 3rem 2rem;
}

/* ─── Infinite scroll ────────────────────────────────────────────────────── */
.is-hidden { display: none !important; }
.scroll-sentinel { height: 60px; display: flex; align-items: center; justify-content: center; }
.loading-dots span {
  display: inline-block; width: 8px; height: 8px;
  background: var(--primary); border-radius: 50%; margin: 0 3px;
  animation: bounce .6s infinite alternate;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { to { transform: translateY(-8px); opacity: .5; } }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge-new  { background: #16a34a; }
.badge-sale { background: var(--accent); }
.badge-tag  { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); font-weight: 400; }

/* ─── Breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb { font-size: .82rem; --bs-breadcrumb-divider-color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--nav-bg); color: rgba(255,255,255,.7); font-size: .875rem; }
.site-footer h6 { color: #fff; font-weight: 600; margin-bottom: .75rem; }
.site-footer a { color: rgba(255,255,255,.6); text-decoration: none; transition: color var(--transition); }
.site-footer a:hover { color: #fff; }
.site-footer hr { border-color: rgba(255,255,255,.1); }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.rounded-card { border-radius: var(--radius) !important; }
.text-price    { color: var(--accent) !important; }
.btn-primary   { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ─── Category tree filter (sidebar) ────────────────────────────────────── */
.cat-tree-group { margin-bottom: .2rem; }
.cat-tree-row { display: flex; align-items: center; gap: .2rem; }
.cat-tree-expand {
  background: none; border: none; padding: 2px 5px; cursor: pointer;
  color: var(--text-muted); line-height: 1; flex-shrink: 0;
}
.cat-tree-expand i { display: inline-block; transition: transform .15s; }
.cat-tree-expand[aria-expanded="true"] i { transform: rotate(90deg); }
.cat-tree-children {
  padding-left: 1.1rem;
  border-left: 2px solid var(--border);
  margin-left: .7rem;
  margin-top: .15rem;
}

/* ─── Product description (HTML prose) ───────────────────────────────────── */
.product-description { font-size: .9375rem; line-height: 1.7; color: var(--text); }
.product-description h1,.product-description h2,.product-description h3,
.product-description h4,.product-description h5 { font-weight: 600; margin-top: 1.25em; margin-bottom: .5em; }
.product-description ul,.product-description ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.product-description li { margin-bottom: .3rem; }
.product-description table { width: 100%; font-size: .875rem; margin-bottom: 1rem; }
.product-description table th,.product-description table td { padding: .4rem .6rem; border: 1px solid var(--border); }
.product-description img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* ─── Star / rating widget ────────────────────────────────────────────────── */
.rating-widget { display: flex; align-items: center; gap: .75rem; }
.star-rating { display: flex; gap: .1rem; }
.star-btn {
  background: none; border: none; padding: 0;
  font-size: 1.3rem; cursor: pointer; line-height: 1;
  color: #cbd5e1; transition: color .12s;
}
.star-btn.active,.star-btn.hovered { color: #f59e0b; }
.rating-summary { font-size: .85rem; color: var(--text-muted); }

/* ─── Wish button states ──────────────────────────────────────────────────── */
.wish-btn.wished    { color: var(--accent) !important; opacity: 1 !important; }
.wish-btn-detail.wished i::before { content: "\f415"; } /* bi-heart-fill */

/* ─── Wishlist modal items ────────────────────────────────────────────────── */
.wish-shop-header { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; padding: .5rem 0; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.wish-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.wish-item:last-child { border-bottom: none; }
.wish-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); padding: 3px; flex-shrink: 0; }
.wish-item-name { font-size: .875rem; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wish-remove-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: .25rem; transition: color var(--transition); }
.wish-remove-btn:hover { color: var(--accent); }

/* ─── Share dropdown ──────────────────────────────────────────────────────── */
.share-menu { min-width: 11rem; }
.share-menu .dropdown-item { font-size: .875rem; display: flex; align-items: center; gap: .6rem; }
.share-menu .dropdown-item i { width: 1rem; text-align: center; }

/* ─── Toast notification ──────────────────────────────────────────────────── */
#app-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(1rem);
  background: var(--nav-bg); color: #fff;
  padding: .6rem 1.25rem; border-radius: var(--radius);
  font-size: .875rem; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 9999; white-space: nowrap;
}
#app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Responsive tweaks ──────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .page-hero { padding: 2.5rem 0 2rem; }
  .shop-hero  { padding: 3rem 0 2.5rem; }
  .slider-prev, .slider-next { display: none; }
  .gallery-thumbs .gallery-thumb { width: 56px; height: 56px; }
  .price-block .price-current { font-size: 1.6rem; }
}
