/* 4digEt basic — Admin-Design */

:root {
    --accent: #2563eb;
    --fg: #1f2430;
    --muted: #6b7280;
    --bg: #f4f5f7;
    --panel: #ffffff;
    --line: #e5e7eb;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--accent); }

/* ---------------- Auth (Login / Setup) ---------------- */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
}
.auth-card h1 { font-size: 1.3rem; margin: 8px 0 4px; }
.logo { font-weight: 800; font-size: 1.3rem; }
.logo span { color: var(--accent); }
.logo.center { text-align: center; margin-bottom: 8px; }

/* ---------------- Grundlayout ---------------- */

.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    flex-shrink: 0;
}
.sidebar .logo { color: #fff; margin-bottom: 24px; padding: 0 8px; }
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar .nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
}
.sidebar .nav a:hover { background: #1f2937; color: #fff; }
.sidebar .nav a.active { background: var(--accent); color: #fff; }
.sidebar .logout {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-top: 1px solid #1f2937;
    margin-top: 12px;
}
.sidebar .logout:hover { color: #fff; }

.content { flex: 1; padding: 28px 32px; max-width: 1000px; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-head h1 { font-size: 1.5rem; margin: 0; }

/* ---------------- Panels / Cards ---------------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.panel h2 { font-size: 1.05rem; margin: 0 0 14px; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--fg);
    transition: border-color .15s;
}
.card:hover { border-color: var(--accent); }
.card-num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.card-label { color: var(--muted); font-size: 0.9rem; }
.quick h2 { font-size: 1.05rem; }

/* ---------------- Formulare ---------------- */

label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: #374151; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; }

input[type=text],
input[type=password],
input[type=color],
input[type=file],
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--fg);
    background: #fff;
    font-weight: 400;
}
input[type=color] { height: 42px; padding: 4px; }
textarea { resize: vertical; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.9rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.grid3.end, .grid3.grid2 { align-items: end; }
.grid3.end label, .grid3.end button { margin-bottom: 14px; }

@media (max-width: 720px) {
    .grid2, .grid3 { grid-template-columns: 1fr; }
    .sidebar { width: 170px; }
}

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--accent);
    line-height: 1.2;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #fff; color: var(--accent); }
.btn.block { width: 100%; margin-top: 8px; }
.btn:hover { opacity: .9; }

.link {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0 6px;
    text-decoration: underline;
}
.link.danger { color: var(--danger); }
.inline { display: inline; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------------- Tabelle ---------------- */

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: #f9fafb; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 5px; font-size: 0.88rem; }

.badge { font-size: 0.78rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #f3f4f6; color: #6b7280; }

/* ---------------- Block-Editor ---------------- */

.blockcard { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fcfcfd; }
.blockcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.blocktype { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.blockmove button {
    border: 1px solid var(--line);
    background: #fff;
    width: 30px; height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.blockmove button.danger { color: var(--danger); border-color: #fca5a5; }
.blockmove button:disabled { opacity: .3; cursor: default; }

.addrow { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.addrow select { width: auto; margin-top: 0; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 4px 0 0; }
.row-actions { margin-bottom: 14px; }

/*
 * Die Speicherleiste bleibt beim Scrollen stehen. Ohne eigenen Hintergrund
 * und ohne Abstand nach oben schob sie sich transparent ueber das jeweils
 * darunterliegende Feld — im Seiten-Editor verdeckte sie die Beschriftung
 * des Bildlink-Feldes.
 */
.save-bar {
    position: sticky;
    bottom: 0;
    padding: 14px 0;
    margin-top: 12px;
    background: var(--bg, #fff);
    box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, .18);
}

/* ---------------- Weiterleitungen ---------------- */

.redirect-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.shortlink { font-size: 0.95rem; }
.stat { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 36px; }
.spark-bar { width: 6px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; }

/* ---------------- Bilder ---------------- */

.upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload input[type=file] { width: auto; margin-top: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.thumb { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; background: #fff; }
.thumb img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.thumb figcaption { font-size: 0.78rem; color: var(--muted); margin: 6px 0; word-break: break-all; }

/* ---------------- Flash ---------------- */

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.muted { color: var(--muted); }
.center { text-align: center; }
