/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0a12;
  --bg2: #0f0f1a;
  --surface: #151525;
  --surface2: #1c1c30;
  --border: #2a2a48;
  --primary: #8b5cf6;
  --primary-h: #7c3aed;
  --primary-glow: rgba(139,92,246,.35);
  --cyan: #06b6d4;
  --pink: #ec4899;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --r: 8px;
  --r2: 12px;
  --nav: 62px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --ease: .18s ease;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--text); }
img, video, audio { max-width: 100%; display: block; }
button, input, select, textarea {
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}

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

/* ── Navbar ────────────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav);
  background: rgba(10,10,18,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
}
.nav-logo {
  font-size: 20px; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap; flex-shrink: 0;
}
.nav-logo span { -webkit-text-fill-color: var(--text2); font-weight: 400; }
.nav-spacer { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r);
  color: var(--text2); font-size: 14px; font-weight: 500;
  transition: var(--ease);
}
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); }
.nav-link svg { width: 18px; height: 18px; }
.nav-upload {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: var(--r);
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
  transition: var(--ease); border: none; cursor: pointer;
}
.nav-upload:hover { background: var(--primary-h); color: #fff; }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer; flex-shrink: 0; text-decoration: none;
}

/* ── Main layout ───────────────────────────────────────────────────────── */
.main { padding-top: calc(var(--nav) + 24px); min-height: 100vh; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* ── Flash messages ────────────────────────────────────────────────────── */
.flash {
  position: fixed; top: calc(var(--nav) + 8px); right: 16px; z-index: 200;
  padding: 12px 20px; border-radius: var(--r2); font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: slideIn .25s ease, fadeOut .5s ease 3s forwards;
  max-width: 380px;
}
.flash.success { background: var(--success); color: #fff; }
.flash.error   { background: var(--danger); color: #fff; }
@keyframes slideIn { from { transform: translateX(110%); opacity:0; } to { transform:none; opacity:1; } }
@keyframes fadeOut { to { opacity:0; transform: translateY(-8px); } }

/* ── Filter tabs ───────────────────────────────────────────────────────── */
.filters {
  display: flex; gap: 8px; margin-bottom: 28px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 18px; border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: var(--ease); text-decoration: none;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Content grid ──────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 32px var(--primary-glow);
  color: var(--text);
}
.card-thumb {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--bg2) 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.card-thumb img { width:100%; height:100%; object-fit:cover; }
.card-thumb-icon { width: 52px; height: 52px; color: var(--primary); opacity:.7; }
.card-type-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; backdrop-filter: blur(8px);
}
.badge-photo  { background: rgba(16,185,129,.85); color:#fff; }
.badge-video  { background: rgba(239,68,68,.85);  color:#fff; }
.badge-audio  { background: rgba(139,92,246,.85); color:#fff; }
.card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.card-meta { font-size: 12px; color: var(--text2); display: flex; gap: 12px; flex-wrap: wrap; }
.card-ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(6,182,212,.15); color: var(--cyan);
  font-size: 11px; font-weight: 600; margin-top: auto;
}

/* ── Content page ──────────────────────────────────────────────────────── */
.content-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; }
@media (max-width: 900px) { .content-layout { grid-template-columns: 1fr; } }
.media-box {
  background: #000; border-radius: var(--r2); overflow: hidden;
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
}
.media-box img { max-height: 100%; max-width: 100%; object-fit: contain; }
.media-box video, .media-box audio { width: 100%; }
.media-audio-wrap {
  width: 100%; padding: 40px 24px;
  background: linear-gradient(135deg, var(--surface), var(--bg2));
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.audio-wave-icon { width: 80px; height: 80px; color: var(--primary); opacity:.8; }
.content-title { font-size: 22px; font-weight: 700; margin: 20px 0 8px; }
.content-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.content-meta-item { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.vote-row { display: flex; gap: 10px; margin-bottom: 20px; }
.vote-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-radius: 24px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--ease);
}
.vote-btn:hover { border-color: var(--primary); color: var(--text); }
.vote-btn.active-like  { background: var(--success); border-color: var(--success); color:#fff; }
.vote-btn.active-dislike { background: var(--danger); border-color: var(--danger); color:#fff; }
.vote-btn svg { width:20px; height:20px; }
.info-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 20px; margin-bottom: 16px;
}
.info-box h3 { font-size: 14px; color: var(--text2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .8px; }
.info-box p { font-size: 14px; line-height: 1.7; color: var(--text2); }
.ai-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  background: rgba(139,92,246,.15); border: 1px solid rgba(139,92,246,.35);
  color: var(--primary); font-size: 13px; font-weight: 600;
}

/* ── Creator chip ──────────────────────────────────────────────────────── */
.creator-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r2);
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 16px;
}
.creator-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.creator-name { font-weight: 600; font-size: 14px; }
.creator-un   { font-size: 12px; color: var(--text2); }

/* ── Comments ──────────────────────────────────────────────────────────── */
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; }
.section-title span { font-size: 13px; color: var(--text2); font-weight: 400; }
.comment-form { display: flex; gap: 10px; margin-bottom: 24px; }
.comment-input {
  flex: 1; padding: 10px 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); resize: none;
}
.comment-input:focus { border-color: var(--primary); }
.comment {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.comment-name  { font-size: 13px; font-weight: 600; }
.comment-date  { font-size: 11px; color: var(--text3); }
.comment-text  { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139,92,246,.12) 0%, transparent 70%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.auth-logo { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-sub { text-align: center; color: var(--text2); font-size: 14px; margin-bottom: 32px; }
.auth-card h1 { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 24px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 14px; border-radius: var(--r);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px;
  transition: border-color var(--ease);
}
.form-input:focus { border-color: var(--primary); background: var(--surface2); }
.form-input::placeholder { color: var(--text3); }
.form-textarea {
  width: 100%; padding: 10px 14px; border-radius: var(--r);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; resize: vertical; min-height: 100px;
  transition: border-color var(--ease);
}
.form-textarea:focus { border-color: var(--primary); background: var(--surface2); }
.form-textarea::placeholder { color: var(--text3); }
.form-select {
  width: 100%; padding: 10px 14px; border-radius: var(--r);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.form-select:focus { border-color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--ease); border: none;
}
.btn-primary {
  background: var(--primary); color: #fff; width: 100%;
  padding: 12px;
}
.btn-primary:hover { background: var(--primary-h); color: #fff; }
.btn-secondary {
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger  { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color:#fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text2); }
.auth-alt a { color: var(--primary); font-weight: 600; }

/* ── Upload ────────────────────────────────────────────────────────────── */
.upload-wrap { max-width: 700px; margin: 0 auto; }
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--r2);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
  margin-bottom: 24px;
}
.dropzone.drag-over, .dropzone:hover { border-color: var(--primary); background: rgba(139,92,246,.05); }
.dropzone-icon { width: 52px; height: 52px; color: var(--primary); margin: 0 auto 12px; }
.dropzone p { color: var(--text2); font-size: 14px; }
.dropzone strong { color: var(--text); }
.file-preview {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text2);
  margin-bottom: 20px;
}
.type-icons { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.type-icon-btn {
  flex: 1; min-width: 100px;
  padding: 14px 10px; border-radius: var(--r2);
  border: 2px solid var(--border); background: var(--surface);
  color: var(--text2); text-align: center; cursor: pointer;
  transition: var(--ease);
}
.type-icon-btn:hover, .type-icon-btn.selected {
  border-color: var(--primary); color: var(--primary); background: rgba(139,92,246,.08);
}
.type-icon-btn svg { width: 28px; height: 28px; margin: 0 auto 6px; }
.type-icon-btn span { display:block; font-size: 12px; font-weight: 600; }

/* ── Profile ───────────────────────────────────────────────────────────── */
.profile-header {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--border); border-radius: var(--r2);
  padding: 32px 28px; margin-bottom: 28px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: #fff;
  box-shadow: 0 0 0 4px rgba(139,92,246,.25);
}
.profile-info { flex: 1; }
.profile-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.profile-username { font-size: 15px; color: var(--text2); margin-bottom: 8px; }
.profile-bio { font-size: 14px; color: var(--text2); line-height: 1.6; }
.profile-stats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-val { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-lbl { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; }
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--ease);
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Settings form ─────────────────────────────────────────────────────── */
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 24px; max-width: 480px;
}
.settings-card h2 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 20px 24px;
}
.stat-card .stat-val { font-size: 28px; }
.stat-card .stat-lbl { margin-top: 4px; }
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden; margin-bottom: 24px;
}
.table-head { padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface2); padding: 12px 16px; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; }
td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
.role-badge {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}
.role-admin { background: rgba(139,92,246,.2); color: var(--primary); }
.role-user  { background: rgba(148,163,184,.1); color: var(--text2); }
.code-badge {
  font-family: monospace; font-size: 13px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--cyan);
}
.code-used { opacity: .45; }
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 32px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ── Share ─────────────────────────────────────────────────────────────── */
.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-top: 24px;
}
.share-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
}
.share-preview {
  aspect-ratio: 1; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.share-preview img { width:100%; height:100%; object-fit:cover; }
.share-preview svg { width:48px; height:48px; color: var(--primary); opacity:.6; }
.share-info { padding: 12px; }
.share-name { font-size: 13px; font-weight: 600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.share-meta { font-size: 11px; color: var(--text2); margin-top: 4px; }
.share-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Upload dropzone section ───────────────────────────────────────────── */
.section-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 24px; margin-bottom: 28px;
}
.section-box h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text2);
}
.empty svg { width: 64px; height: 64px; margin: 0 auto 16px; color: var(--border); }
.empty h3 { font-size: 18px; font-weight: 600; color: var(--text3); margin-bottom: 8px; }
.empty p  { font-size: 14px; }

/* ── Utility ───────────────────────────────────────────────────────────── */
.flex     { display: flex; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 11px; }
.text-muted { color: var(--text2); }
.text-dim   { color: var(--text3); }
.text-primary { color: var(--primary); }
.font-bold  { font-weight: 700; }
.truncate   { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.divider    { height: 1px; background: var(--border); margin: 20px 0; }
.w-full     { width: 100%; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-link span { display: none; }
  .nav-link { padding: 7px 8px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .share-grid { grid-template-columns: 1fr 1fr; }
}
