:root {
  --bg: #08060d;
  --bg-2: #0e0a17;
  --surface: #140f22;
  --surface-2: #1b1430;
  --border: rgba(168, 85, 247, 0.18);
  --purple: #a855f7;
  --purple-bright: #c084fc;
  --purple-deep: #7c3aed;
  --pink: #d946ef;
  --text: #f3eefc;
  --muted: #a79ec0;
  --glow: 0 0 40px rgba(168, 85, 247, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

::selection { background: var(--purple); color: #0a0710; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--purple-deep); border-radius: 8px; }

h1, h2, h3, .logo { font-family: 'Unbounded', sans-serif; }
a { color: inherit; text-decoration: none; }
.container { width: min(1140px, 92%); margin: 0 auto; }

.bg-fx {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 58, 237, 0.25), transparent 60%),
    radial-gradient(ellipse 40% 35% at 85% 25%, rgba(217, 70, 239, 0.10), transparent 60%),
    var(--bg);
}
.grid-fx {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(168, 85, 247, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 85, 247, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 75%);
}

/* ---------- nav ---------- */
nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(8, 6, 13, 0.72);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo {
  font-weight: 900; font-size: 1.25rem; letter-spacing: 1px;
  display: flex; align-items: center; gap: 10px;
}
.logo .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-deep), var(--pink));
  display: grid; place-items: center; font-size: 1rem; color: #fff;
  box-shadow: var(--glow);
}
.logo span.grad {
  background: linear-gradient(90deg, var(--purple-bright), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-side-group { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 12px; font-weight: 700; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.22s ease;
  font-family: 'Inter', sans-serif; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple));
  color: #fff; box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(168, 85, 247, 0.5); }
.btn-ghost { border-color: var(--border); color: var(--text); background: rgba(168, 85, 247, 0.06); }
.btn-ghost:hover { border-color: var(--purple); background: rgba(168, 85, 247, 0.14); transform: translateY(-2px); }
.btn-danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 10px; }

/* user side = subtle, admin side = amber tool vibe */
.btn-admin {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff; box-shadow: 0 6px 18px rgba(217, 119, 6, 0.3);
}
.btn-admin:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(245, 158, 11, 0.45); }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(168, 85, 247, 0.08);
  max-width: 170px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-deep), var(--pink));
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; color: #fff;
  flex-shrink: 0;
}
.user-chip .uname {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.role-tag {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 1.2px;
  padding: 2px 8px; border-radius: 999px; text-transform: uppercase;
  font-family: 'Inter', sans-serif; flex-shrink: 0;
}
.tag-owner { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
.tag-dev { background: linear-gradient(135deg, var(--purple), var(--pink)); color: #fff; box-shadow: 0 0 10px rgba(168, 85, 247, 0.4); }
.tag-member { background: rgba(168, 85, 247, 0.18); color: var(--purple-bright); border: 1px solid var(--border); }

.hamburger { display: flex; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.hamburger span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.3s; }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  display: none; flex-direction: column; position: absolute; top: 72px; left: 0; right: 0;
  background: #0a0712; padding: 24px; gap: 6px; border-bottom: 1px solid var(--border);
  text-align: center; font-weight: 500; max-height: calc(100vh - 72px); overflow-y: auto;
}
.nav-links.mobile-open { display: flex; }
.nav-links a { color: var(--muted); transition: color 0.2s; padding: 8px 0; }
.nav-links a:hover { color: var(--purple-bright); }
.menu-section { display: flex; flex-direction: column; padding-bottom: 10px; }
.menu-section.admin-side { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 14px; }
.menu-label {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--purple-bright); margin-bottom: 6px;
}
.menu-section.admin-side .menu-label { color: #fbbf24; }

/* ---------- hero / sections ---------- */
.store-hero { text-align: center; padding: 70px 5% 40px; }
.store-hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 900; }
.store-hero h1 .grad, .grad-text {
  background: linear-gradient(90deg, var(--purple-bright), var(--pink), var(--purple-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.4));
}
.store-hero p { color: var(--muted); max-width: 560px; margin: 16px auto 0; }

/* ---------- admin toolbar ---------- */
.admin-bar {
  display: none; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  margin: 0 auto 34px; padding: 14px 18px; width: min(1140px, 92%);
  border: 1px dashed rgba(251, 191, 36, 0.5); border-radius: 16px;
  background: rgba(251, 191, 36, 0.06);
}
body.admin .admin-bar { display: flex; }
.admin-tag {
  font-size: 0.75rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: #fbbf24; margin-right: 6px;
}

/* ---------- categories ---------- */
.cat-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 44px; }
.cat-tab {
  padding: 10px 22px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.92rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.cat-tab:hover { border-color: var(--purple); color: var(--text); }
.cat-tab.active {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple));
  color: #fff; border-color: transparent; box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}
