/* ============================================================
   ShopBase Pro — Main Styles
   Design: Dark luxury with neon accents
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080810;
  --bg2: #0e0e1a;
  --card: #111120;
  --card-hover: #16162a;
  --border: #1e1e35;
  --border-light: #2a2a45;
  --accent: #6c47ff;
  --accent2: #ff4d6d;
  --accent3: #00d4aa;
  --text: #e2e2f0;
  --text-muted: #6060a0;
  --text-faint: #30304a;
  --price: #7fffda;
  --shadow: 0 4px 24px rgba(0,0,0,.6);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,8,16,.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  height: 68px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.logo-icon {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem; font-weight: 800;
  color: var(--text);
}
.search-bar {
  flex: 1; display: flex; align-items: center;
  background: var(--bg2); border: 1px solid var(--border-light);
  border-radius: 12px; overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,71,255,.2);
}
.search-icon { padding: 0 14px; color: var(--text-muted); flex-shrink: 0; display: flex; }
.search-bar input {
  flex: 1; background: none; border: none; color: var(--text);
  font-family: inherit; font-size: .95rem; padding: 10px 0;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.btn-search {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 20px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.btn-search:hover { background: #7d5fff; }
.btn-admin {
  display: flex; align-items: center; gap: 8px;
  background: var(--border); color: var(--text);
  text-decoration: none; padding: 9px 18px;
  border-radius: 10px; font-size: .85rem; font-weight: 500;
  white-space: nowrap; transition: all var(--transition);
  border: 1px solid var(--border-light);
}
.btn-admin:hover { background: var(--border-light); border-color: var(--accent); color: var(--accent); }

/* ── HERO ── */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0c0c20 0%, #130b2e 50%, #0a1220 100%);
  border-bottom: 1px solid var(--border);
  padding: 80px 24px;
  text-align: center;
}
.hero-content { position: relative; z-index: 2; max-width: 600px; margin: 0 auto; }
.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; line-height: 1.1;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 70%, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.hero p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 40px; }
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.hero-orb {
  position: absolute; inset: -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(108,71,255,.15) 0%, transparent 70%);
  pointer-events: none;
}

/* ── FILTERS ── */
.filters-bar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 12px 24px; position: sticky; top: 68px; z-index: 99;
}
.filters-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.cats-scroll {
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none; flex: 1;
}
.cats-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-block; padding: 6px 16px;
  border-radius: 20px; font-size: .85rem; white-space: nowrap;
  text-decoration: none; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  transition: all var(--transition);
}
.cat-pill:hover { border-color: var(--accent); color: var(--accent); }
.cat-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.sort-wrap { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sort-label { font-size: .85rem; color: var(--text-muted); }
.sort-select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border-light);
  padding: 6px 12px; border-radius: 8px; font-family: inherit;
  font-size: .85rem; cursor: pointer; outline: none;
}

/* ── SEARCH INFO ── */
.search-info {
  max-width: 1400px; margin: 20px auto 0; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .9rem; color: var(--text-muted);
}
.clear-search {
  color: var(--accent2); text-decoration: none; font-weight: 500;
  padding: 4px 12px; border-radius: 6px; border: 1px solid rgba(255,77,109,.3);
  transition: all var(--transition);
}
.clear-search:hover { background: rgba(255,77,109,.1); }

