/* ══════════════════════════════════════════════════════
   THW OV Flensburg – Neues THW-Design (angelehnt an thw.de)
   Farben: THW-Blau #003399 · Gelb #EAE456 · scharfe Ecken
   ══════════════════════════════════════════════════════ */

:root {
  --thw-blue:       #003399;
  --thw-blue-dark:  #002266;
  --thw-blue-xdark: #001a4d;
  --thw-blue-light: #e6ecf7;
  --thw-yellow:     #EAE456;
  --thw-yellow-dk:  #d9d23f;
  --white:          #ffffff;
  --gray-50:        #f8f8f9;
  --gray-100:       #f4f5f6;
  --gray-200:       #e3e5e8;
  --gray-400:       #8a9099;
  --gray-600:       #565b62;
  --gray-800:       #202020;
  --success:        #1a7a3c;
  --success-bg:     #e8f7ee;
  --danger:         #c0392b;
  --danger-bg:      #fdecea;
  --radius-sm:      0;
  --radius:         0;
  --radius-lg:      0;
  --shadow-sm:      0 1px 3px rgba(0,51,153,.08);
  --shadow:         0 2px 8px rgba(0,51,153,.10);
  --shadow-lg:      0 6px 20px rgba(0,51,153,.14);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'BundesSans', 'BundesSansWeb', Calibri, 'Segoe UI', 'Droid Sans', Arial, 'Helvetica Neue', Helvetica, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ──────────────────────────────────
   HEADER
────────────────────────────────── */
.site-header {
  background: var(--thw-blue);
  box-shadow: 0 3px 20px rgba(0,0,0,.28);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  height: 52px;
  width: auto;
  flex-shrink: 0;
}

.header-text { flex: 1; min-width: 0; }

.header-text h1 {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-text p {
  color: rgba(255,255,255,.68);
  font-size: .78rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(255,255,255,.3);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .18s;
}
.btn-admin-link svg { width: 14px; height: 14px; }
.btn-admin-link:hover { background: rgba(255,255,255,.14); }

.nav-label { display: none; }

/* Gelber Akzentstreifen */
.accent-bar { height: 4px; background: var(--thw-yellow); }

/* ──────────────────────────────────
   HAUPT-INHALT
────────────────────────────────── */
.main-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 14px 60px;
  flex: 1;
  width: 100%;
}

/* Abschnitts-Label */
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--thw-blue);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--thw-blue);
  opacity: .7;
}
.section-label svg { width: 16px; height: 16px; }

/* ──────────────────────────────────
   EVENTS-LISTE (untereinander)
────────────────────────────────── */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ──────────────────────────────────
   EVENT-CARD
────────────────────────────────── */
.event-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}

