/* Admin + editor styling - bouwt voort op style.css */

.admin-shell { min-height: 100vh; padding-top: 68px; }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: min(420px, 100%); padding: 38px; }
.login-card .brand { justify-content: center; margin-bottom: 8px; }
.login-card h2 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-dim); margin-bottom: 26px; font-size: .95rem; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 7px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; background: rgba(10,14,24,.7);
  border: 1px solid var(--border); color: var(--text); font-family: var(--font); font-size: .96rem;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.15);
}
.field .hint { font-size: .78rem; color: var(--text-faint); margin-top: 6px; }
.form-error { color: #fb7185; font-size: .88rem; margin-bottom: 14px; min-height: 1.2em; }

/* ── Dashboard ──────────────────────────────────────────── */
.admin-bar {
  position: sticky; top: 68px; z-index: 40;
  background: rgba(5,7,13,.8); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.admin-bar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 14px; flex-wrap: wrap; }
.admin-bar h1 { font-size: 1.15rem; }
.admin-bar .who { color: var(--text-faint); font-size: .85rem; font-family: var(--mono); }

.dash { padding: 30px 0 80px; }
.post-list { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.post-row {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .2s;
}
.post-row:hover { border-color: var(--border-strong); }
.post-row .thumb { width: 64px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--grad-soft); flex-shrink: 0; display: grid; place-items: center; font-family: var(--mono); color: var(--text-faint); }
.post-row .info { flex: 1; min-width: 0; }
.post-row .info h4 { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row .info .meta { font-size: .78rem; color: var(--text-faint); font-family: var(--mono); }
.status-pill { font-size: .72rem; font-family: var(--mono); padding: 3px 10px; border-radius: 999px; }
.status-pill.pub { color: var(--green); background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); }
.status-pill.draft { color: #fbbf24; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); }
.row-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
  background: rgba(122,162,255,.05); color: var(--text-dim); display: grid; place-items: center; cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn.danger:hover { color: #fb7185; border-color: rgba(251,113,133,.5); background: rgba(251,113,133,.08); }

/* ── Editor ─────────────────────────────────────────────── */
.editor-shell { padding: 24px 0 100px; }
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.editor-main { min-width: 0; }
.editor-side { position: sticky; top: 140px; display: flex; flex-direction: column; gap: 16px; }

.title-input {
  width: 100%; background: none; border: 0; color: var(--text);
  font-size: 2rem; font-weight: 800; letter-spacing: -.02em; padding: 8px 0; font-family: var(--font);
}
.title-input:focus { outline: none; }
.title-input::placeholder { color: var(--text-faint); }
.subtitle-input {
  width: 100%; background: none; border: 0; color: var(--text-dim);
  font-size: 1.1rem; padding: 4px 0 16px; font-family: var(--font); border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.subtitle-input:focus { outline: none; }

/* Toolbar */
.toolbar {
  position: sticky; top: 128px; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px;
  background: rgba(13,18,32,.95); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px;
}
.toolbar .grp { display: flex; gap: 2px; }
.toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.tb-btn {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; border: 0;
  background: none; color: var(--text-dim); cursor: pointer; font-size: .9rem; font-weight: 600;
  display: grid; place-items: center; transition: all .15s; font-family: var(--font);
}
.tb-btn:hover { background: rgba(122,162,255,.12); color: var(--text); }
.tb-btn.active { background: var(--grad); color: #04101a; }
.tb-btn svg { width: 17px; height: 17px; }

.editor-area {
  min-height: 420px; padding: 6px 2px; font-size: 1.08rem; color: #d7deee; line-height: 1.75;
}
.editor-area:focus { outline: none; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.editor-area h2 { font-size: 1.7rem; color: #fff; margin: 1em 0 .4em; }
.editor-area h3 { font-size: 1.35rem; color: #fff; margin: 1em 0 .4em; }
.editor-area p { margin: .7em 0; }
.editor-area a { color: var(--cyan); text-decoration: underline; }
.editor-area blockquote { border-left: 3px solid var(--cyan); padding-left: 18px; color: var(--text-dim); font-style: italic; margin: 1em 0; }
.editor-area pre { background: #0a0e18; border: 1px solid var(--border); border-radius: 10px; padding: 16px; font-family: var(--mono); font-size: .9rem; overflow-x: auto; }
.editor-area code { font-family: var(--mono); background: rgba(122,162,255,.1); padding: 2px 5px; border-radius: 5px; }
.editor-area ul, .editor-area ol { padding-left: 1.5em; margin: .7em 0; }
.editor-area img { border-radius: 10px; border: 1px solid var(--border); margin: 8px 0; }
.editor-area img.selected { outline: 3px solid var(--cyan); outline-offset: 2px; }
.editor-area [data-align="center"] { display: block; margin-inline: auto; }
.editor-area [data-align="left"] { float: left; margin: 6px 18px 10px 0; }
.editor-area [data-align="right"] { float: right; margin: 6px 0 10px 18px; }

/* Image floating toolbar */
.img-tools {
  position: absolute; z-index: 60; display: none; gap: 4px; padding: 6px;
  background: rgba(13,18,32,.98); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); flex-wrap: wrap; max-width: 300px;
}
.img-tools.show { display: flex; }
.img-tools .tb-btn { height: 30px; min-width: 30px; font-size: .78rem; }
.img-tools input { width: 130px; padding: 4px 8px; border-radius: 6px; background: rgba(10,14,24,.7); border: 1px solid var(--border); color: var(--text); font-size: .8rem; }

.card-side h3 { font-size: 1rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.cover-preview { width: 100%; aspect-ratio: 16/9; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); margin-bottom: 12px; background: var(--grad-soft); }
.tag-input-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { display: none; }
.toggle .track { width: 46px; height: 26px; border-radius: 999px; background: rgba(122,162,255,.15); position: relative; transition: background .2s; flex-shrink: 0; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-dim); transition: transform .2s, background .2s; }
.toggle input:checked + .track { background: var(--grad); }
.toggle input:checked + .track::after { transform: translateX(20px); background: #04101a; }

.editor-actions { display: flex; gap: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 14px 22px; z-index: 300; box-shadow: var(--shadow); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  font-size: .92rem; display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(251,113,133,.4); }

.hidden { display: none !important; }

@media (max-width: 860px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .toolbar { top: 68px; }
}
@media (max-width: 620px) {
  .admin-bar-inner { height: auto; padding: 10px 0; }
  .admin-bar .who { display: none; }
  .admin-bar-inner > div { gap: 8px !important; }
  .admin-bar .btn { padding: 8px 12px !important; font-size: .85rem; }
  .admin-bar h1 { font-size: 1rem; }
  .title-input { font-size: 1.5rem; }
  .post-row { flex-wrap: wrap; }
  .post-row .info { flex-basis: 60%; }
  .toolbar { position: static; }
  .img-tools { max-width: 240px; }
}
