/* public/css/editor.css */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0d0f14;
  --bg2: #13161d;
  --bg3: #1a1d26;
  --border: #2a2d3a;
  --text: #e8eaf0;
  --text2: #8b91a8;
  --text3: #555b70;
  --accent: #7c6af7;
  --accent2: #5b4fd4;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --sidebar-w: 240px;
  --radius: 10px;
  --font: 'Sora', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── EDITOR LAYOUT ── */
.editor-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.ed-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform .3s;
}
.ed-sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}
.ed-sidebar-logo span { color: var(--accent); }
.ed-sidebar-logo small { font-size: 0.65rem; color: var(--text3); font-weight: 400; margin-left: auto; background: var(--bg3); padding: 0.1rem 0.4rem; border-radius: 4px; }
.ed-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.ed-nav-section { padding: 0.25rem 1.5rem; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); margin-top: 0.5rem; }
.ed-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.ed-nav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.ed-nav a.active { color: var(--accent); background: rgba(124,106,247,0.08); border-left-color: var(--accent); }
.ed-nav a .icon { font-size: 1rem; width: 20px; text-align: center; }
.ed-sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ed-sidebar-footer a { color: var(--red); font-size: 0.8rem; }

/* ── MAIN ── */
.ed-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ed-topbar {
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 40;
}
.ed-topbar h1 { font-size: 1rem; font-weight: 600; }
.ed-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.ed-content { padding: 2rem; flex: 1; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat-card .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); font-weight: 600; }
.stat-card .value { font-size: 2rem; font-weight: 700; }
.stat-card .sub { font-size: 0.75rem; color: var(--text3); }
.stat-accent { color: var(--accent); }
.stat-green { color: var(--green); }
.stat-amber { color: var(--amber); }

/* ── TABLE ── */
.ed-table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ed-table { width: 100%; border-collapse: collapse; }
.ed-table th { background: var(--bg3); padding: 0.75rem 1rem; text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); font-weight: 600; border-bottom: 1px solid var(--border); }
.ed-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: middle; }
.ed-table tr:last-child td { border-bottom: none; }
.ed-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── FORMS ── */
.ed-form { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: 0.5rem; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,106,247,0.1); }
.form-select option { background: var(--bg3); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-hint { font-size: 0.75rem; color: var(--text3); margin-top: 0.35rem; }

/* ── TOGGLE ── */
.form-check { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1.25rem; border-radius: 8px; font-family: var(--font); font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); color: white; }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); border-color: var(--text3); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* ── STATUS BADGES ── */
.badge-pub { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.25); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-draft { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.25); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-admin { background: rgba(124,106,247,0.15); color: var(--accent); border: 1px solid rgba(124,106,247,0.3); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-editor { background: var(--bg3); color: var(--text3); border: 1px solid var(--border); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }

/* ── ALERTS ── */
.alert { padding: 0.85rem 1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1.5rem; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }

/* ── WYSIWYG EDITOR ── */
#editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
#editor-toolbar button {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text2);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .15s;
  font-family: var(--font);
}
#editor-toolbar button:hover { background: var(--border); color: var(--text); }
#editor-toolbar .sep { width: 1px; background: var(--border); margin: 0 0.25rem; }
#editor-content {
  min-height: 400px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  padding: 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  outline: none;
}
#editor-content:focus { border-color: var(--accent); }
#editor-content h1, #editor-content h2, #editor-content h3 { margin: 1.5rem 0 0.75rem; }
#editor-content ul, #editor-content ol { margin-left: 1.5rem; }
#editor-content img { max-width: 100%; border-radius: 8px; }
#editor-content a { color: var(--accent); }
#editor-content code { font-family: 'JetBrains Mono', monospace; background: var(--bg); padding: 0.1em 0.4em; border-radius: 4px; color: #a89bf9; }
#editor-content blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text2); }
#editor-content table { border-collapse: collapse; width: 100%; }
#editor-content th, #editor-content td { border: 1px solid var(--border); padding: 0.5rem; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 0%, rgba(124,106,247,0.1) 0%, transparent 60%); }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 400px; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-card .sub { color: var(--text3); font-size: 0.85rem; margin-bottom: 2rem; }

/* ── MOBILE SIDEBAR ── */
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.25rem; cursor: pointer; }
@media (max-width: 900px) {
  .ed-sidebar { transform: translateX(-100%); }
  .ed-sidebar.open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5); }
  .ed-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── LOGO SIZES ── */
.sidebar-logo-img {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
}

@media (max-width: 900px) {
  .sidebar-logo-img {
    height: 28px;
  }
}

/* ── PRESET KRAFT ── */
.preset-kraft {
  background: #0a0700 !important;
  animation: kraft-border 2s linear infinite;
}
@keyframes kraft-border {
  0%   { box-shadow: 0 0 6px rgba(249,115,22,0.5), inset 0 0 6px rgba(220,38,38,0.15); }
  50%  { box-shadow: 0 0 12px rgba(249,115,22,0.8), inset 0 0 10px rgba(125,211,252,0.1); }
  100% { box-shadow: 0 0 6px rgba(249,115,22,0.5), inset 0 0 6px rgba(220,38,38,0.15); }
}

/* ── RANGE SLIDERS ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  transition: background .2s;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(124,106,247,0.2);
  transition: box-shadow .2s, transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 5px rgba(124,106,247,0.3);
  transform: scale(1.1);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 3px rgba(124,106,247,0.2);
}

/* Size option radio labels */
.size-option-label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(124,106,247,0.1);
  color: var(--accent);
}
