@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --bg:        #09090b;
  --bg2:       #0f0f11;
  --bg3:       #18181b;
  --surface:   #27272a;
  --surface2:  #3f3f46;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --border3:   rgba(255,255,255,0.22);
  --text:      #fafafa;
  --text2:     #a1a1aa;
  --muted:     #71717a;
  --accent:    #4ade80;
  --accent2:   #ff6b35;
  --accent-dk: #22c55e;
  --red:       #ef4444;
  --green:     #22c55e;
  --blue:      #3b82f6;
  --r:         8px;
  --r-lg:      12px;
  --r-xl:      16px;
  --nav-h:     60px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow:    0 4px 6px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-md: 0 10px 20px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.25);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5 { font-family: 'Space Grotesk', sans-serif; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: 'Inter', sans-serif; }
input, textarea, select {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: var(--r);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.08);
}
select option { background: var(--bg3); }

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  background: var(--nav-bg, rgba(9,9,11,0.85));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-family: 'Space Grotesk', sans-serif; font-weight: 800;
  font-size: 1.15rem; letter-spacing: -0.03em;
  display: flex; align-items: center; gap: 7px;
}
.logo-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.nav-links { display: flex; gap: 0.25rem; align-items: center; }
.nav-links a {
  color: var(--text2); font-size: 0.85rem; transition: color 0.15s;
  padding: 0.35rem 0.75rem; border-radius: 6px;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); }
.nav-actions { display: flex; gap: 0.5rem; align-items: center; }
.nav-btn {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text2); border-radius: var(--r);
  padding: 0.4rem 0.875rem; font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
  font-family: 'Inter', sans-serif;
}
.nav-btn:hover { border-color: var(--border3); color: var(--text); background: var(--surface2); }
.cart-bubble {
  background: var(--red); color: #fff; border-radius: 50%;
  width: 16px; height: 16px; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
}

/* ── LAYOUT ── */
.page-wrap { padding-top: var(--nav-h); min-height: 100vh; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }

