/* ==========================================================================
   Design-System & Reset
   ========================================================================== */

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

:root {
  /* Farben – Dark, leicht „neumorph / glassy“ */
  --bg-body: #020617;
  --bg-elevated: rgba(15, 23, 42, 0.96);
  --bg-elevated-soft: rgba(15, 23, 42, 0.9);
  --bg-soft: #020617;
  --border-subtle: rgba(148, 163, 184, 0.28);
  --border-strong: rgba(148, 163, 184, 0.5);
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.16);
  --accent-strong: #2563eb;
  --accent-danger: #f97373;
  --accent-danger-soft: rgba(239, 68, 68, 0.16);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-soft: #6b7280;

  --radius-xs: 0.375rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;

  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.8);
  --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.6);

  --transition-fast: 150ms ease-out;
  --transition-med: 220ms ease-out;

  --ring-color: rgba(79, 140, 255, 0.55);
}

/* Nutzer, die Animationen reduziert wollen, respektieren */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Body + Page-Shell (Footer immer unten, Hintergrund über ganze Seite)
   ========================================================================== */

body {
  font-family: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, Ubuntu,
    Cantarell, Arial, sans-serif;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(79, 140, 255, 0.3) 0, transparent 38%),
    radial-gradient(circle at 90% 100%, rgba(16, 185, 129, 0.18) 0, transparent 40%),
    var(--bg-body);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ganze Seite */
.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Haupt-Content soll sich dehnen, damit Footer nach unten gedrückt wird */
.page-shell > .container {
  flex: 1 0 auto;
}

/* ==========================================================================
   Typografie
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.4em;
  color: #f9fafb;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

h3 {
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
}

p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  transition: width var(--transition-med);
}

a:hover::after {
  width: 100%;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1px 16px 1px;
}

/* Sticky / Glassy Header + Footer */

header,
footer {
  padding: 10px 16px;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9));
  border-bottom: 1px solid rgba(148, 163, 184, 0.26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

header {
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Footer hängt am unteren Rand, bewegt sich aber mit Scrollen */
footer {
  border-top: 1px solid rgba(148, 163, 184, 0.26);
  border-bottom: none;
  margin-top: 0;
}

/* ==========================================================================
   Card / Pane
   ========================================================================== */

.card,
.day-card {
  background: var(--bg-elevated-soft);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 18px 16px;
  margin: 12px 0;
  box-shadow: var(--shadow-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    transform var(--transition-med),
    box-shadow var(--transition-med),
    border-color var(--transition-med),
    background var(--transition-med);
  max-width: 100%;
}

.card:hover,
.day-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
  background: rgba(15, 23, 42, 0.98);
}

/* ==========================================================================
   Brand / Logo / User-Pill
   ========================================================================== */

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-logo img {
  height: 80px;
  width: auto;
  display: block;
  border-radius: 6px;
}

.brand-text {
  font-weight: 600;
  font-size: clamp(2rem, 2vw, 1rem);
  color: #f9fafb;
  letter-spacing: 0.02em;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.13), rgba(15, 23, 42, 0.7));
  font-weight: 500;
  line-height: 1;
  font-size: clamp(0.68rem, 0.9vw, 0.8rem);
  white-space: nowrap;
  color: var(--text-main);
}

/* Logo/Brand auf sehr kleinen Screens leicht verkleinern */
@media (max-width: 600px) {
  .brand-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
  }

  .brand-logo img {
    height: 50px;
  }

  .brand-text {
    font-size: 2rem;
  }
}

.logo {
  font-weight: 700;
  letter-spacing: -0.04em;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 64, 175, 0.4));
  color: #f9fafb;
  cursor: pointer;
  line-height: 1.2;
  vertical-align: middle;
  text-align: center;
  min-height: 44px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    background var(--transition-med),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn:hover {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.9), rgba(56, 189, 248, 0.55));
  border-color: rgba(129, 140, 248, 0.75);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.8);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
}

.btn-primary {
  border-color: rgba(129, 140, 248, 0.9);
  background: linear-gradient(135deg, var(--accent-strong), #8b5cf6);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.9);
  background: linear-gradient(135deg, #ef4444, #fb923c);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.45);
  cursor: pointer;
  line-height: 1.2;
  vertical-align: middle;
  text-align: center;
  min-height: 44px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    background var(--transition-med),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #f97316);
  border-color: rgba(129, 140, 248, 0.75);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.8);
}

.full-w {
  width: 100%;
}

/* Fokus sichtbar & barrierefrei */

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ring-color);
  outline-offset: 2px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
  color: var(--text-main);
  display: block;
  line-height: 1.3;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  font-size: 0.94rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(148, 163, 184, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.65);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.95));
}

