/* admin.css - shared admin UI styles, inspired by uiverse.io dark/glass elements */
:root {
  --bg-1: #0a0a0f;
  --bg-2: #11111a;
  --bg-3: #1a1a25;
  --fg: #e8e8f0;
  --fg-soft: rgba(232, 232, 240, 0.7);
  --fg-mute: rgba(232, 232, 240, 0.45);
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --danger: #ff4d6d;
  --ok: #2ecc71;
  --warn: #f5a623;
  --card-bg: rgba(20, 20, 28, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.1);
}

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

html, body {
  background: var(--bg-1);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Animated gradient background blobs */
body::before, body::after {
  content: ''; position: fixed; pointer-events: none; z-index: 0;
  width: 600px; height: 600px; border-radius: 50%;
  filter: blur(120px); opacity: 0.35;
  animation: blob 18s ease-in-out infinite alternate;
}
body::before {
  background: radial-gradient(circle, var(--accent), transparent 60%);
  top: -200px; left: -200px;
}
body::after {
  background: radial-gradient(circle, var(--accent-2), transparent 60%);
  bottom: -200px; right: -200px;
  animation-delay: -9s;
}
@keyframes blob {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(80px, 60px) scale(1.15); }
  100% { transform: translate(-60px, 40px) scale(0.95); }
}

main, .container { position: relative; z-index: 1; }

/* ─── Auth pages ─────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.auth-card h1 {
  font-size: 28px; font-weight: 600; margin-bottom: 6px;
  background: linear-gradient(135deg, #fff, #b9b6ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}
.auth-card .subtitle { color: var(--fg-mute); font-size: 14px; margin-bottom: 28px; }

/* Floating-label inputs (uiverse-inspired) */
.field { position: relative; margin-bottom: 18px; }
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 16px 14px 14px;
  color: var(--fg); font-size: 14.5px;
  outline: none;
  transition: border-color .25s, background .25s, box-shadow .25s;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 80px; padding-top: 14px; }
.field input::placeholder, .field textarea::placeholder { color: var(--fg-mute); }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12);
}
.field label.float {
  position: absolute; top: -8px; left: 12px;
  background: var(--bg-1); padding: 0 6px;
  font-size: 11px; color: var(--fg-mute);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.field .help { color: var(--fg-mute); font-size: 12px; margin-top: 6px; }

/* Buttons (glow on hover) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), #5a3eff);
  color: #fff;
  font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .25s ease, filter .2s;
  font-family: inherit;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -10px var(--accent), 0 0 30px -8px rgba(124, 92, 255, 0.6);
  filter: brightness(1.05);
}
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; padding: 14px; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--fg-soft);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.2); box-shadow: none; transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #c52844); }
.btn-danger:hover { box-shadow: 0 12px 30px -10px var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

.muted-link { color: var(--fg-soft); text-decoration: none; font-size: 14px; border-bottom: 1px dashed transparent; transition: color .2s, border-color .2s; }
.muted-link:hover { color: var(--accent-2); border-color: var(--accent-2); }

.alert {
  padding: 12px 14px; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 16px;
  border: 1px solid transparent;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: rgba(255, 77, 109, 0.1); border-color: rgba(255, 77, 109, 0.3); color: #ffb0bf; }
.alert-ok    { background: rgba(46, 204, 113, 0.1); border-color: rgba(46, 204, 113, 0.3); color: #b5f0cd; }

/* ─── Dashboard ──────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 36px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  background: linear-gradient(135deg, #fff, #b9b6ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar .user { display: flex; align-items: center; gap: 14px; }
.topbar .user .name { font-size: 14px; color: var(--fg-soft); }

.dashboard { padding: 36px; max-width: 1100px; margin: 0 auto; }
.dashboard h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.dashboard .hint { color: var(--fg-mute); font-size: 14px; margin-bottom: 24px; }

.sites-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.site-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px;
  transition: transform .3s, border-color .3s, box-shadow .3s;
  position: relative;
}
.site-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 20px 60px -20px rgba(124, 92, 255, 0.4);
}
.site-card .slug-line {
  display: flex; align-items: baseline; gap: 4px; margin-bottom: 6px;
  color: var(--fg-mute); font-size: 13px;
}
.site-card .slug-line b { color: var(--fg); font-size: 16px; font-weight: 600; }
.site-card .meta { color: var(--fg-mute); font-size: 12.5px; margin-bottom: 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.site-card .meta .pill { display: inline-flex; align-items: center; gap: 4px; }
.site-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty-state {
  border: 1.5px dashed var(--input-border);
  border-radius: 18px; padding: 60px 30px; text-align: center;
  color: var(--fg-mute);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

/* ─── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  width: 100%; max-width: 440px;
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 28px;
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal .sub { color: var(--fg-mute); font-size: 13px; margin-bottom: 20px; }
.modal .row { display: flex; gap: 10px; margin-top: 12px; }

/* ─── Editor ─────────────────────────────────────────────────────────── */
.editor-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: calc(100vh - 65px); }
.editor-form { padding: 30px 36px; overflow-y: auto; max-height: calc(100vh - 65px); }
.editor-preview { background: #000; position: sticky; top: 65px; height: calc(100vh - 65px); border-left: 1px solid var(--card-border); }
.editor-preview iframe { width: 100%; height: 100%; border: 0; display: block; }

.section {
  background: var(--card-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 22px; margin-bottom: 18px;
}
.section h3 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-soft); margin-bottom: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.section h3 .badge {
  font-size: 10px; padding: 2px 8px; border-radius: 99px;
  background: rgba(124, 92, 255, 0.18); color: #b9b6ff; letter-spacing: 0.05em;
}

.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .editor-preview { position: static; height: 60vh; border-left: 0; border-top: 1px solid var(--card-border); }
}

