/* =====================================================================
   Die Neue Schülerzeitung – gemeinsames Design für admin / survey-admin / umfrage
   (Farben & Schrift wie auf der Hauptseite)
   ===================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --fg: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --digbiz: #5689c8;
  --youngbiz: #c75389;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #273449;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --ok: #4ade80;
    --ok-bg: #14532d;
    --warn: #facc15;
    --warn-bg: #422006;
    --danger: #f87171;
    --danger-bg: #450a0a;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/inter-latin-var.woff2) format("woff2");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-bottom: 4rem; }

h1, h2, h3, h4 { font-weight: 800; line-height: 1.2; letter-spacing: -0.025em; }
h1 { font-size: 2.1rem; margin: 2rem 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }

a { color: var(--digbiz); text-decoration: none; transition: color .2s; }
a:hover { color: var(--youngbiz); }
img { max-width: 100%; display: block; }
code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: .9em; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 2000; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg), transparent 15%);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.05rem; color: var(--fg); }
.brand:hover { color: var(--fg); }
.brand small { display: block; font-weight: 600; font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.main_logo { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.nav { display: flex; gap: 1.25rem; }
.nav a { color: var(--muted); font-weight: 600; font-size: 0.92rem; padding: .4rem 0; position: relative; }
.nav a:hover, .nav a.active { color: var(--fg); }
.nav a.active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--youngbiz); border-radius: 2px; }

.user-chip { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--digbiz), var(--youngbiz));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
}
.user-chip .who { line-height: 1.2; text-align: right; }
.user-chip .who span { display: block; color: var(--muted); font-size: .75rem; }

/* ---------- Buttons & Formulare ---------- */
.btn, .btn_d, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: 0.6rem 1.2rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer; font-family: inherit; text-decoration: none;
  transition: transform .1s, opacity .2s, background .2s;
}
.btn { background: var(--youngbiz); color: #fff !important; }
.btn_d { background: var(--digbiz); color: #fff !important; }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn:hover, .btn_d:hover, .btn-danger:hover { opacity: .9; transform: translateY(-1px); }
.btn:active, .btn_d:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.8rem; font-size: 1.02rem; border-radius: 10px; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border); }

label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--surface); color: var(--fg);
  border: 1px solid var(--border); padding: .6rem .85rem; border-radius: 8px;
  font-family: inherit; font-size: .95rem;
}
textarea { resize: vertical; min-height: 90px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--digbiz); outline-offset: 2px;
}
.field { margin-bottom: 1.1rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--digbiz); }

/* ---------- Karten & Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem;
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card h3 { margin: 0; font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .card-foot { margin-top: auto; padding-top: .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

.hero {
  padding: 3rem 0 1.5rem; text-align: center;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--digbiz), transparent 88%), transparent 70%);
}
.hero .pill {
  display: inline-block; background: linear-gradient(135deg, var(--digbiz), var(--youngbiz)); color: #fff;
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 16px; border-radius: 20px; margin-bottom: 1rem;
}
.hero h1 {
  margin-top: 0;
  background: linear-gradient(135deg, var(--digbiz), var(--youngbiz));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-size: 2.6rem;
}
.hero p { color: var(--muted); max-width: 580px; margin: 0 auto; font-size: 1.08rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 999px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.badge::before { content: '●'; font-size: .6rem; }
.badge-open { background: var(--ok-bg); color: var(--ok); }
.badge-scheduled { background: var(--warn-bg); color: var(--warn); }
.badge-draft { background: var(--surface-2); color: var(--muted); }
.badge-closed { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: color-mix(in srgb, var(--youngbiz), transparent 85%); color: var(--youngbiz); }
.badge-redaktion { background: color-mix(in srgb, var(--digbiz), transparent 85%); color: var(--digbiz); }
.badge-done { background: var(--ok-bg); color: var(--ok); }
.badge-done::before { content: '✓'; font-size: .7rem; }

/* ---------- Hinweise ---------- */
.notice { border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; border-left: 4px solid var(--digbiz); background: var(--surface); font-size: .93rem; }
.notice strong { display: block; margin-bottom: .2rem; }
.notice-warn { border-color: var(--warn); background: var(--warn-bg); }
.notice-error { border-color: var(--danger); background: var(--danger-bg); }
.notice-ok { border-color: var(--ok); background: var(--ok-bg); }

/* ---------- Login-Gate ---------- */
.gate { max-width: 440px; margin: 4rem auto; text-align: center; }
.gate .panel { padding: 2.25rem 2rem; }
.gate img { width: 72px; height: 72px; border-radius: 16px; margin: 0 auto 1rem; }
.gate h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
.gate .btns { display: grid; gap: .6rem; margin-top: 1.5rem; }
.ms-logo { width: 18px; height: 18px; display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ms-logo i { display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .25rem; }
.stat .sub { font-size: .8rem; color: var(--muted); }

/* ---------- Balken (Auswertung) ---------- */
.result-q { padding: 1.25rem 0; border-top: 1px solid var(--border); }
.result-q:first-child { border-top: none; padding-top: 0; }
.result-q h3 { display: flex; gap: .6rem; align-items: baseline; }
.q-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--digbiz), var(--youngbiz)); color: #fff; font-size: .78rem; font-weight: 800;
}
.bars { display: grid; gap: .45rem; margin-top: .75rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr minmax(84px, auto); align-items: center; gap: .75rem; font-size: .9rem; padding: .15rem .25rem; border-radius: 6px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { overflow-wrap: anywhere; }
.bar-track { height: 14px; background: transparent; border-radius: 0 4px 4px 0; position: relative; border-left: 1px solid var(--border); }
.bar-fill { display: block; height: 100%; background: var(--digbiz); border-radius: 0 4px 4px 0; min-width: 0; transition: width .5s ease; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-answers { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .5rem; max-height: 420px; overflow-y: auto; }
.text-answers li { background: var(--surface-2); border-radius: 8px; padding: .6rem .85rem; font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Toasts & Dialog ---------- */
#toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; display: grid; gap: .5rem; z-index: 3000; }
.toast { background: var(--fg); color: var(--bg); padding: .75rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 600; max-width: 360px; transition: opacity .4s, transform .4s; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--ok); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
.dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg); padding: 1.5rem; max-width: 420px; box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgb(15 23 42 / .5); }
.dialog p { margin: 0 0 1.25rem; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }

.loading { padding: 3rem 0; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--digbiz); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto .75rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.5rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; font-size: .85rem; color: var(--muted); }
.site-footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--youngbiz); }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 720px) {
  .nav { display: none; }
  .user-chip .who { display: none; }
  .hero h1 { font-size: 2rem; }
  h1 { font-size: 1.7rem; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .panel { padding: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
