/* Wahlplattform Stadttauben Dresden e.V. – gemeinsames Stylesheet */
:root {
  --c-bg: #f0f9ff;
  --c-surface: #ffffff;
  --c-border: #d9e2ec;
  --c-text: #0D2B6E;
  --c-text-muted: #546E9A;
  --c-primary: #0D2B6E;
  --c-primary-hover: #1E88E5;
  --c-primary-text: #ffffff;
  --c-accent: #FB8C00;
  --c-accent-hover: #e07d00;
  --c-success: #1f7a3a;
  --c-success-bg: #e6f4ea;
  --c-warning: #a05a00;
  --c-warning-bg: #fdf2d5;
  --c-danger: #b3261e;
  --c-danger-bg: #fbe9e7;
  --c-info-bg: #BBDEFB;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(13,43,110,0.08);
  --shadow: 0 4px 12px rgba(13,43,110,0.15);
  --tap-min: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

header.appbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.appbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
header.appbar .user-info {
  font-size: 14px;
  color: var(--c-text-muted);
}

/* Card */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
}
.card h3 {
  margin: 16px 0 8px;
  font-size: 16px;
}
.card p { margin: 8px 0; }
.card .meta {
  color: var(--c-text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

/* Status-Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.badge-running   { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-done      { background: var(--c-success-bg); color: var(--c-success); }
.badge-pending   { background: var(--c-info-bg);    color: var(--c-primary); }
.badge-closed    { background: #e2e5ea;             color: var(--c-text-muted); }
.badge-cancelled { background: var(--c-danger-bg);  color: var(--c-danger); }
.badge-test      { background: #fff0f6;             color: #b32d70; border: 1px dashed #b32d70; }

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  font-family: inherit;
  text-decoration: none;
}
button:hover, .btn:hover { background: #f0f2f5; }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--c-primary);
  color: var(--c-primary-text);
  border-color: var(--c-primary);
  font-weight: 600;
}
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-danger {
  background: var(--c-danger);
  color: #fff;
  border-color: var(--c-danger);
}
.btn-danger:hover { background: #8f1e18; }
.btn-large {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
  margin-top: 8px;
}
.btn-secondary { background: transparent; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Wahl-Optionen (Mitglied) */
.option {
  display: block;
  width: 100%;
  padding: 16px;
  margin: 8px 0;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  cursor: pointer;
  font-size: 20px;
  line-height: 1.4;
  text-align: left;
  transition: all 0.1s;
  min-height: var(--tap-min);
}
.option:hover { border-color: var(--c-primary); background: #f5f8fd; }
.option.selected {
  border-color: var(--c-primary);
  background: var(--c-info-bg);
  box-shadow: inset 0 0 0 2px var(--c-primary);
}
.option .marker {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  margin-right: 12px;
  vertical-align: middle;
  position: relative;
}
.option.selected .marker {
  border-color: var(--c-primary);
  background: var(--c-primary);
}
.option.selected .marker::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 6px; height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.option.multiselect .marker { border-radius: 4px; }

/* Formularelemente */
label { display: block; margin: 12px 0 4px; font-weight: 500; font-size: 14px; }
input[type="text"], input[type="number"], input[type="datetime-local"],
input[type="email"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: -1px;
  border-color: var(--c-primary);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  border-left: 4px solid;
}
.alert-info    { background: var(--c-info-bg);    border-color: var(--c-primary); }
.alert-success { background: var(--c-success-bg); border-color: var(--c-success); }
.alert-warn    { background: var(--c-warning-bg); border-color: var(--c-warning); }
.alert-error   { background: var(--c-danger-bg);  border-color: var(--c-danger); }

/* Tables (Admin) */
table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}
table.data th { background: #f5f7fa; font-weight: 600; }
table.data tr:hover td { background: #fafbfc; }

/* Live-Zähler */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.stat {
  background: #f7f9fc;
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat .num { font-size: 28px; font-weight: 700; color: var(--c-primary); line-height: 1; }
.stat .label { font-size: 13px; color: var(--c-text-muted); margin-top: 4px; }

/* FAQ / Helpertext */
.help {
  background: #f7f9fc;
  border-left: 4px solid var(--c-primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  font-size: 14px;
  color: var(--c-text-muted);
}
.help summary { cursor: pointer; color: var(--c-text); font-weight: 500; }

/* Testmodus-Banner */
.test-banner {
  background: repeating-linear-gradient(45deg, #fff0f6, #fff0f6 12px, #ffd8e8 12px, #ffd8e8 24px);
  color: #7d1e4a;
  text-align: center;
  padding: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  border-bottom: 2px dashed #b32d70;
}

/* Login / Landing */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.center-screen .card { max-width: 420px; width: 100%; text-align: center; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile-Optimierung */
@media (max-width: 480px) {
  .container, .container-wide { padding: 12px; }
  .card { padding: 16px; }
  header.appbar h1 { font-size: 16px; }
}

/* Print (für Protokoll-Export) */
@media print {
  header.appbar, .no-print, button { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* Accessibility */
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn-accent {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
  font-weight: 600;
}
.btn-accent:hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
}

/* Header mit Vereinslogo (Corporate Design) */
header.appbar {
  background: var(--c-primary);
  border-bottom: none;
}

header.appbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

header.appbar .brand img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

header.appbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

header.appbar .brand-text .brand-org {
  font-size: 13px;
  color: #ffffff;
  opacity: 0.85;
}

header.appbar .brand-text .brand-app {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

header.appbar .user-info {
  color: #ffffff;
  opacity: 0.9;
}

header.appbar .btn-primary {
  background: #ffffff;
  color: var(--c-primary);
  border-color: #ffffff;
}

header.appbar .btn-primary:hover {
  background: #f0f2f5;
}

header.appbar .btn-secondary {
  background: transparent;
  color: #ffffff;
  border: 1px solid #ffffff;
}

header.appbar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}