.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.icon-pick {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 12px; cursor: pointer;
  color: var(--fg-soft);
  transition: all .2s;
}
.icon-pick svg { width: 24px; height: 24px; }
.icon-pick:hover { color: #fff; border-color: var(--accent); background: rgba(124, 92, 255, 0.08); }
.icon-pick.active {
  color: #fff; border-color: var(--accent);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(0, 212, 255, 0.15));
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.social-row-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.social-row-edit select { width: 130px; flex-shrink: 0; }
.social-row-edit input { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--input-bg); border: 1px solid var(--input-border);
  color: var(--fg-soft); cursor: pointer; transition: all .2s;
}
.icon-btn:hover { color: #fff; border-color: var(--danger); background: rgba(255, 77, 109, 0.1); }

.bg-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.bg-preset {
  aspect-ratio: 16/10; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; background-size: cover; background-position: center;
  transition: all .2s;
}
.bg-preset:hover { border-color: var(--accent-2); transform: scale(1.04); }
.bg-preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25); }

.editor-toolbar {
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: -30px;
  background: linear-gradient(180deg, transparent, var(--bg-1) 30%);
  padding: 20px 0 10px; margin-top: 10px;
}

.url-preview {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 212, 255, 0.08); border: 1px solid rgba(0, 212, 255, 0.25);
  padding: 6px 12px; border-radius: 99px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12.5px; color: #9be8ff;
  margin-bottom: 12px;
}
.url-preview a { color: inherit; text-decoration: none; }
.url-preview a:hover { text-decoration: underline; }

/* Toggle switch (uiverse-inspired) */
.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 99px; transition: .3s;
}
.slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; top: 3px; background: var(--fg-soft);
  border-radius: 50%; transition: .3s;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), #5a3eff); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(22px); background: #fff; }

/* ─── Avatar uploader ─────────────────────────────────────── */
.avatar-field { padding-top: 4px; }
.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 4px;
}
.avatar-preview {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 2px dashed rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s, background .2s, transform .15s;
  position: relative;
}
.avatar-preview:hover { border-color: rgba(255,255,255,0.42); background: rgba(255,255,255,0.06); transform: scale(1.02); }
.avatar-preview.drag-over { border-color: #6cf; background: rgba(102,200,255,0.12); }
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  border-radius: 50%;
}
.avatar-placeholder {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  text-align: center;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.avatar-actions {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.avatar-actions .help { margin-top: 2px; }
.avatar-url-fallback {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.avatar-url-fallback summary {
  cursor: pointer;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  user-select: none;
  outline: none;
}
.avatar-url-fallback summary:hover { color: rgba(255,255,255,0.85); }
.avatar-url-fallback input[type="url"] { margin-top: 10px; }

/* ─── Size slider labels + 3-col grid ─────────────────────── */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } }
.slider-val {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: #9ad5ff;
  background: transparent;
}
input[type="checkbox"] {
  accent-color: #9ad5ff;
  width: 18px; height: 18px;
  cursor: pointer;
}
.field select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 12px 10px;
  border-radius: 10px;
  width: 100%;
  font-size: 14px;
}
.field select:focus {
  outline: none;
  border-color: rgba(154,213,255,0.55);
  background: rgba(255,255,255,0.06);
}
.section .help { font-size: 12px; color: rgba(255,255,255,0.55); }

/* ─── Tab row (icon/photo mode toggle in HEADER section) ── */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.03);
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
.tab-btn {
  flex: 1 1 0;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255,255,255,0.68);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
  white-space: nowrap;
}
.tab-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(154,213,255,0.18), rgba(90,62,255,0.22));
  border-color: rgba(154,213,255,0.35);
  color: #fff;
  box-shadow: 0 4px 16px rgba(90,62,255,0.18);
}
.tab-btn:active { transform: scale(0.98); }

/* ─── Subsection (used inside BASIC for username style + glow) ──── */
.subsection {
  margin-top: 18px;
  padding: 16px 16px 4px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}
.subhead {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.78);
  margin-bottom: 10px;
}
.badge-soft {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(154,213,255,0.10);
  color: rgba(154,213,255,0.85);
  border: 1px solid rgba(154,213,255,0.18);
  text-transform: uppercase;
}
