/* ============================================================
   DPM VIDS – Admin Stylesheet
   ============================================================ */

:root {
  --ink: #16130f;
  --ink-2: #1d1811;
  --card: #221c14;
  --card-2: #2a2318;
  --line: #392f22;
  --cream: #f5efe3;
  --cream-dim: #d8cebb;
  --muted: #a89b85;
  --orange: #f5920b;
  --amber: #fdb827;
  --orange-ink: #1a1204;
  --danger: #e5654b;
  --green: #5bbf7a;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
body { font-family: var(--body); background: var(--ink); color: var(--cream); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in oklab, var(--orange) 14%, transparent), transparent 60%), var(--ink); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 2.5rem 2rem; text-align: center; }
.login-card img { border-radius: 50%; margin: 0 auto 1.2rem; }
.login-card h1 { font-family: var(--display); font-size: 1.6rem; }
.login-sub { color: var(--muted); font-size: .92rem; margin: .4rem 0 1.5rem; }
.login-back { display: inline-block; margin-top: 1.4rem; color: var(--muted); font-size: .88rem; }
.login-back:hover { color: var(--orange); }

.stack { display: grid; gap: 1rem; text-align: left; }
.stack label { display: grid; gap: .4rem; font-size: .85rem; font-weight: 600; color: var(--cream-dim); }

/* ---------- Inputs ---------- */
input[type=text], input[type=password], input[type=email], input[type=url], input[type=file], select, textarea {
  width: 100%; font-family: var(--body); font-size: .95rem; color: var(--cream);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px color-mix(in oklab, var(--orange) 22%, transparent); outline: none; }
