/* ZenSurf Community Store — dark theme */
:root {
  --bg: #070a12;
  --bg-elev: #0d1220;
  --surface: #111829;
  --surface-2: #161f34;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8edf7;
  --muted: #8b97ad;
  --faint: #5d6880;
  --accent: #6ee7d8;
  --accent-2: #7aa7ff;
  --accent-ink: #052421;
  --danger: #ff6b81;
  --warning: #ffcc66;
  --success: #5ee6a0;
  --star: #ffd166;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(122, 167, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(110, 231, 216, 0.08), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 650; letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { color: var(--muted); font-size: 13px; padding: 0 6px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 550; font-size: 14px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: rgba(255, 255, 255, 0.24); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, #8af0e3, #94b8ff); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-danger { border-color: rgba(255, 107, 129, 0.45); color: var(--danger); background: rgba(255, 107, 129, 0.06); }
.btn-success { border-color: rgba(94, 230, 160, 0.45); color: var(--success); background: rgba(94, 230, 160, 0.06); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn.installed { border-color: rgba(94, 230, 160, 0.5); color: var(--success); background: rgba(94, 230, 160, 0.08); }

/* ---------- Layout ---------- */
main { padding: 28px clamp(16px, 4vw, 40px) 64px; max-width: 1360px; margin: 0 auto; }
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.hero h1 { font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.01em; }
.hero p { color: var(--muted); margin: 0; max-width: 620px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.tab[aria-selected='true'] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
select, input[type='text'], input[type='email'], input[type='password'], textarea {
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--text); width: 100%;
}
.sort select { width: auto; }
textarea { resize: vertical; min-height: 90px; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card-media { position: relative; aspect-ratio: 16 / 10; background: #0a0f1c; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .badge { position: absolute; left: 10px; top: 10px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { margin: 0; font-size: 17px; font-weight: 650; }
.card-desc { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--faint); font-size: 13px; }
.meta strong { color: var(--muted); font-weight: 550; }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; align-items: center; }
.card-actions .btn-primary { flex: 1; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; letter-spacing: 0.02em; background: rgba(7, 10, 18, 0.75); border: 1px solid var(--border-strong); color: var(--text); }
.status-pending { color: var(--warning); border-color: rgba(255, 204, 102, 0.4); }
.status-approved { color: var(--success); border-color: rgba(94, 230, 160, 0.4); }
.status-rejected { color: var(--danger); border-color: rgba(255, 107, 129, 0.4); }
.status-suspended { color: #c4a1ff; border-color: rgba(196, 161, 255, 0.4); }

/* Rating */
.rating { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.stars { display: inline-flex; }
.star { border: 0; background: none; padding: 0 1px; cursor: pointer; font-size: 18px; line-height: 1; color: rgba(255, 255, 255, 0.18); }
.star.on { color: var(--star); }
.star:disabled { cursor: default; }
.stars.interactive:hover .star { color: var(--star); }
.stars.interactive .star:hover ~ .star { color: rgba(255, 255, 255, 0.18); }
.rating-value { color: var(--text); font-weight: 650; }

/* States */
.empty, .loading { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.more { display: flex; justify-content: center; margin-top: 28px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Modals ---------- */
dialog {
  border: 1px solid var(--border-strong); border-radius: 18px; padding: 0; background: var(--bg-elev); color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog.wide { width: min(1100px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(3, 5, 10, 0.7); backdrop-filter: blur(4px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.file-input { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px; background: var(--bg); }
.file-input input { width: 100%; color: var(--muted); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.checkbox input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.form-error { color: var(--danger); font-size: 14px; margin: 0; white-space: pre-line; }
.form-success { color: var(--success); font-size: 14px; margin: 0; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.segmented { display: flex; gap: 6px; }
.segmented .tab { flex: 1; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { text-align: left; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice strong { display: block; margin-bottom: 4px; }
.choice span { color: var(--muted); font-size: 13px; }
.preview-frame { width: 100%; height: min(70vh, 640px); border: 0; background: #fff; display: block; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.list-row img { width: 72px; height: 45px; object-fit: cover; border-radius: 6px; background: #0a0f1c; flex: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 107, 129, 0.5); }
.toast.success { border-color: rgba(94, 230, 160, 0.5); }

footer.site { color: var(--faint); font-size: 13px; text-align: center; padding: 30px 16px 40px; border-top: 1px solid var(--border); }
footer.site a { color: var(--muted); }

.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { margin-top: 0; }
.prose h2 { font-size: 17px; margin: 22px 0 6px; }
.prose p, .prose li { color: var(--muted); }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; align-self: start; }
.side-nav button { text-align: left; border: 0; background: transparent; color: var(--muted); padding: 10px 14px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; font-weight: 550; }
.side-nav button[aria-current='true'] { background: var(--surface-2); color: var(--text); }
.side-nav .count { color: var(--faint); font-variant-numeric: tabular-nums; }
.panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: rgba(255, 255, 255, 0.02); }
.thumb { width: 88px; height: 55px; object-fit: cover; border-radius: 6px; background: #0a0f1c; }
.detail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
.detail img.big { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: #0a0f1c; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
pre.source { max-height: 420px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; margin: 0; }
.findings { margin: 0; padding-left: 18px; font-size: 13px; }
.findings li.error { color: var(--danger); }
.findings li.warning { color: var(--warning); }
.static-preview { width: 100%; height: 360px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.center-card { max-width: 420px; margin: 60px auto; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; }
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .choice-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: stretch; }
  .tab { flex: 1; }
  .nav-actions .user-chip { display: none; }
}
