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

:root {
  --bg:      #0b1017;
  --surface: #0f1620;
  --card:    #131c28;
  --border:  rgba(0,200,255,0.15);
  --cyan:    #00c8ff;
  --green:   #00e5a0;
  --red:     #ff4444;
  --gold:    #ffc844;
  --text:    #e8f4ff;
  --muted:   #6a8ba8;
  --font-hud: 'Orbitron', monospace;
  --font:    'Exo 2', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-weight: 300; min-height: 100vh; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─ */
.admin-wrap { display: flex; min-height: 100vh; }

.admin-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-logo {
  padding: 20px;
  font-family: var(--font-hud);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 3px;
  border-bottom: 1px solid var(--border);
  text-shadow: 0 0 15px var(--cyan);
}
.admin-logo small { display: block; font-size: 9px; color: var(--muted); letter-spacing: 1px; margin-top: 2px; font-weight: 400; }

.nav-section { padding: 12px 0; }
.nav-section-title {
  padding: 6px 16px;
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: 150ms;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(0,200,255,0.05);
  border-left-color: var(--cyan);
  text-decoration: none;
}

.admin-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ── Page header ─ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 2px;
}
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Buttons ─ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 3px;
  font-family: var(--font-hud);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 150ms;
  text-decoration: none;
}
.btn-primary   { background: var(--cyan); color: #060a0f; border-color: var(--cyan); }
.btn-primary:hover { background: #00e5ff; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-secondary:hover { color: var(--text); border-color: rgba(0,200,255,0.4); text-decoration: none; }
.btn-danger    { background: transparent; color: var(--red); border-color: rgba(255,68,68,0.4); }
.btn-danger:hover { background: rgba(255,68,68,0.1); text-decoration: none; }
.btn-success   { background: var(--green); color: #060a0f; }
.btn-sm { padding: 5px 10px; font-size: 10px; }

/* ── Table ─ */
.table-wrap { overflow-x: auto; border-radius: 4px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px;
  background: var(--card);
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,200,255,0.06);
  font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,200,255,0.03); }

/* ── Form ─ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: 150ms;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,200,255,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-select option { background: var(--card); }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Bilingual textarea pair */
.bilingual-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bilingual-pair .lang-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-hud);
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

/* Translate button */
.translate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 3px;
  color: var(--cyan);
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: 150ms;
}
.translate-btn:hover { background: rgba(0,200,255,0.08); }
.translate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Card ─ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Badges ─ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 600;
}
.badge-verified   { background: rgba(0,229,160,0.1); border: 1px solid var(--green); color: var(--green); }
.badge-unverified { background: rgba(255,68,68,0.1); border: 1px solid var(--red); color: var(--red); }
.badge-admin      { background: rgba(0,200,255,0.1); border: 1px solid var(--cyan); color: var(--cyan); }
.badge-editor     { background: rgba(255,200,68,0.1); border: 1px solid var(--gold); color: var(--gold); }

/* ── Alert ─ */
.alert { padding: 12px 16px; border-radius: 3px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: rgba(0,229,160,0.1); border: 1px solid var(--green); color: var(--green); }
.alert-error   { background: rgba(255,68,68,0.1); border: 1px solid var(--red); color: var(--red); }
.alert-info    { background: rgba(0,200,255,0.1); border: 1px solid var(--cyan); color: var(--cyan); }

/* ── Stats cards ─ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}
.stat-value { font-family: var(--font-hud); font-size: 24px; font-weight: 700; color: var(--cyan); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Pagination ─ */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; }
.page-link { padding: 5px 10px; border: 1px solid var(--border); border-radius: 3px; color: var(--muted); font-family: var(--font-hud); font-size: 10px; transition: 150ms; }
.page-link:hover, .page-link.active { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }

/* ── Toggle ─ */
.toggle-switch {
  position: relative; display: inline-block; width: 36px; height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  cursor: pointer;
  transition: 150ms;
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: 150ms;
}
input:checked + .toggle-slider { background: rgba(0,229,160,0.2); border-color: var(--green); }
input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--green); }

/* ── Spinner ─ */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,200,255,0.2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search in table ─ */
.table-search { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.table-search input { width: 260px; }

/* ── Confirm modal ─ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px;
  width: 360px;
  text-align: center;
}
.modal-title { font-family: var(--font-hud); font-size: 14px; margin-bottom: 12px; color: var(--red); }
.modal-text { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Format toolbar ──────────────────────────────────────────── */
.fmt-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 2px;
  margin-bottom: 0;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  border-bottom: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.fmt-toolbar::-webkit-scrollbar { height: 3px; }
.fmt-toolbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.fmt-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  line-height: 1.5;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.fmt-btn:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--card);
}
.fmt-btn.fmt-bold   { font-weight: 700; }
.fmt-btn.fmt-italic { font-style: italic; }
.fmt-btn.fmt-cyan   {
  color: var(--cyan);
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.5px;
}
.fmt-btn.fmt-cyan:hover {
  border-color: var(--cyan);
  background: rgba(0,200,255,0.08);
  color: var(--cyan);
}

