/* ══════════════════════════════════════════════════════════════════════════════
   style.css – ND Veranstaltungen
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #f7f6f2;
  --surface:      #ffffff;
  --border:       #e8e6e0;
  --border-strong:#c8c5bc;
  --text:         #1a1916;
  --text-muted:   #8a877e;
  --accent:       #2d5a3d;
  --accent-light: #eaf2ec;
  --accent-hover: #234a31;
  --tag-bg:       #f0ede6;
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --radius:       8px;
  --warn-bg:      #fff8e6;
  --warn-text:    #a05c00;
  --warn-border:  #f5d87a;
  --danger-bg:    #fef2f2;
  --danger-text:  #dc2626;
  --danger-border:#fecaca;
}

body.dark {
  --bg:           #161714;
  --surface:      #1f2120;
  --border:       #2e302d;
  --border-strong:#3d403b;
  --text:         #eceae4;
  --text-muted:   #6b6e66;
  --accent:       #4a8c60;
  --accent-light: #1e2e23;
  --accent-hover: #3a7050;
  --tag-bg:       #272926;
  --shadow:       0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --warn-bg:      #2a2310;
  --warn-text:    #d4920a;
  --warn-border:  #6b4e00;
  --danger-bg:    #2d1515;
  --danger-text:  #fca5a5;
  --danger-border:#7f1d1d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────────── */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ── HEADER ─────────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.app-header-left h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-header-left .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  margin-top: 3px;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover { background: var(--tag-bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-light); color: var(--accent); }

/* ── BREADCRUMB ─────────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--tag-bg); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-xs { padding: 3px 10px; font-size: 0.75rem; }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-danger:hover { background: #fecaca; text-decoration: none; }

/* ── ICON-BUTTON ────────────────────────────────────────────────────────────── */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); background: var(--tag-bg); }

