:root {
  /* Red tonal scale — the site's whole identity, used with intent rather
     than one flat red everywhere. Bright end (300-500) reads well as text
     and accents against the dark surfaces below; dark end (700-950) is
     used for gradients/surfaces, not text. */
  --red-950: #2b0a0e;
  --red-900: #451019;
  --red-800: #641726;
  --red-700: #8f1f30;
  --red-600: #b32638;
  --red-500: #d0263b;
  --red-400: #e0435a;
  --red-300: #ec7686;
  --red-200: #f3a7b1;

  /* two companion red-family hues for variety across categories */
  --wine: #7a2044;
  --wine-bright: #dd93b4;
  --rust: #b8452a;
  --rust-bright: #e6996d;
  --gold: #c9a53f;

  /* aliases so existing rules keep working */
  --red: var(--red-500);
  --red-dark: var(--red-700);
  --red-darker: var(--red-800);

  /* dark, "washy" tints for badge/hover backgrounds — paired with a
     bright token above for the text that sits on them */
  --red-light: rgba(208,38,59,0.18);
  --wine-light: rgba(122,32,68,0.24);
  --rust-light: rgba(184,69,42,0.22);
  --gold-light: rgba(201,165,63,0.20);
  --green-light: rgba(53,184,114,0.16);
  --amber-light: rgba(219,165,60,0.16);

  /* Surfaces: black tones, with just a little white — each step is a
     touch lighter than the last to read as "elevated". */
  --white: #1c1718;   /* card / elevated surface */
  --gray-50: #120e0f;  /* page background + recessed elements inside cards */
  --gray-100: #241e1f; /* chip / subtle contrast panel */
  --gray-200: #352c2e; /* border */
  --gray-300: #483c3f; /* stronger border / input border */
  --gray-500: #ab9fa1; /* muted / secondary text */
  --gray-700: #d9cfd0; /* light text on chip backgrounds */
  --text: #f1e9ea;     /* primary text — a little white, not stark */
  --gray-status: #b7abad;

  --green: #35b872;
  --amber: #dba53c;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.25);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.45);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.6);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #171112 0%, var(--gray-50) 260px);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient glow orbs — slow-drifting blurred color behind the content,
   purely decorative depth for the dark theme. */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
}
body::before {
  width: 520px; height: 520px;
  background: var(--red-700);
  top: -180px; left: -140px;
  animation: orb-float-a 20s ease-in-out infinite;
}
body::after {
  width: 420px; height: 420px;
  background: var(--wine);
  bottom: -160px; right: -100px;
  animation: orb-float-b 24s ease-in-out infinite;
}
@keyframes orb-float-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(50px, 70px); }
}
@keyframes orb-float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-60px, -50px); }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after,
  .card, .stat-tile, .lb-row, .header-logo,
  .card::before, .section-heading::before, .create-panel h2::before {
    animation: none !important;
  }
}

header, .page, .lb-page, .login-card {
  position: relative;
  z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: linear-gradient(120deg, var(--red-600) 0%, var(--red-800) 60%, var(--red-950) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

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

.header-logo {
  font-size: 1.8rem;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logo-glow 3.5s ease-in-out infinite;
}

@keyframes logo-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 18px rgba(255,255,255,0.3); }
}

header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.78);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.last-updated {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
}

.user-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ── Page layout ────────────────────────────────────────────────────── */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 32px 60px;
}

.section-heading {
  margin: 36px 0 16px;
  position: relative;
  padding-left: 14px;
}

.section-heading::before {
  content: '';
  position: absolute;
  left: 0; top: 2px; bottom: 2px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--red-500), var(--wine), var(--red-500));
  background-size: 100% 200%;
  animation: bar-shimmer-v 5s linear infinite;
}

@keyframes bar-shimmer-v {
  0% { background-position: 0 0%; }
  100% { background-position: 0 200%; }
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Stats bar ──────────────────────────────────────────────────────── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.stat-tile {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--red-500);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: card-in 0.4s ease both;
}
.stat-tile:hover {
  box-shadow: var(--shadow-md), 0 0 22px -8px rgba(208,38,59,0.4);
  transform: translateY(-2px);
}
.stat-tile:nth-child(2) { border-left-color: var(--wine-bright); }
.stat-tile:nth-child(3) { border-left-color: var(--rust-bright); }

.stat-tile .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--red-400);
  letter-spacing: -0.02em;
}
.stat-tile:nth-child(2) .stat-value { color: var(--wine-bright); }
.stat-tile:nth-child(3) .stat-value { color: var(--rust-bright); }

.stat-tile .stat-label {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── Create panel ───────────────────────────────────────────────────── */

.create-panel {
  margin-top: 24px;
}

.create-panel h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  padding-left: 14px;
  position: relative;
}

.create-panel h2::before {
  content: '';
  position: absolute;
  left: 0; top: 2px; bottom: 2px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--red-500), var(--wine), var(--red-500));
  background-size: 100% 200%;
  animation: bar-shimmer-v 5s linear infinite;
}

.create-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  flex: 1;
}