/* ── TYPOGRAPHY ── */
.label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.title-xl { font-size: clamp(2rem, 5vw, 3.75rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.title-lg { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.title-md { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0.55rem 1.25rem; border-radius: var(--r);
  font-family: 'Inter', sans-serif; font-weight: 500; font-size: 0.875rem;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s; white-space: nowrap; letter-spacing: 0;
  height: 38px;
}
.btn-accent {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 600;
}
.btn-accent:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-outline {
  background: transparent; border-color: var(--border2); color: var(--text);
}
.btn-outline:hover { border-color: var(--border3); background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger {
  background: rgba(239,68,68,0.1); color: var(--red);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { height: 32px; padding: 0 0.875rem; font-size: 0.8rem; }
.btn-lg { height: 44px; padding: 0 1.75rem; font-size: 0.95rem; font-weight: 600; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── CARDS ── */
.card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card-body { padding: 1.25rem; }
.card:hover { border-color: var(--border2); box-shadow: var(--shadow); }

/* ── PRODUCT CARD ── */
.product-card { cursor: pointer; }
.product-card:hover { transform: translateY(-3px); }
.product-thumb {
  height: 200px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .thumb-emoji { transition: transform 0.35s; }
.product-card:hover .thumb-emoji { transform: scale(1.1) rotate(3deg); }
.prod-tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #000;
  font-family: 'Inter', sans-serif; font-size: 0.68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em;
}
.prod-tag.red { background: var(--red); color: #fff; }
.prod-tag.orange { background: var(--accent2); color: #fff; }
.prod-3d {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); color: var(--accent);
  font-family: 'Space Grotesk', sans-serif; font-size: 0.6rem; font-weight: 800;
  padding: 2px 7px; border-radius: 4px; letter-spacing: 0.1em; border: 1px solid rgba(74,222,128,0.3);
}
.prod-cat {
  font-size: 0.7rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 5px; display: block;
}
.prod-name {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 0.92rem; margin-bottom: 6px; line-height: 1.35;
}
.prod-desc { font-size: 0.8rem; color: var(--text2); line-height: 1.6; margin-bottom: 1rem; }
.prod-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.prod-price {
  font-family: 'Space Grotesk', sans-serif; font-weight: 800;
  font-size: 1.05rem; color: var(--accent);
}
.prod-old {
  font-size: 0.75rem; color: var(--muted);
  text-decoration: line-through; display: block;
  font-weight: 400; line-height: 1.2;
}

/* ── FORM ── */
.form-group { margin-bottom: 1.125rem; }
.form-label {
  font-size: 0.82rem; font-weight: 500; color: var(--text2);
  margin-bottom: 0.375rem; display: block;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-error { font-size: 0.75rem; color: var(--red); margin-top: 4px; }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; font-family: 'Inter', sans-serif;
  letter-spacing: 0.02em;
}
.badge-green  { background: rgba(34,197,94,0.1);  color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow { background: rgba(74,222,128,0.1); color: var(--accent); border: 1px solid rgba(74,222,128,0.2); }
.badge-red    { background: rgba(239,68,68,0.1);  color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-gray   { background: var(--surface); color: var(--text2); border: 1px solid var(--border2); }
.badge-orange { background: rgba(255,107,53,0.1); color: var(--accent2); border: 1px solid rgba(255,107,53,0.2); }
.badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; flex-shrink:0; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--bg3); padding: 0.7rem 1rem;
  font-family: 'Inter', sans-serif; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td { padding: 0.875rem 1rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  background: var(--bg3); border: 1px solid var(--border2); color: var(--text);
  padding: 0.75rem 1rem; border-radius: var(--r-lg);
  font-size: 0.85rem; box-shadow: var(--shadow-md);
  transform: translateY(16px); opacity: 0;
  transition: all 0.25s; pointer-events: none;
  display: flex; align-items: center; gap: 10px; max-width: 300px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success .toast-icon { color: var(--green); }
#toast.error .toast-icon { color: var(--red); }
#toast.info .toast-icon { color: var(--accent); }
.toast-icon { font-size: 0.9rem; flex-shrink: 0; }

/* ── MODAL ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.modal-bg.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r-xl); padding: 1.75rem; max-width: 480px; width: 100%;
  transform: translateY(12px) scale(0.99); transition: transform 0.2s;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-bg.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-title { font-family: 'Space Grotesk', sans-serif; font-weight: 800; font-size: 1.1rem; }
.modal-close {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); width: 30px; height: 30px;
  border-radius: 6px; cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--muted); font-size: 0.875rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.875rem; opacity: 0.6; }
.empty-state p { max-width: 260px; margin: 0 auto; line-height: 1.7; }

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }

/* ── FOOTER ── */
footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 3.5rem 2rem 1.75rem;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem; max-width: 1200px; margin: 0 auto 2.5rem;
}
.footer-brand p {
  font-size: 0.825rem; color: var(--text2);
  margin-top: 0.75rem; max-width: 240px; line-height: 1.7;
}
.footer-col h5 {
  font-family: 'Inter', sans-serif; font-weight: 600;
  font-size: 0.78rem; margin-bottom: 0.875rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2);
}
.footer-col a {
  display: block; color: var(--muted); font-size: 0.85rem;
  margin-bottom: 0.45rem; transition: color 0.15s;
}
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto;
  font-size: 0.78rem; color: var(--muted);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-up   { animation: fadeUp 0.4s ease both; }
.fade-up-2 { animation: fadeUp 0.4s 0.08s ease both; }
.fade-up-3 { animation: fadeUp 0.4s 0.16s ease both; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  nav { padding: 0 1rem; }
  .nav-links { display: none; }
  .container { padding: 0 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .section { padding: 3rem 0; }
}

/* ── THEME TRANSITION ── */
html { transition: background-color 0.2s, color 0.2s; }
*, *::before, *::after { transition: background-color 0.2s, border-color 0.2s, color 0.15s; }
.btn, .product-card, .card { transition: background-color 0.2s, border-color 0.2s, color 0.15s, transform 0.2s, box-shadow 0.2s, opacity 0.15s; }

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg:        #f8f8f8;
  --bg2:       #f1f0ee;
  --bg3:       #eae9e6;
  --surface:   #e0deda;
  --surface2:  #d4d2ce;
  --border:    rgba(0,0,0,0.07);
  --border2:   rgba(0,0,0,0.13);
  --border3:   rgba(0,0,0,0.22);
  --text:      #18181b;
  --text2:     #52525b;
  --muted:     #a1a1aa;
  --accent:    #16a34a;
  --accent2:   #c84a0e;
  --accent-dk: #15803d;
  --red:       #dc2626;
  --green:     #16a34a;
  --nav-bg:    rgba(248,248,248,0.9);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 20px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
}
[data-theme="light"] nav { background: var(--nav-bg); }
[data-theme="light"] select option { background: var(--bg2); color: var(--text); }
[data-theme="light"] .badge-green  { background: rgba(22,163,74,0.08);  color: var(--green); border-color: rgba(22,163,74,0.2); }
[data-theme="light"] .badge-yellow { background: rgba(22,163,74,0.08);   color: var(--accent); border-color: rgba(22,163,74,0.2); }
[data-theme="light"] .badge-red    { background: rgba(220,38,38,0.08);  color: var(--red); border-color: rgba(220,38,38,0.2); }
[data-theme="light"] .badge-orange { background: rgba(200,74,14,0.08);  color: var(--accent2); border-color: rgba(200,74,14,0.2); }
[data-theme="light"] .spinner { border-color: var(--border2); border-top-color: var(--accent); }

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
  width: 34px; height: 34px; border-radius: var(--r);
  border: 1px solid var(--border2); background: transparent;
  color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; transition: all 0.2s; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--border3); color: var(--text); background: var(--surface); }
