/* ============================================================
   Sportschützen Seengen – Admin / Vereinsverwaltung
   ============================================================ */

:root {
  --navy: #0050b4;
  --navy-2: #004097;
  --steel-line: #2f63b4;
  --paper: #eef3fb;
  --card: #ffffff;
  --ink: #12161d;
  --muted: #63708a;
  --brass: #0072ff;
  --red: #e23a2e;   /* nur für Löschen/Warnungen */
  --green: #1f8a5b;
  --line: #dfe7f2;

  --font-display: "Barlow Condensed", sans-serif;
  --font-body: "Roboto", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); background: var(--paper); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: 0.01em; }
a { color: var(--navy); }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(120% 100% at 50% 0%, var(--navy-2), var(--navy)); padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 10px; padding: 40px 34px; box-shadow: 0 30px 70px -30px rgba(0,0,0,0.6); text-align: center; }
.login-mark svg { width: 64px; height: 64px; color: var(--navy); }
.login-card h1 { font-size: 1.9rem; text-transform: uppercase; margin-top: 14px; }
.login-sub { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass); margin: 4px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; margin-top: 10px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.login-form input { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 1rem; font-family: var(--font-body); }
.login-form input:focus { outline: none; border-color: var(--navy); }
.login-form .btn { margin-top: 6px; justify-content: center; }
.login-back { display: inline-block; margin-top: 20px; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.login-back:hover { color: var(--navy); }

/* ---------- Shell ---------- */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-side { background: var(--navy); color: rgba(255,255,255,0.8); display: flex; flex-direction: column; padding: 24px 18px; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; text-transform: uppercase; line-height: 1.05; padding: 0 8px 20px; border-bottom: 1px solid var(--steel-line); }
.admin-brand svg { width: 36px; height: 36px; color: var(--brass); flex: none; }
.admin-logo { height: 44px; width: auto; flex: none; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.35)); }
.admin-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; }
.admin-nav a { text-decoration: none; color: rgba(255,255,255,0.72); font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; letter-spacing: 0.03em; text-transform: uppercase; padding: 11px 14px; border-radius: var(--radius); transition: background 0.2s, color 0.2s; }
.admin-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.admin-nav a.is-active { background: #ffffff; color: var(--navy); }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 20px; border-top: 1px solid var(--steel-line); font-size: 0.9rem; }
.admin-side-foot a { color: var(--brass); text-decoration: none; }
.link-btn { background: none; border: 0; color: rgba(255,255,255,0.7); cursor: pointer; font: inherit; padding: 0; text-align: left; }
.link-btn:hover { color: #fff; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 34px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.admin-topbar h1 { font-size: 1.7rem; text-transform: uppercase; }
.admin-user { font-size: 0.85rem; color: var(--muted); }
.admin-content { padding: 30px 34px 60px; max-width: 1000px; }

/* ---------- Flash ---------- */
.flash { padding: 13px 18px; border-radius: var(--radius); margin-bottom: 22px; font-weight: 500; font-size: 0.95rem; border: 1px solid; }
.flash-success { background: #e7f5ee; color: #14663f; border-color: #b6e0cb; }
.flash-error { background: #fdecea; color: #a4271c; border-color: #f3c2bd; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.stat-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brass); }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -22px rgba(15,34,28,0.5); }
.stat-num { font-family: var(--font-mono); font-weight: 600; font-size: 2.4rem; color: var(--navy); line-height: 1; }
.stat-label { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; text-transform: uppercase; margin-top: 8px; }
.stat-sub { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

/* ---------- Panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; margin-bottom: 24px; }
.panel-narrow { max-width: 620px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-head h2 { font-size: 1.5rem; text-transform: uppercase; }
.count-badge { font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); background: var(--paper); border-radius: 999px; padding: 2px 10px; margin-left: 6px; vertical-align: middle; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-weight: 600; font-size: 0.9rem; }
.field > span small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 1rem; font-family: var(--font-body); background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy); }
.field textarea { resize: vertical; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; padding: 11px 22px; border-radius: var(--radius); border: 1.5px solid transparent; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { border-color: var(--line); color: var(--navy); background: #fff; }
.btn-ghost:hover { border-color: var(--navy); }
.btn-sm { padding: 7px 14px; font-size: 0.9rem; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid var(--line); }
.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--font-mono); font-size: 0.85rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--navy); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
/* td bleibt eine echte Tabellenzelle (Zeilenhöhe + Trennlinie bündig),
   Buttons liegen inline nebeneinander statt per Flex auf dem td selbst. */
.row-actions { white-space: nowrap; vertical-align: middle; }
.row-actions > a, .row-actions > form, .row-actions > button { display: inline-flex; vertical-align: middle; margin: 0; }
.row-actions > * + * { margin-left: 8px; }
.file-cell { color: var(--red); font-weight: 600; }

/* ---------- Year groups in admin ---------- */
.year-admin { margin-bottom: 22px; }
.year-admin-label { font-family: var(--font-mono); font-weight: 600; font-size: 1.3rem; color: var(--navy); padding: 8px 0; border-bottom: 2px solid var(--brass); margin-bottom: 4px; }

/* ---------- Help note ---------- */
.help-note { background: linear-gradient(180deg, #0b1b2b, #10263a); color: rgba(255,255,255,0.82); border-radius: var(--radius); padding: 24px 26px; }
.help-note h3 { color: #fff; font-size: 1.3rem; text-transform: uppercase; margin-bottom: 8px; }
.help-note p { margin: 0; }
.help-note strong { color: var(--brass); }
.help-note code { font-family: var(--font-mono); font-size: 0.85em; background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 4px; }

/* ---------- Post image preview ---------- */
.current-image { display: flex; align-items: center; gap: 16px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.current-image img { width: 120px; height: 80px; object-fit: cover; border-radius: 4px; }
.gallery-label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; }
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.gallery-thumb { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.gallery-thumb img { width: 100%; height: 92px; object-fit: cover; display: block; }
.gallery-remove { display: flex; align-items: center; gap: 6px; padding: 7px 9px; font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.gallery-remove input { width: auto; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }
.inline-check input { width: auto; }
.pill { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: var(--brass); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }

/* ---------- Seiten-Editor (Abschnitte) ---------- */
.subhead { font-size: 1.2rem; text-transform: uppercase; margin-top: 8px; margin-bottom: 4px; }
.block-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; background: #fbfcfb; display: grid; gap: 12px; }
.block-row-head { display: flex; align-items: center; justify-content: space-between; }
.block-label { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--navy); }
.block-row .field span { font-size: 0.85rem; }
.block-row textarea { font-family: var(--font-mono); font-size: 0.92rem; }
.form-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0), var(--card) 40%); padding-top: 16px; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .admin-brand { border-bottom: 0; padding: 0 8px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; margin-left: auto; }
  .admin-nav a { padding: 8px 12px; font-size: 1rem; }
  .admin-side-foot { flex-direction: row; margin-top: 0; padding-top: 0; border-top: 0; width: 100%; justify-content: flex-end; gap: 18px; }
  .stat-grid, .form-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 22px 18px 50px; }
  .admin-topbar { padding: 18px 20px; }
}

/* ---------- Seitenansicht (Klick-Bearbeiten) ---------- */
.cms-body { height: 100vh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
.cms-leiste { display: flex; align-items: center; gap: 18px; padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px -16px rgba(0,40,100,0.5); position: relative; z-index: 2; }
.cms-zurueck { flex-shrink: 0; white-space: nowrap; display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.03em; padding-right: 18px; border-right: 1px solid var(--line); }
.cms-zurueck img { width: auto; height: 36px; }
.cms-zurueck span::before { content: "← "; }
.cms-wahl { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.9rem; }
.cms-wahl select { padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 0.95rem; font-family: var(--font-body); background: #fff; width: 270px; min-width: 150px; max-width: 100%; }
.cms-wahl select:focus { outline: none; border-color: var(--navy); }
.cms-modus { flex-shrink: 0; display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cms-modus button { border: 0; background: #fff; color: var(--muted); padding: 8px 14px; font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
.cms-modus button + button { border-left: 1.5px solid var(--line); }
.cms-modus button.is-aktiv { background: var(--navy); color: #fff; }
.cms-tab { color: var(--navy); text-decoration: none; font-size: 1.15rem; padding: 4px 6px; }
.cms-status { flex: 1; min-width: 0; font-size: 0.88rem; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cms-status-ok { color: var(--green); font-weight: 500; }
.cms-status-fehler { color: var(--red); font-weight: 500; }
.cms-status-offen { color: var(--ink); }
.cms-leiste .btn { flex-shrink: 0; }
.cms-leiste .btn[disabled] { opacity: 0.45; cursor: default; transform: none; }

.cms-arbeit { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); min-height: 0; }
.cms-felder { overflow-y: auto; padding: 18px 18px 40px; background: var(--paper); border-right: 1px solid var(--line); }
.cms-hinweis { margin: 0 0 14px; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.cms-leer { color: var(--muted); font-size: 0.92rem; }
.cms-feld { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin-bottom: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.cms-feld.is-aktiv { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0,80,180,0.12); }
.cms-feld label { display: block; }
.cms-feld-kopf { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.cms-feld-kopf em { font-style: normal; font-weight: 500; font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.cms-feld textarea { width: 100%; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 0.95rem; font-family: var(--font-body); line-height: 1.45; resize: none; overflow: hidden; background: #fff; }
.cms-feld textarea:focus { outline: none; border-color: var(--navy); }
.cms-bild { display: flex; align-items: center; gap: 12px; }
.cms-bild img { width: 104px; height: 66px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }

.cms-buehne { position: relative; overflow: hidden; background: #dfe6f1; }
.cms-buehne iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; }

@media (max-width: 900px) {
  .cms-leiste { flex-wrap: wrap; gap: 10px; }
  .cms-arbeit { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
}