.event-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* Datum-Streifen */
.event-date-bar {
  background: var(--thw-blue);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.event-date-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.event-weekday {
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.event-day {
  color: var(--white);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.event-month {
  color: rgba(255,255,255,.85);
  font-size: .88rem;
  font-weight: 600;
}

.event-date-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.event-time {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,.85);
  font-size: .84rem;
  font-weight: 600;
  background: rgba(255,255,255,.12);
  padding: 4px 10px;
  border-radius: 0;
}
.event-time svg { width: 13px; height: 13px; }

/* Tages-Pills */
.day-pill {
  font-size: .72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 0;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.day-pill.today { background: var(--thw-yellow); color: var(--thw-blue-xdark); }
.day-pill.soon  { background: rgba(255,255,255,.2); color: var(--white); }

/* Body */
.event-body {
  padding: 16px 18px 14px;
}

.event-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.3;
  margin-bottom: 8px;
}

.event-description {
  font-size: .87rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* Zähler */
.event-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 0;
}
.count-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.count-badge strong { font-weight: 800; }

.count-an { background: var(--thw-blue-light); color: var(--thw-blue); }
.count-ab { background: var(--danger-bg); color: var(--danger); }

/* Aktions-Buttons */
.event-actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 16px;
}

/* ──────────────────────────────────
   BUTTONS
────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Gelb – Anmelden */
.btn-signup {
  background: var(--thw-yellow);
  color: var(--thw-blue-xdark);
  border-color: var(--thw-yellow);
  flex: 1;
}
.btn-signup:hover { background: var(--thw-yellow-dk); border-color: var(--thw-yellow-dk); }

/* Rot – Abmelden */
.btn-signoff {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
  flex: 1;
}
.btn-signoff:hover { background: var(--danger-bg); }

/* Blau */
.btn-primary {
  background: var(--thw-blue);
  color: var(--white);
  border-color: var(--thw-blue);
}
.btn-primary:hover { background: var(--thw-blue-dark); }

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--thw-blue);
  border-color: var(--thw-blue);
}
.btn-outline:hover { background: var(--thw-blue-light); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover { background: #a93226; }

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger-outline:hover { background: var(--danger-bg); }

.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-full { width: 100%; }

/* ──────────────────────────────────
   LEERER ZUSTAND
────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--gray-400);
}
.empty-state svg { width: 52px; height: 52px; margin-bottom: 14px; opacity: .35; }
.empty-state p { font-size: .95rem; }

/* ──────────────────────────────────
   MODALS
────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,29,82,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;           /* Mobile: von unten */
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 100%;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
}
.modal-overlay.open .modal { transform: translateY(0); }

/* Zieh-Indikator oben */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: 10px auto 0;
}

.modal-header {
  background: var(--thw-blue);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  color: var(--white);
  font-size: .98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}
.modal-header h3 svg { width: 16px; height: 16px; }
.modal-header-danger { background: var(--danger); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.75);
  padding: 6px;
  border-radius: 0;
  display: flex;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { color: var(--white); }
.modal-close svg { width: 20px; height: 20px; }

.modal-body { padding: 20px 20px 8px; }
.modal-footer {
  padding: 14px 20px 20px;
  display: flex;
  gap: 10px;
}
.modal-footer .btn { flex: 1; padding: 13px; font-size: .92rem; }

.modal-event-name {
  font-size: .88rem;
  color: var(--gray-600);
  margin-bottom: 16px;
  line-height: 1.4;
}
.modal-event-name strong { color: var(--gray-800); }

/* ──────────────────────────────────
   FORMULARE
────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.label-optional {
  font-weight: 400;
  text-transform: none;
  font-size: .8rem;
  color: var(--gray-400);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;          /* verhindert Zoom auf iOS */
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--thw-blue);
  box-shadow: 0 0 0 3px rgba(0,61,165,.12);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Verpflegungs-Checkboxen */
.food-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.food-check {
  flex: 1;
  min-width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.food-check:has(input:checked) {
  border-color: var(--thw-blue);
  background: rgba(0,61,165,.07);
  color: var(--thw-blue);
}
.food-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--thw-blue);
  cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: .78rem; color: var(--gray-400); margin-top: 4px; }

/* ──────────────────────────────────
   ALERTS
────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #b2dfcc; }
.alert-danger   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #f5c6c2; }
.alert-info     { background: var(--thw-blue-light); color: var(--thw-blue); border: 1px solid var(--gray-200); }
.alert-warning  { background: #fff8e6; color: #8a6800; border: 1px solid #f0d080; }

/* ──────────────────────────────────
   TOAST / FLASH
────────────────────────────────── */
.flash-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}

.flash-toast {
  background: var(--thw-blue-xdark);
  color: var(--white);
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: toastIn .3s ease;
}
.flash-toast.success { background: var(--success); }
.flash-toast.error   { background: var(--danger); }

@keyframes toastIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ──────────────────────────────────
   ADMIN – TABS