textarea { resize: vertical; line-height: 1.6; }
.mono-area { font-family: var(--mono); font-size: .88rem; line-height: 1.7; }
.input-lg { font-size: 1.15rem; font-weight: 600; font-family: var(--display); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a89b85' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--body); font-weight: 600; font-size: .95rem; padding: .65rem 1.3rem; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: var(--orange-ink); }
.btn-primary:hover { background: var(--amber); }
.btn-secondary { background: var(--card-2); color: var(--cream); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--orange); }
.btn-ghost { border-color: var(--line); color: var(--cream-dim); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: 10px; font-size: .9rem; font-weight: 500; margin-bottom: 1.2rem; }
.alert-error { background: color-mix(in oklab, var(--danger) 16%, transparent); border: 1px solid color-mix(in oklab, var(--danger) 40%, transparent); color: #ffd7cd; }
.alert-success { background: color-mix(in oklab, var(--green) 16%, transparent); border: 1px solid color-mix(in oklab, var(--green) 40%, transparent); color: #d4f5df; }

/* ---------- Shell / Layout ---------- */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--ink-2); border-right: 1px solid var(--line); padding: 1.5rem 1.1rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.15rem; padding: .3rem .4rem 1.2rem; }
.admin-brand img { border-radius: 50%; }
.admin-nav { display: flex; flex-direction: column; gap: .2rem; }
.admin-nav a { padding: .65rem .8rem; border-radius: 9px; color: var(--cream-dim); font-weight: 500; font-size: .95rem; transition: background .15s, color .15s; }
.admin-nav a:hover { background: var(--card); color: var(--cream); }
.admin-nav a.is-active { background: color-mix(in oklab, var(--orange) 16%, transparent); color: var(--orange); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 .35rem; margin-left: .3rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-family: var(--mono); font-size: .72rem; font-weight: 700;
  vertical-align: middle;
}
.admin-side-foot { margin-top: auto; display: grid; gap: .6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.admin-view-site { font-size: .85rem; color: var(--muted); padding: .3rem .4rem; }
.admin-view-site:hover { color: var(--orange); }
.admin-logout { width: 100%; text-align: left; background: none; border: 0; color: var(--muted); font-family: var(--body); font-size: .85rem; cursor: pointer; padding: .3rem .4rem; }
.admin-logout:hover { color: var(--danger); }

.admin-main { min-width: 0; }
.admin-topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1.2rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-topbar h1 { font-family: var(--display); font-size: 1.5rem; }
.admin-user { color: var(--muted); font-size: .85rem; font-family: var(--mono); }
.admin-user strong { color: var(--cream-dim); }
.admin-content { padding: clamp(1.3rem, 3vw, 2.5rem); max-width: 1100px; }

/* ---------- Dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.6rem; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.stat-num { display: block; font-family: var(--display); font-weight: 700; font-size: 2.4rem; color: var(--orange); line-height: 1; }
.stat-label { color: var(--muted); font-size: .85rem; font-family: var(--mono); }
.stat-card-link { display: block; text-decoration: none; transition: border-color .15s, transform .15s; }
.stat-card-link:hover { border-color: var(--orange); transform: translateY(-2px); }
.stat-card-alert { border-color: var(--danger); background: color-mix(in oklab, var(--danger) 10%, var(--card)); }
.stat-card-alert .stat-num { color: var(--danger); }
.quick-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 2rem; }
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { font-family: var(--display); font-size: 1.15rem; }
.panel-head a { color: var(--orange); font-size: .85rem; font-weight: 600; }
.mini-list { list-style: none; display: grid; gap: .2rem; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { font-weight: 500; }
.mini-list a:hover { color: var(--orange); }
.muted { color: var(--muted); }

/* ---------- Statistik ---------- */
.stat-row-4 { grid-template-columns: repeat(4, 1fr); }
.stat-row-2 { grid-template-columns: repeat(2, 1fr); }
.stat-row-4 .stat-num, .stat-row-2 .stat-num { font-size: 1.9rem; }
.stat-hint { margin-top: 1.4rem; }

/* ---------- Badges ---------- */
.badge { font-family: var(--mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 600; padding: .18rem .5rem; border-radius: 999px; white-space: nowrap; }
.badge-published { background: color-mix(in oklab, var(--green) 18%, transparent); color: #a6e6ba; border: 1px solid color-mix(in oklab, var(--green) 35%, transparent); }
.badge-draft { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.badge-featured { background: color-mix(in oklab, var(--amber) 16%, transparent); color: var(--amber); border: 1px solid color-mix(in oklab, var(--amber) 35%, transparent); }

/* ---------- Tabellen ---------- */
.list-head { display: flex; justify-content: flex-end; margin-bottom: 1.2rem; }
.data-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.data-table th { text-align: left; font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: var(--ink-2); }
.data-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: color-mix(in oklab, var(--orange) 5%, transparent); }
.row-title { font-weight: 600; }
.row-title:hover { color: var(--orange); }
.mono { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.thumb-mini { border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }
.row-actions { display: flex; align-items: center; gap: .9rem; font-size: .85rem; white-space: nowrap; }
.row-actions a:hover { color: var(--orange); }
.inline-form { display: inline; }
.link-danger { background: none; border: 0; color: var(--muted); font-family: var(--body); font-size: .85rem; cursor: pointer; padding: 0; }
.link-danger:hover { color: var(--danger); }

.empty-panel { text-align: center; padding: 3.5rem 1.5rem; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); display: grid; gap: 1.2rem; justify-items: center; color: var(--muted); }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 320px; gap: 1.6rem; align-items: start; }
.editor-main { display: grid; gap: 1.3rem; }
.editor-side { display: grid; gap: 1.2rem; position: sticky; top: 1.5rem; }
.field { display: grid; gap: .45rem; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--cream-dim); text-transform: uppercase; letter-spacing: .04em; font-family: var(--mono); }
.field-label em { font-style: normal; color: var(--muted); text-transform: none; font-weight: 400; letter-spacing: 0; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; }
.toggle-preview { background: var(--card-2); border: 1px solid var(--line); color: var(--cream-dim); font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: .3rem .7rem; border-radius: 999px; cursor: pointer; }
.toggle-preview:hover, .toggle-preview.is-active { border-color: var(--orange); color: var(--orange); }

/* Formatierungs-Toolbar im Blog-Editor */
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .5rem .6rem; margin-bottom: .6rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; }
.tb-btn { background: var(--card-2); border: 1px solid var(--line); color: var(--cream-dim); font-family: var(--body); font-size: .82rem; font-weight: 600; padding: .35rem .65rem; border-radius: 7px; cursor: pointer; line-height: 1; transition: border-color .15s, color .15s; }
.tb-btn:hover { border-color: var(--orange); color: var(--orange); }
.tb-btn:disabled { opacity: .5; cursor: wait; }
.tb-sep { width: 1px; height: 1.3rem; background: var(--line); margin: 0 .2rem; }
.tb-status { color: var(--muted); font-size: .78rem; font-family: var(--mono); }
.tb-select {
  background: var(--card-2); border: 1px solid var(--line); color: var(--cream-dim);
  font-family: var(--body); font-size: .8rem; padding: .3rem .5rem; border-radius: 7px; cursor: pointer;
}
.tb-select:hover { border-color: var(--orange); }
.tb-color { width: 30px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--card-2); cursor: pointer; }
.hint { color: var(--muted); font-size: .8rem; }
.hint code { font-family: var(--mono); background: var(--card-2); padding: .1em .35em; border-radius: 4px; border: 1px solid var(--line); }
.side-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; display: grid; gap: 1rem; }
.side-panel h3 { font-family: var(--display); font-size: 1.05rem; }
.side-actions { display: grid; gap: .6rem; margin-top: .3rem; }
.checkbox { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--cream-dim); cursor: pointer; }
.checkbox input { width: auto; }
.cover-preview { border-radius: 8px; border: 1px solid var(--line); }

/* Markdown-Vorschau im Editor */
.md-preview { background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem 1.4rem; min-height: 200px; }
.md-preview h1, .md-preview h2, .md-preview h3 { font-family: var(--display); color: var(--cream); margin: 1.2rem 0 .5rem; }
.md-preview a { color: var(--orange); }
.md-preview code { font-family: var(--mono); background: var(--card-2); padding: .1em .35em; border-radius: 4px; }
.md-preview img { border-radius: 8px; border: 1px solid var(--line); margin: 1rem 0; }

/* Video-Embed-Vorschau */
.video-embed { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Einstellungen ---------- */
.settings-form { display: grid; gap: 1.4rem; max-width: 760px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-actions { position: sticky; bottom: 0; padding: 1rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .admin-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .5rem; }
  .admin-brand { padding: .3rem .4rem; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-foot { margin: 0 0 0 auto; flex-direction: row; border: 0; padding: 0; align-items: center; }
  .stat-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .row-actions { flex-direction: column; align-items: flex-start; gap: .4rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