/* fmt-toolbar connects visually to the textarea below it */
.fmt-toolbar + .form-textarea,
.fmt-toolbar + .fmt-preview-panel + .form-textarea,
.fmt-preview-panel + .form-textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top-color: transparent;
}

/* ── Button group ────────────────────────────────────────── */
.fmt-group {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

/* ── Toolbar separator ───────────────────────────────────── */
.fmt-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 3px;
  align-self: center;
  flex-shrink: 0;
}

/* ── Strikethrough ───────────────────────────────────────── */
.fmt-btn.fmt-strike s { text-decoration: line-through; }

/* ── Color picker ────────────────────────────────────────── */
.fmt-color-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.fmt-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 26px;
  height: 26px;
  justify-content: center;
  flex-shrink: 0;
}

.fmt-color-a {
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  color: var(--text);
}

.fmt-color-bar {
  width: 16px;
  height: 3px;
  border-radius: 1px;
  background: var(--cyan);
  transition: background 0.2s;
}

.fmt-color-popup {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: var(--card);
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 4px;
  padding: 10px;
  min-width: 210px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.fmt-color-popup.open { display: block; }

.fmt-cpop-title {
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.fmt-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.fmt-swatch {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.fmt-swatch:hover  { transform: scale(1.15); border-color: rgba(255,255,255,0.3); }
.fmt-swatch.active { border-color: #fff; box-shadow: 0 0 5px rgba(255,255,255,0.3); }

.fmt-color-hex-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.fmt-hex-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 6px;
  font-family: var(--font-hud);
  font-size: 11px;
  color: var(--text);
  outline: none;
}
.fmt-hex-input:focus { border-color: var(--cyan); }

.fmt-hex-apply {
  background: rgba(0,200,255,0.12);
  border: 1px solid rgba(0,200,255,0.35);
  border-radius: 3px;
  padding: 4px 10px;
  font-family: var(--font-hud);
  font-size: 10px;
  color: var(--cyan);
  cursor: pointer;
  transition: 150ms;
  white-space: nowrap;
}
.fmt-hex-apply:hover { background: var(--cyan); color: #060a0f; border-color: var(--cyan); }

/* ── Preview toggle button ───────────────────────────────── */
.fmt-btn.fmt-preview-toggle {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 3px 8px;
  width: auto;
}

/* ── Preview panel ───────────────────────────────────────── */
.fmt-preview-panel {
  display: none;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 3px 3px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  min-height: 40px;
  max-height: 300px;
  overflow-y: auto;
}
.fmt-preview-panel.open { display: block; }
.fmt-preview-panel strong { color: var(--text); font-weight: 600; }
.fmt-preview-panel em     { color: var(--muted); font-style: italic; }
.fmt-preview-panel del    { color: var(--muted); }

/* ── Preview panel: rich-text block styles (rt-*) ─────────── */
.fmt-preview-panel .rt-h1,
.fmt-preview-panel .rt-h2,
.fmt-preview-panel .rt-h3 {
  font-family: var(--font-hud);
  color: var(--cyan);
  letter-spacing: .06em;
  line-height: 1.3;
}
.fmt-preview-panel .rt-h1 { font-size: 1.1em;  margin: .7em 0 .2em; }
.fmt-preview-panel .rt-h2 { font-size: 1.0em;  margin: .6em 0 .15em; }
.fmt-preview-panel .rt-h3 { font-size:  .9em;  margin: .5em 0 .1em; }

.fmt-preview-panel .rt-hr {
  border: none;
  border-top: 1px solid rgba(0,200,255,.25);
  margin: .5em 0;
}

.fmt-preview-panel .rt-bq {
  border-left: 3px solid var(--cyan);
  margin: .3em 0;
  padding: .2em .7em;
  color: rgba(232,244,255,.6);
  font-style: italic;
}

.fmt-preview-panel .rt-ul,
.fmt-preview-panel .rt-ol {
  margin: .25em 0;
  padding-left: 1.3em;
}
.fmt-preview-panel .rt-ul li,
.fmt-preview-panel .rt-ol li { margin: .1em 0; }

.fmt-preview-panel .rt-pre {
  background: rgba(0,200,255,.06);
  border: 1px solid rgba(0,200,255,.18);
  border-radius: 4px;
  padding: .45em .75em;
  overflow-x: auto;
  font-size: .82em;
  margin: .3em 0;
}
.fmt-preview-panel .rt-pre code { font-family: 'Courier New', monospace; }

.fmt-preview-panel .rt-code {
  background: rgba(0,200,255,.1);
  color: var(--cyan);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: .88em;
  font-family: 'Courier New', monospace;
}

.fmt-preview-panel .rt-yt {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border: 1px solid rgba(0,200,255,.2);
  border-radius: 4px;
  margin: .4em 0;
}
.fmt-preview-panel .rt-yt iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

.fmt-preview-panel .rt-link {
  color: var(--cyan);
  text-decoration: underline;
}
.fmt-preview-panel .rt-p  { margin: 0 0 .2em; }
.fmt-preview-panel .rt-br { height: .4em; }