────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 11px 18px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--gray-600);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .18s, border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: var(--thw-blue); }
.tab-btn.active { color: var(--thw-blue); border-bottom-color: var(--thw-blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ──────────────────────────────────
   ADMIN – CARD / TABLE
────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.card-header {
  background: var(--thw-blue);
  padding: 14px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h3 { color: var(--white); font-size: .98rem; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.card-header h3 svg { width: 15px; height: 15px; }
.event-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; }
.meta-item { display: flex; align-items: center; gap: 5px; color: rgba(255,255,255,.85); font-size: .83rem; }
.meta-item svg { width: 13px; height: 13px; }
.card-body { padding: 18px 20px; }
.card-footer {
  padding: 12px 20px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th {
  background: var(--thw-blue-light);
  color: var(--thw-blue);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ──────────────────────────────────
   STATUS PILLS
────────────────────────────────── */
.pill { display: inline-block; padding: 2px 10px; border-radius: 0; font-size: .75rem; font-weight: 700; }
.pill-green { background: var(--success-bg); color: var(--success); }
.pill-red   { background: var(--danger-bg);  color: var(--danger); }
.admin-label {
  background: var(--thw-yellow);
  color: var(--thw-blue-xdark);
  font-size: .7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 0;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.reg-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.18);
  color: var(--white);
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0;
}

/* ──────────────────────────────────
   PAGE TITLE (Admin)
────────────────────────────────── */
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.page-title h2 { font-size: 1.2rem; font-weight: 700; color: var(--thw-blue); display: flex; align-items: center; gap: 8px; }
.page-title h2 svg { width: 20px; height: 20px; }
.page-title-divider { flex: 1; height: 2px; background: linear-gradient(90deg, var(--thw-blue) 0%, transparent 100%); opacity: .15; border-radius: 2px; }

/* ──────────────────────────────────
   ADMIN LOGIN
────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 90px);
  padding: 24px 16px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}
.login-card .card-header { padding: 28px 24px; text-align: center; display: block; }
.lock-icon {
  width: 50px; height: 50px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.lock-icon svg { width: 24px; height: 24px; fill: var(--white); }
.login-card .card-body { padding: 28px 24px; }

/* ──────────────────────────────────
   ADMIN CONTAINER
────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 16px 60px;
  flex: 1;
}

/* ──────────────────────────────────
   HEADER NAV (Admin)
────────────────────────────────── */
.header-nav { display: flex; gap: 8px; flex-shrink: 0; }
.header-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(255,255,255,.28);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .18s;
  -webkit-tap-highlight-color: transparent;
}
.header-nav a svg { width: 13px; height: 13px; }
.header-nav a:hover { background: rgba(255,255,255,.14); }
.header-nav a.active { background: var(--thw-yellow); color: var(--thw-blue-xdark); border-color: var(--thw-yellow); }

/* ──────────────────────────────────
   FOOTER
────────────────────────────────── */
.site-footer {
  background: var(--thw-blue-xdark);
  color: rgba(255,255,255,.45);
  text-align: center;
  padding: 18px 16px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  font-size: .8rem;
}
.site-footer a { color: rgba(255,255,255,.65); text-decoration: none; }
.site-footer a:hover { color: var(--white); }

/* ══════════════════════════════════
   TABLET: ab 500px
══════════════════════════════════ */
@media (min-width: 500px) {
  .header-logo { height: 60px; }
  .header-text h1 { font-size: 1.25rem; }
  .header-text p { font-size: .82rem; }
  .nav-label { display: inline; }
  .main-content { padding: 28px 20px 60px; }
  .modal {
    border-radius: var(--radius-lg);
    max-width: 480px;
    align-self: center;
  }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal::before { display: none; }
}

/* ══════════════════════════════════
   DESKTOP: ab 768px
══════════════════════════════════ */
@media (min-width: 768px) {
  .header-inner { padding: 14px 24px; gap: 20px; }
  .header-logo { height: 68px; }
  .header-text h1 { font-size: 1.4rem; }
  .event-date-bar { flex-wrap: nowrap; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .event-actions .btn { flex: 0 0 auto; min-width: 140px; }
}