.cat-tab .del-cat {
  display: none; background: none; border: none; color: inherit; cursor: pointer;
  font-size: 0.85rem; opacity: 0.7; padding: 0;
}
body.admin .cat-tab .del-cat { display: inline; }
.cat-tab .del-cat:hover { opacity: 1; color: #fca5a5; }

/* ---------- items ---------- */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; padding-bottom: 90px; }
.item-card {
  position: relative; border-radius: 18px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 26px; display: flex; flex-direction: column; gap: 10px; transition: 0.25s;
}
.item-card:hover { transform: translateY(-6px); border-color: rgba(168, 85, 247, 0.5); box-shadow: var(--glow); }
.item-card .icon { font-size: 2rem; }
.item-card h3 { font-size: 1rem; font-weight: 700; }
.item-card .desc { color: var(--muted); font-size: 0.88rem; flex: 1; }
.item-card .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.item-card .price {
  font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 1.15rem;
  background: linear-gradient(90deg, var(--purple-bright), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.item-card .price.strike { text-decoration: line-through; opacity: 0.55; }
.item-card .sale-price { font-family:'Unbounded',sans-serif; font-weight:800; font-size:1.15rem; color:#4ade80; }
.badge-popular {
  position: absolute; top: 14px; right: 14px; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff;
}
.badge-sale {
  position: absolute; top: 14px; right: 14px; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  background: #16a34a; color: #fff;
}
.buy-btn {
  align-self: stretch; margin-top: 10px; padding: 11px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple));
  color: #fff; font-weight: 700; font-size: 0.9rem; transition: 0.2s; font-family: 'Inter', sans-serif;
}
.buy-btn:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.del-item {
  display: none; position: absolute; top: 12px; left: 12px; width: 28px; height: 28px;
  border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.12);
  color: #fca5a5; cursor: pointer; font-size: 0.85rem; line-height: 1;
}
body.admin .del-item { display: grid; place-items: center; }
.del-item:hover { background: rgba(239, 68, 68, 0.3); }

.add-item-card {
  display: none; border: 2px dashed rgba(168, 85, 247, 0.4); border-radius: 18px;
  min-height: 220px; place-items: center; cursor: pointer; color: var(--purple-bright);
  font-weight: 600; transition: 0.2s; background: rgba(168, 85, 247, 0.04);
}
body.admin .add-item-card { display: grid; }
.add-item-card:hover { border-color: var(--purple); background: rgba(168, 85, 247, 0.1); }

.empty-state { text-align: center; color: var(--muted); padding: 60px 0 100px; }

/* ---------- modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200; background: rgba(4, 2, 10, 0.8);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  place-items: center; padding: 20px;
}
.modal-overlay.open { display: grid; }
.modal {
  width: min(480px, 100%); border-radius: 20px; border: 1px solid rgba(168, 85, 247, 0.35);
  background: var(--surface); padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1.1rem; margin-bottom: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2, #0e0a17); color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.92rem;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- cards / misc ---------- */
.panel {
  border-radius: 18px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 26px;
}
.auth-card {
  width: min(520px, 92vw); text-align: center; border-radius: 22px;
  border: 1px solid rgba(168, 85, 247, 0.35); padding: 44px 34px;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(124, 58, 237, 0.25), transparent 70%), var(--surface);
  box-shadow: 0 30px 80px rgba(124, 58, 237, 0.15);
}
.code-block {
  font-family: Consolas, monospace; font-size: 0.8rem; background: #0a0712;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  overflow-x: auto; text-align: left; color: var(--purple-bright); white-space: pre;
}

footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--muted); font-size: 0.88rem; }
footer .logo { justify-content: center; margin-bottom: 10px; font-size: 1rem; }

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .items-grid { grid-template-columns: 1fr; }
  .nav-right .btn-ghost, .nav-side-group { display: none; }
  .user-chip .uname { display: none; }
  .user-chip { padding: 4px; }
}