.form-group[hidden] { display: none; }

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.create-form select,
.create-form input {
  padding: 9px 11px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--gray-50);
  color: var(--text);
}

#createBtn {
  align-self: flex-end;
}

/* ── Event grid ─────────────────────────────────────────────────────── */

main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: var(--radius);
  padding: 19px 18px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  animation: card-in 0.4s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--red-600), var(--red-400), var(--red-600));
  background-size: 200% 100%;
  animation: bar-shimmer 6s linear infinite;
}
.card.cat-mcl::before     { background: linear-gradient(90deg, var(--wine), var(--wine-bright), var(--wine)); background-size: 200% 100%; }
.card.cat-airdrop::before { background: linear-gradient(90deg, var(--rust), var(--rust-bright), var(--rust)); background-size: 200% 100%; }

@keyframes bar-shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.card:hover {
  box-shadow: var(--shadow-md), 0 0 26px -8px rgba(208,38,59,0.4);
  border-color: var(--red-800);
  transform: translateY(-2px);
}
.card.cat-mcl:hover     { box-shadow: var(--shadow-md), 0 0 26px -8px rgba(122,32,68,0.5); border-color: var(--wine); }
.card.cat-airdrop:hover { box-shadow: var(--shadow-md), 0 0 26px -8px rgba(184,69,42,0.5); border-color: var(--rust); }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge.kategorie {
  background: var(--red-light);
  color: var(--red-300);
}
.card.cat-mcl .badge.kategorie     { background: var(--wine-light); color: var(--wine-bright); }
.card.cat-airdrop .badge.kategorie { background: var(--rust-light); color: var(--rust-bright); }

.badge.status.offen   { background: var(--green-light); color: var(--green); }
.badge.status.beendet { background: var(--gray-100); color: var(--gray-status); }
.badge.status.abgesagt{ background: var(--red-light); color: var(--red-300); }
.badge.status.läuft    { background: var(--amber-light); color: var(--amber); }

.card-head .delete-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field.gegner-field { grid-column: span 2; }

.field label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field .datum {
  padding: 7px 0 3px;
  font-weight: 700;
  font-size: 0.92rem;
}

input {
  padding: 7px 9px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--gray-50);
  color: var(--text);
  transition: border-color 0.12s ease, background 0.12s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--red-500);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--red-light);
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.06s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn[hidden] { display: none; }
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn-small { padding: 7px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-icon { font-size: 1em; line-height: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--red-600), var(--red-800));
  color: #fff;
  box-shadow: 0 2px 10px rgba(179,38,56,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px -2px rgba(179,38,56,0.6); }
.btn-danger  { background: var(--white); color: var(--red-400); border: 1px solid var(--red-700); }
.btn-danger:hover { background: var(--red-light); filter: none; box-shadow: 0 4px 14px -4px rgba(179,38,56,0.4); }
.btn-outline { background: var(--white); color: var(--red-400); border: 1px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--red-500); background: var(--red-light); filter: none; box-shadow: 0 4px 14px -4px rgba(179,38,56,0.3); }

header .btn-outline {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}
header .btn-outline:hover { background: rgba(255,255,255,0.22); }

/* ── Teilnehmer lists ───────────────────────────────────────────────── */

.teilnehmer-section h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border-top: 1px solid var(--gray-100);
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-pill {
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

.teilnehmer-list, .bewerber-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 170px;
  overflow-y: auto;
}

.teilnehmer-list:empty::after, .bewerber-list:empty::after {
  content: 'Noch niemand.';
  font-size: 0.8rem;
  color: var(--gray-500);
  font-style: italic;
  padding: 4px 2px;
}

.teilnehmer-list li, .bewerber-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.teilnehmer-list li button, .bewerber-list li button {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 0.85rem;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease, background 0.12s ease;
}
.teilnehmer-list li button:hover, .bewerber-list li button:hover {
  color: var(--red-400);
  background: var(--red-light);
}

.add-teilnehmer {
  display: flex;
  gap: 6px;
}
.add-teilnehmer input,
.add-teilnehmer select {
  flex: 1;
  padding: 7px 9px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--gray-50);
  color: var(--text);
}

/* ── Empty / loading states ─────────────────────────────────────────── */

.empty-state {
  text-align: center;
  color: var(--gray-500);
  padding: 60px 20px;
  background: var(--white);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
}

.empty-icon { font-size: 2.4rem; margin-bottom: 8px; }
.empty-state p { margin: 4px 0; }
.empty-hint { font-size: 0.82rem; color: var(--gray-500); }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--red-500);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toasts ─────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: var(--gray-100);
  color: var(--text);
  border: 1px solid var(--gray-200);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease;
  max-width: 320px;
}
.toast.error { background: var(--red-800); border-color: var(--red-700); color: #fff; }
.toast.success { background: #164a2c; border-color: var(--green); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Confirm modal ──────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 340px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal p {
  margin: 0 0 18px;
  font-size: 0.92rem;
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  header { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 18px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .page { padding: 20px 16px 40px; }
  main { grid-template-columns: 1fr; }
  .create-form { flex-direction: column; align-items: stretch; }
  #createBtn { width: 100%; }
}