/* ── PHOTO SEARCH ── */
.photo-search-banner {
  max-width: 1400px; margin: 24px auto 0; padding: 0 24px;
}
.photo-search-inner {
  background: linear-gradient(135deg, rgba(108,71,255,.08), rgba(0,212,170,.05));
  border: 1px solid rgba(108,71,255,.25);
  border-radius: var(--radius); padding: 20px 24px;
  display: flex; align-items: center; gap: 20px;
}
.photo-icon { font-size: 2rem; flex-shrink: 0; }
.photo-search-inner strong { font-weight: 600; display: block; margin-bottom: 4px; }
.photo-search-inner p { font-size: .85rem; color: var(--text-muted); }
.photo-search-inner > div:nth-child(2) { flex: 1; }
.btn-photo-upload {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: none;
  padding: 10px 20px; border-radius: 10px;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: .85rem;
  cursor: pointer; white-space: nowrap; transition: all var(--transition);
}
.btn-photo-upload:hover { background: #7d5fff; transform: translateY(-1px); }
.photo-results { margin-top: 16px; display: none; }
.photo-results.active { display: block; }

/* ── MAIN GRID ── */
.main-content {
  max-width: 1400px; margin: 28px auto; padding: 0 24px 60px;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ── PRODUCT CARD ── */
.product-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: all .25s ease;
  display: flex; flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: 0 12px 48px rgba(108,71,255,.2);
  background: var(--card-hover);
}
.card-img-wrap {
  position: relative; aspect-ratio: 4/3;
  background: var(--bg2); overflow: hidden;
}
.card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .card-img-wrap img { transform: scale(1.05); }
.no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0c0c20, #10102a);
}
.card-badges {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.badge-out { background: rgba(255,77,109,.2); color: var(--accent2); border: 1px solid rgba(255,77,109,.4); }
.badge-low { background: rgba(255,200,0,.15); color: #ffc800; border: 1px solid rgba(255,200,0,.3); }
.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-meta { display: flex; gap: 8px; align-items: center; }
.card-id {
  font-family: 'Syne', sans-serif; font-size: .75rem;
  color: var(--accent); font-weight: 700;
  background: rgba(108,71,255,.12); padding: 2px 8px;
  border-radius: 6px;
}
.card-sku { font-size: .75rem; color: var(--text-muted); }
.card-title {
  font-family: 'Syne', sans-serif; font-size: 1rem;
  font-weight: 700; line-height: 1.3; color: var(--text);
}
.card-desc { font-size: .82rem; color: var(--text-muted); flex: 1; }
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
}
.card-price {
  font-family: 'Syne', sans-serif; font-size: 1.1rem;
  font-weight: 800; color: var(--price);
}
.card-cat {
  font-size: .75rem; color: var(--text-muted);
  background: var(--bg); padding: 3px 10px;
  border-radius: 20px; border: 1px solid var(--border);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 80px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 20px; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 1.4rem; color: var(--text); margin-bottom: 8px; }
.empty-state a { color: var(--accent); }

/* ── PAGINATION ── */
.pagination {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 48px;
}
.page-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: var(--text-muted);
  font-weight: 600; transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.8); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--card); border: 1px solid var(--border-light);
  border-radius: 20px; width: 100%; max-width: 700px;
  max-height: 90vh; overflow-y: auto;
  position: relative; transform: translateY(20px);
  transition: transform .25s;
}
.modal-overlay.open .modal-box { transform: translateY(0); }
.modal-close {
  position: sticky; top: 16px; float: right; margin: 16px 16px 0 0;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); z-index: 10;
}
.modal-close:hover { color: var(--accent2); border-color: var(--accent2); }
.modal-loading { padding: 60px; text-align: center; color: var(--text-muted); }

/* Modal content styles (injected by JS) */
.modal-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px 14px 0 0; }
.modal-no-img {
  width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, #0c0c20, #10102a);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; border-radius: 14px 14px 0 0;
}
.modal-body { padding: 28px; }
.modal-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-tag {
  font-size: .8rem; padding: 4px 12px; border-radius: 20px;
  background: rgba(108,71,255,.12); color: var(--accent);
  border: 1px solid rgba(108,71,255,.2);
}
.modal-h1 { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; }
.modal-desc { color: var(--text-muted); line-height: 1.7; margin-bottom: 24px; }
.modal-price-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.modal-price { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 800; color: var(--price); }
.modal-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 24px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.modal-info-item { display: flex; flex-direction: column; gap: 4px; }
.modal-info-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.modal-info-val { font-weight: 600; color: var(--text); }

/* ── FOOTER ── */
.site-footer {
  text-align: center; padding: 24px;
  color: var(--text-faint); font-size: .82rem;
  border-top: 1px solid var(--border);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .logo-text { display: none; }
  .btn-admin span { display: none; }
  .filters-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 50px 20px; }
  .hero-stats { gap: 24px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .photo-search-inner { flex-wrap: wrap; }
  .modal-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-body { padding: 12px; }
}

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.product-card { animation: fadeIn .3s ease both; }
.product-card:nth-child(1)  { animation-delay: .00s }
.product-card:nth-child(2)  { animation-delay: .03s }
.product-card:nth-child(3)  { animation-delay: .06s }
.product-card:nth-child(4)  { animation-delay: .09s }
.product-card:nth-child(5)  { animation-delay: .12s }
.product-card:nth-child(6)  { animation-delay: .15s }
.product-card:nth-child(7)  { animation-delay: .18s }
.product-card:nth-child(8)  { animation-delay: .21s }
.product-card:nth-child(n+9){ animation-delay: .24s }
