@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root, html[data-theme="dark"] {
  --bg: #050505; --bg-2: #0a0a0a; --bg-3: #111111;
  --surface: #0a0a0a; --surface-2: #141414;
  --line: #222222; --line-2: #2a2a2a;
  --accent: #e60000; --accent-2: #b30000;
  --text: #ffffff; --text-2: #d1d5db; --muted: #888888;
  --card: #0a0a0a; --card-line: #222222;
  --header: rgba(5,5,5,0.95); --footer: #020202;
  --hover-bg: #141414;
  --scroll-track: #050505; --scroll-thumb: #333333;
}
html[data-theme="light"] {
  --bg: #f9fafb; --bg-2: #ffffff; --bg-3: #f3f4f6;
  --surface: #ffffff; --surface-2: #f3f4f6;
  --line: #e5e7eb; --line-2: #d1d5db;
  --accent: #e60000; --accent-2: #cc0000;
  --text: #111827; --text-2: #374151; --muted: #6b7280;
  --card: #ffffff; --card-line: #e5e7eb;
  --header: rgba(255,255,255,0.95); --footer: #f9fafb;
  --hover-bg: #f3f4f6;
  --scroll-track: #f3f4f6; --scroll-thumb: #d1d5db;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Prompt',sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; transition: background .3s, color .3s; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

/* Header */
.header-main {
  background: var(--header); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px);
}
.site-logo { display:block; height:96px; width:auto; max-height:96px; }
.search-bar { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; transition: all .2s; }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230,0,0,0.12); }
.search-input { background: transparent; color: var(--text); border: none; outline: none; width: 100%; padding: 11px 18px; font-size: 14px; font-family: inherit; }
.search-input::placeholder { color: var(--muted); }
.search-btn { background: var(--accent); color: #fff; border-radius: 999px; padding: 8px 20px; font-weight: 600; font-size: 13px; margin: 3px; transition: all .2s; border: none; cursor: pointer; font-family: inherit; }
.search-btn:hover { background: var(--accent-2); }
.header-icon { display:flex; flex-direction:column; align-items:center; gap:2px; color:var(--text-2); transition:color .2s; position:relative; font-size:11px; text-decoration:none; }
.header-icon:hover { color: var(--accent); }
.header-icon .fa { font-size:19px; margin-bottom:1px; color:var(--text); transition:color .2s; }
.header-icon:hover .fa { color:var(--accent); }
.cart-badge { position:absolute; top:-4px; right:-8px; background:var(--accent); color:#fff; font-size:10px; font-weight:700; min-width:18px; height:18px; border-radius:999px; display:flex; align-items:center; justify-content:center; padding:0 5px; }
.theme-toggle { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px; background:var(--surface); border:1px solid var(--line); color:var(--text); cursor:pointer; transition:all .2s; font-size:12px; font-weight:600; font-family:inherit; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .sun { display:none; }
.theme-toggle .moon { display:inline; }
html[data-theme="light"] .theme-toggle .sun { display:inline; }
html[data-theme="light"] .theme-toggle .moon { display:none; }

/* Category nav */
.cat-nav { background: #0a0a0a; border-bottom: 1px solid #1a1a1a; }
html[data-theme="light"] .cat-nav { background: #f3f4f6; border-bottom: 1px solid #e5e7eb; }
.cat-nav-inner { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 10px 0; }
.cat-link { padding:8px 16px; color:#d0d0d0; font-size:13px; white-space:nowrap; transition:all .2s; border-radius:8px; display:inline-flex; align-items:center; gap:5px; text-decoration:none; }
html[data-theme="light"] .cat-link { color:#374151; }
.cat-link:hover, .cat-link.active { color:#fff; background:#1a1a1a; }
html[data-theme="light"] .cat-link:hover, html[data-theme="light"] .cat-link.active { color:#fff; background:#374151; }

/* Layout */
.products-layout { display:grid; grid-template-columns: 240px 1fr; gap:24px; max-width:1440px; margin:0 auto; padding:24px 20px; }
@media(max-width:1024px) { .products-layout { grid-template-columns:1fr; } }

/* Filter sidebar */
.filter-sidebar { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; height: fit-content; position: sticky; top: 110px; }
@media(max-width:1024px) { .filter-sidebar { position:static; display:none; } .filter-sidebar.open { display:block; } }
.filter-title { font-size:15px; font-weight:700; color:var(--text); margin-bottom:16px; display:flex; align-items:center; justify-content:space-between; }
.filter-section { margin-bottom:20px; padding-bottom:20px; border-bottom:1px solid var(--line); }
.filter-section:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
.filter-label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin-bottom:10px; }
.filter-chip { display:inline-flex; align-items:center; gap:5px; padding:6px 12px; border-radius:999px; border:1px solid var(--line); background:var(--surface-2); color:var(--text-2); font-size:12px; cursor:pointer; transition:all .18s; margin:3px; }
.filter-chip:hover, .filter-chip.active { border-color:var(--accent); color:var(--accent); background:rgba(230,0,0,0.06); }
.filter-check-row { display:flex; align-items:center; gap:8px; padding:5px 0; cursor:pointer; font-size:13px; color:var(--text-2); }
.filter-check-row:hover { color:var(--text); }
.brand-check { width:16px; height:16px; border:2px solid var(--line); border-radius:3px; display:flex; align-items:center; justify-content:center; transition:all .15s; flex-shrink:0; background:var(--surface); }
.brand-check.checked { background:var(--accent); border-color:var(--accent); }
.brand-check.checked::after { content:'✓'; color:#fff; font-size:11px; font-weight:bold; }
.price-inputs { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }
.price-input { background:var(--surface-2); border:1px solid var(--line); border-radius:8px; padding:8px 10px; color:var(--text); font-size:13px; width:100%; font-family:inherit; outline:none; }
.price-input:focus { border-color:var(--accent); }
.btn-clear-filter { background:none; border:1px solid var(--line); border-radius:8px; color:var(--muted); padding:8px 16px; font-size:12px; cursor:pointer; width:100%; transition:all .18s; font-family:inherit; margin-top:8px; }
.btn-clear-filter:hover { border-color:var(--accent); color:var(--accent); }

/* Product grid */
.product-grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
@media(max-width:1200px) { .product-grid-4 { grid-template-columns:repeat(3,1fr); } }
@media(max-width:768px) { .product-grid-4 { grid-template-columns:repeat(2,1fr); } }
@media(max-width:440px) { .product-grid-4 { grid-template-columns:1fr; } }

/* Section title */
.section-title { display:inline-flex; align-items:center; gap:10px; font-size:18px; font-weight:700; color:var(--text); }
.section-title::before { content:''; display:inline-block; width:4px; height:20px; background:var(--accent); border-radius:2px; }

/* Sort + results bar */
.results-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:18px; }
.sort-select { background:var(--surface-2); border:1px solid var(--line); border-radius:8px; padding:8px 14px; color:var(--text); font-size:13px; cursor:pointer; font-family:inherit; outline:none; }
.sort-select:focus { border-color:var(--accent); }
.results-count { font-size:13px; color:var(--muted); }

/* Product card styles (exact copy from index.html) */
.product-card {
  background:var(--card); color:var(--text); border-radius:8px; border:1px solid var(--card-line);
  overflow:hidden; position:relative; transition:transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s, border-color .3s;
  cursor:pointer; display:flex; flex-direction:column; animation:fadeInUp .5s ease both;
}
.product-card:hover { transform:translateY(-4px); box-shadow:0 16px 32px rgba(230,0,0,.15), 0 0 0 1px rgba(230,0,0,.5); border-color:var(--accent); }
.product-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:transparent; transition:background .3s; z-index:3; }
.product-card:hover::before { background:var(--accent); }
@keyframes fadeInUp { from{opacity:0;transform:translateY(15px)} to{opacity:1;transform:translateY(0)} }
.product-card .img-wrap { aspect-ratio:1/1; background:var(--surface-2); display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; padding:16px; }
.product-card .img-wrap img.product-photo { width:100%; height:100%; max-width:100%; max-height:100%; object-fit:cover; border-radius:8px; filter:contrast(1.04) saturate(1.06); transition:transform .5s, filter .35s; }
.product-card:hover .img-wrap img.product-photo { filter:contrast(1.12) saturate(1.12); }
.product-badge { position:absolute; top:10px; left:10px; z-index:2; font-size:10px; font-weight:700; padding:4px 10px; border-radius:4px; letter-spacing:.04em; text-transform:uppercase; background:#111; color:#fff; }
.product-badge.sale { background:var(--accent); }
.product-badge.new { background:#333333; }
.product-badge.hot { background:linear-gradient(90deg,#e60000,#8b0000); }
.product-wishlist { position:absolute; top:10px; right:10px; z-index:2; width:32px; height:32px; border-radius:999px; background:rgba(255,255,255,.9); backdrop-filter:blur(4px); border:1px solid #e5e5e5; display:flex; align-items:center; justify-content:center; color:#555; cursor:pointer; transition:all .2s; }
.product-wishlist:hover { color:var(--accent); transform:scale(1.1); }
.product-wishlist.active { color:#fff; background:var(--accent); border-color:var(--accent); }
.product-info { padding:12px; flex:1; display:flex; flex-direction:column; }
.product-name { font-size:13px; color:var(--text); font-weight:500; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:36px; }
.product-price-row { margin-top:6px; display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.price-now { color:var(--accent); font-weight:700; font-size:17px; }
.price-old { color:var(--muted); text-decoration:line-through; font-size:12px; }
.price-disc { background:rgba(230,0,0,.1); color:var(--accent); font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; }
.product-meta { display:flex; align-items:center; justify-content:space-between; margin-top:8px; font-size:11px; color:var(--muted); }
.rating-stars { color:var(--accent); }
.installment-chip { display:inline-flex; align-items:center; gap:4px; background:rgba(255,255,255,.1); color:var(--text); font-size:10px; font-weight:600; padding:3px 8px; border-radius:4px; margin-top:4px; border:1px solid var(--line); }
html[data-theme="light"] .installment-chip { background:rgba(0,0,0,.05); }

/* Blue style card */
.product-card.blue-style { border:1px solid var(--card-line); background:var(--card); }
.product-card.blue-style .img-wrap { background:var(--surface-2); padding:16px; }
.advice-badge-top { position:absolute; top:10px; left:10px; z-index:3; display:flex; flex-direction:row; align-items:center; gap:6px; flex-wrap:wrap; pointer-events:none; }
.advice-badge-top .yellow-chip { background:#fff; color:#111; font-size:9px; font-weight:800; padding:3px 8px; border-radius:4px; box-shadow:0 2px 8px rgba(0,0,0,0.12); }
.sale-chip { background:var(--accent); color:#fff; font-size:10px; font-weight:700; padding:4px 10px; border-radius:999px; text-transform:uppercase; white-space:nowrap; box-shadow:0 2px 8px rgba(0,0,0,0.15); letter-spacing:0.02em; }
.sale-chip.new { background:linear-gradient(135deg,#22c55e,#16a34a); }
.sale-chip.hot { background:linear-gradient(135deg,#f97316,#ea580c); }
.labels-row { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:6px; }
.labels-row .sale-chip { position:static; display:inline-block; box-shadow:none; }
.product-view-btn { position:absolute; top:48px; right:10px; z-index:3; width:32px; height:32px; border-radius:999px; background:#fff; border:1px solid #e5e7eb; display:flex; align-items:center; justify-content:center; color:var(--accent); cursor:pointer; transition:all .2s; }
.product-view-btn:hover { background:var(--accent); color:#fff; }
.rating-badge-blue { display:inline-flex; align-items:center; gap:3px; background:#111; color:#fff; font-size:10px; font-weight:600; padding:2px 6px; border-radius:4px; }
.mini-icons { display:flex; gap:6px; margin-top:4px; color:var(--muted); font-size:12px; }
.mini-icons i { cursor:pointer; transition:color .2s; }
.mini-icons i:hover { color:var(--accent); }
.mini-icons i.active { color:var(--accent); }
.btn-row-blue { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:10px 12px 12px; }
.product-card.blue-style .btn-blue-buy { display:flex; align-items:center; justify-content:center; gap:6px; padding:10px 8px; border-radius:8px; font-size:13px; font-weight:600; text-align:center; transition:all .2s; cursor:pointer; border:none; font-family:inherit; }
.product-card.blue-style .btn-blue-cart { background:var(--surface-2); color:var(--text); border:1px solid var(--line); }
.product-card.blue-style .btn-blue-cart:hover { background:var(--hover-bg); border-color:var(--text); }
.product-card.blue-style .btn-blue-now { background:var(--accent); color:#fff; }
.product-card.blue-style .btn-blue-now:hover { background:var(--accent-2); transform:translateY(-1px); }
.product-brand-inline { display:flex; align-items:center; height:60px; margin-bottom:6px; }
.product-brand-inline img, .product-brand-inline svg { height:100%; width:auto; max-width:160px; max-height:60px; object-fit:contain; filter:drop-shadow(0 1px 2px rgba(0,0,0,.1)); }
html[data-theme="dark"] .product-brand-inline img { filter:brightness(0) invert(1) drop-shadow(0 1px 3px rgba(255,255,255,.1)); }
html[data-theme="dark"] .product-brand-inline svg text { fill:#fff !important; }
.product-brand-inline .font-bold { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; }
.product-brand-overlay { position:absolute; bottom:-20px; left:12px; z-index:5; height:95px; display:flex; align-items:center; pointer-events:none; }
.product-brand-overlay img, .product-brand-overlay svg { height:100%; width:auto; max-width:160px; max-height:95px; object-fit:contain; filter:drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.product-brand-overlay .font-bold { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; background:rgba(0,0,0,.5); padding:2px 6px; border-radius:4px; }

/* Pagination */
.pagination { display:flex; align-items:center; justify-content:center; gap:8px; margin-top:32px; }
.page-btn { width:36px; height:36px; border-radius:8px; border:1px solid var(--line); background:var(--surface-2); color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:13px; transition:all .18s; font-family:inherit; }
.page-btn:hover, .page-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.page-btn:disabled { opacity:.4; cursor:not-allowed; }

/* Toast */
.toast { position:fixed; bottom:24px; right:24px; z-index:9999; background:#1a1a1a; color:#fff; border-radius:12px; padding:14px 20px; display:flex; align-items:center; gap:10px; font-size:14px; box-shadow:0 8px 32px rgba(0,0,0,.4); transform:translateY(80px); opacity:0; transition:all .35s; pointer-events:none; border:1px solid #2a2a2a; }
.toast.show { transform:translateY(0); opacity:1; pointer-events:auto; }
.toast.error { background:#2a0a0a; border-color:#e60000; }
.toast .icon { color:var(--accent); font-size:16px; }
.toast.error .icon { color:#e60000; }
html[data-theme="light"] .toast { background:#fff; color:#111; border:1px solid #e5e7eb; }

/* Mobile filter button */
.btn-filter-toggle { display:none; align-items:center; gap:8px; padding:10px 16px; background:var(--surface-2); border:1px solid var(--line); border-radius:8px; color:var(--text); font-size:13px; cursor:pointer; font-family:inherit; }
@media(max-width:1024px) { .btn-filter-toggle { display:inline-flex; } }

/* Footer */
footer { background:var(--footer); border-top:1px solid var(--line); padding:32px 20px 20px; margin-top:60px; }
.footer-logo { display:block; height:70px; width:auto; max-height:70px; }
.footer-link { color:var(--muted); font-size:13px; transition:color .2s; text-decoration:none; display:block; margin-bottom:6px; }
.footer-link:hover { color:var(--accent); }
.footer-title { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text); margin-bottom:12px; }

/* no-scrollbar */
.no-scrollbar::-webkit-scrollbar { display:none; }
.no-scrollbar { -ms-overflow-style:none; scrollbar-width:none; }

/* ============ SMOOTH LOADING & SKELETON ============ */
.raw-html-page { opacity: 0; transition: opacity 0.35s ease; }
.raw-html-page.products-body-loaded { opacity: 1; }

.products-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--bg, #0b0f19);
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
}
.products-main-skeleton { min-width: 0; }
.skeleton-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.skeleton-chip { height: 32px; width: 92px; border-radius: 999px; background: var(--surface-2); animation: skeletonPulse 1.5s ease-in-out infinite; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media(max-width:1024px) { .skeleton-grid { grid-template-columns: repeat(3, 1fr); } }
@media(max-width:768px) { .skeleton-grid { grid-template-columns: repeat(2, 1fr); } }
@media(max-width:480px) { .skeleton-grid { grid-template-columns: 1fr; } }
.skeleton-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.skeleton-img { aspect-ratio: 1 / 1; border-radius: 8px; background: var(--surface-2); animation: skeletonPulse 1.5s ease-in-out infinite; }
.skeleton-text { height: 14px; border-radius: 4px; background: var(--surface-2); margin-top: 12px; animation: skeletonPulse 1.5s ease-in-out infinite; }
.skeleton-text.short { width: 45%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.price { width: 35%; height: 18px; }

@keyframes skeletonPulse {
  0% { opacity: 1; }
  50% { opacity: 0.45; }
  100% { opacity: 1; }
}
@keyframes productsSkeletonFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Product grid fade-in when first rendered */
#product-grid { transition: opacity 0.35s ease; }
#product-grid.loading { opacity: 0.6; }

/* Loading overlay for product grid */
.products-loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--muted); font-size: 14px;
}
.products-loading-overlay i { margin-right: 8px; }