/* ── BADGE ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-neutral { background: var(--tag-bg); color: var(--text-muted); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }
.badge-warn    { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.badge-danger  { background: var(--danger-bg); color: var(--danger-text); }

/* ── SEARCH ─────────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
input[type="search"],
input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
input[type="search"] { width: 100%; padding: 9px 12px 9px 36px; }
input[type="search"]:focus,
input[type="text"]:focus,
select:focus { border-color: var(--accent); }

/* ── TABLE ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; min-width: 400px; border-collapse: collapse; }

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
}
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--accent); }
thead th .sort-icon { display: inline-block; margin-left: 4px; opacity: 0.4; font-size: 0.65rem; }
thead th.sorted .sort-icon { opacity: 1; }

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #f0f7f2; }
body.dark tbody tr.clickable:hover td { background: #1e2b21; }

/* Leaflet Controls im Dark Mode */
body.dark .leaflet-bar a { background-color: #1f2120; color: #eceae4; border-color: #2e302d; }
body.dark .leaflet-bar a:hover { background-color: #2e302d; }
body.dark .leaflet-bar { box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
body.dark .leaflet-popup-content-wrapper, body.dark .leaflet-popup-tip { background: #1f2120; color: #eceae4; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
body.dark .leaflet-popup-content-wrapper a { color: #4a8c60; }
body.dark .leaflet-control-attribution { background: rgba(31,33,32,0.85); color: #6b6e66; }
body.dark .leaflet-control-attribution a { color: #4a8c60; }

td { padding: 11px 16px; font-size: 0.88rem; vertical-align: middle; }
td.mono { font-family: 'DM Mono', monospace; font-size: 0.8rem; color: var(--text-muted); }
td.name { font-weight: 500; }
td.right { text-align: right; }

/* ── HAUSHALT-GRUPPEN ───────────────────────────────────────────────────────── */
tr.haushalt-header td {
  background: var(--accent-light);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
  padding: 8px 16px;
  cursor: pointer;
  user-select: none;
}
tr.haushalt-header:hover td { filter: brightness(0.97); }
tr.haushalt-header td .chevron {
  display: inline-flex; align-items: center;
  margin-right: 6px;
  transition: transform 0.2s; vertical-align: middle;
}
tr.haushalt-header.open td .chevron { transform: rotate(90deg); }
tr.haushalt-member td { padding-left: 32px; }
tr.haushalt-member.hidden { display: none; }

/* ── CARD ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── STATS-GRID ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  position: relative;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--accent); }
.stat-card.clickable.active { border-color: var(--accent); background: var(--accent-light); }
.stat-card.clickable.active::after { content: ''; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid var(--accent); }
.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  color: var(--accent);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── STATISTIKEN ────────────────────────────────────────────────────────────── */
.section-title {
  font-size: 1rem; font-weight: 600; letter-spacing: -0.01em;
  margin: 28px 0 16px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
@media(max-width:600px) {
  .chart-grid { grid-template-columns: 1fr; }
  .col-bis { display: none; }
  .mobile-bis { display: inline; }
  table { min-width: unset; }
}
@media(min-width:601px) {
  .mobile-bis { display: none; }
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.reihe-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.reihe-tab {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  background: var(--tag-bg);
  color: var(--text-muted);
}
.reihe-tab.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.reihe-section { display: none; }
.reihe-section.active { display: block; }
.va-zeitstrahl-wrap { position: relative; }
.va-zeitstrahl-wrap::after { content: ''; position: absolute; right: 0; top: 0; bottom: 20px; width: 60px; background: linear-gradient(to right, transparent, var(--bg)); pointer-events: none; }
.va-zeitstrahl { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 20px; margin-bottom: 0; scrollbar-width: thin; }
.va-card { flex-shrink: 0; min-width: 110px; background: var(--surface); border: 2px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color 0.15s, background 0.15s, opacity 0.15s; user-select: none; position: relative; }
.va-card:hover { border-color: var(--accent); }
.va-card.active { border-color: var(--accent); background: var(--accent-light); }
.va-card.active::after { content: ''; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid var(--accent); }
.va-zeitstrahl.has-active .va-card:not(.active) { opacity: 0.35; }
.va-detail-panel { margin-top: 0; margin-bottom: 32px; box-shadow: var(--shadow); border-color: var(--accent) !important; }
.va-card-jahr { font-size: 1rem; font-weight: 600; margin-bottom: 2px; }
.va-card-tn { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.va-card-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.va-detail-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.va-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.va-detail-stat { text-align: center; padding: 10px; background: var(--tag-bg); border-radius: 8px; }
.va-detail-stat-val { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.va-detail-stat-lbl { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ── ALERT ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.alert-success { background: var(--accent-light); color: var(--accent); border: 1px solid #b6d9c3; }

/* ── CONTROLS ───────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── EMPTY STATE ────────────────────────────────────────────────────────────── */
.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.empty-state .icon { display: block; font-size: 2rem; margin-bottom: 10px; }

/* ── DARK MODE TOGGLE ───────────────────────────────────────────────────────── */
#darkToggle { font-size: 1.1rem; }

/* ── REVIEW ITEMS ───────────────────────────────────────────────────────────── */
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.review-item .review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.review-item .person-name {
  font-size: 1rem;
  font-weight: 600;
}
.review-item .person-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  margin-top: 3px;
}
.review-candidate {
  background: var(--accent-light);
  border: 1px solid #b6d9c3;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 10px;
}
.review-candidate .candidate-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}
.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ── PERSON PROFILE ─────────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-name { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.profile-meta { font-size: 0.82rem; color: var(--text-muted); font-family: 'DM Mono', monospace; margin-top: 4px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
}
.info-row { font-size: 0.88rem; }
.info-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.info-value { color: var(--text); }

/* ── VERLAUF TIMELINE ───────────────────────────────────────────────────────── */
.timeline { list-style: none; }
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 5px;
  flex-shrink: 0;
}
.timeline-content { flex: 1; }
.timeline-name { font-weight: 500; font-size: 0.9rem; }
.timeline-meta { font-size: 0.8rem; color: var(--text-muted); font-family: 'DM Mono', monospace; margin-top: 3px; }

/* ── UPLOAD FORM ────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone .upload-icon { font-size: 2rem; margin-bottom: 10px; }
.upload-zone p { font-size: 0.88rem; color: var(--text-muted); }
.upload-zone strong { color: var(--accent); }
input[type="file"] { display: none; }

/* ── CHART BARS ─────────────────────────────────────────────────────────────── */
.bar-chart { list-style: none; }
.bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.bar-item:last-child { border-bottom: none; }
.bar-label { min-width: 140px; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; background: var(--tag-bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.bar-value { font-family: 'DM Mono', monospace; font-size: 0.78rem; color: var(--text-muted); min-width: 30px; text-align: right; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page { padding: 20px 14px 40px; }
  .app-header { margin-bottom: 20px; }
  .app-header-left h1 { font-size: 1.15rem; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 6px 10px; font-size: 0.78rem; }
  td { padding: 9px 8px; }
  thead th { padding: 9px 8px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