/* Sicherheit: Inputs/Buttons nie breiter als Container */
input,
select,
textarea,
button {
  max-width: 100%;
}

/* ==========================================================================
   Tables + „Stacking“ auf Mobile
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  text-align: left;
}

th {
  font-weight: 500;
  color: var(--text-soft);
}

.right {
  text-align: right;
}

.muted {
  opacity: 0.8;
  color: var(--text-soft);
}

.tag {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
}

/* Stack-Table für Mobile */

.stack-table thead {
  display: table-header-group;
}

@media (max-width: 740px) {
  .stack-table thead {
    display: none;
  }

  .stack-table,
  .stack-table tbody,
  .stack-table tr,
  .stack-table td {
    display: block;
    width: 100%;
  }

  .stack-table tr {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 10px;
    margin: 10px 0;
    background: var(--bg-elevated);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.8);
  }

  .stack-table td {
    display: block;
    padding: 6px 0;
    border: none;
    text-align: left;
  }

  .stack-table td::before {
    display: block;
    content: attr(data-label);
    font-weight: 600;
    margin: 0 0 4px;
    opacity: 0.9;
    color: var(--text-main);
  }

  .stack-table td input,
  .stack-table td select,
  .stack-table td textarea {
    width: 100%;
  }

  .stack-table td.muted {
    text-align: right;
  }
}

/* ==========================================================================
   Layout-Helper (Flex / Grid)
   ========================================================================== */

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

.space-between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* 4-Spalten Grid */

.grid-4 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-4 .grid-2 {
    grid-column: auto !important;
  }

  .grid .btn {
    width: 100%;
  }

  .card,
  .day-card {
    padding: 12px;
  }

  .flex.space-between {
    flex-wrap: wrap;
    gap: 8px;
  }

  .flex.space-between > * {
    flex: 1 1 100%;
  }
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Navigation – responsive / einklappbar
   ========================================================================== */

header nav {
  display: grid;
  gap: 8px;
  grid-auto-flow: column;
  padding: 0;
}

/* Desktop: Navigation immer sichtbar, Toggle verborgen */

@media (min-width: 641px) {
  .nav-toggle {
    display: none;
  }

  header nav {
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Mobile: einklappbar, Buttons full-width */

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex;
    width: 100%;
    margin: 8px 0;
  }

  header nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
  }

  header nav.open {
    max-height: 600px;
  }

  header nav .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Stat Box / Badges
   ========================================================================== */

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.05), rgba(15, 23, 42, 0.98));
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.badge.pos {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(22, 163, 74, 0.7);
  color: #bbf7d0;
}

.badge.neg {
  background: rgba(185, 28, 28, 0.16);
  border-color: rgba(220, 38, 38, 0.75);
  color: #fecaca;
}

/* ==========================================================================
   Charts
   ========================================================================== */

.chart-wrap {
  position: relative;
  height: 260px;
  min-height: 180px;
  max-height: 50vh;
  border-radius: var(--radius-lg);
  padding: 10px;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  border-radius: var(--radius-md);
}

@media (max-width: 640px) {
  .chart-wrap {
    height: 220px;
  }
}

/* ==========================================================================
   Wizard Styles
   ========================================================================== */

#ex-wizard {
  margin-bottom: 12px;
}

.ex-step {
  display: none;
}

.ex-step .ex-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 4px 0 10px;
}

.ex-step .form-row {
  margin: 10px 0;
}

.wizard-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.wizard-nav .btn {
  width: 100%;
}

.wizard-progress {
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
  font-weight: 600;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

/* Wizard auf Mobile: Progress nach oben */

@media (max-width: 640px) {
  .wizard-nav {
    grid-template-columns: 1fr;
  }

  .wizard-progress {
    order: -1;
  }
}

/* Header-Animation für ein-/ausblenden */
header {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.grid + .btn {
  margin-top: 10px;
  margin-bottom: 10px;
}


.empty-hint {
    margin-top: 12px;   /* oder 16px oder 20px – wie du willst */
    display: block;
}

.delete-btn {
    background: #4a0c0c;
    color: #ffb3b3;
    border: 1px solid #a11d1d;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.15s;
}

.delete-btn:hover {
    background: #a11d1d;
    color: white;
}


/* Footer-Typografie auf Mobile etwas kleiner */
@media (max-width: 640px) {
  footer {
    font-size: 0.55rem; /* oder 0.78rem, je nach Geschmack */
  }

  /* falls du ganz sicher gehen willst, dass alles im Footer kleiner wird: */
  footer p,
  footer a,
  footer .muted,
  footer .tag {
    font-size: 0.55rem;
  }
}
