/* ===== VVTPro — Design System ===== */
:root {
  --primaer: #1a4b7c;
  --primaer-dunkel: #0f2d4a;
  --akzent: #2563eb;
  --akzent-hell: #eff6ff;
  --akzent-rand: #bfdbfe;
  --success: #16a34a;
  --success-hell: #f0fdf4;
  --warning: #d97706;
  --warning-hell: #fffbeb;
  --danger: #dc2626;
  --danger-hell: #fef2f2;
  --text: #111827;
  --text-sekundaer: #6b7280;
  --rand: #e5e7eb;
  --grau-hell: #f9fafb;
  --grau: #f3f4f6;
  --weiss: #ffffff;
  --schatten: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --schatten-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --schatten-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--grau-hell);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--primaer);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
  color: white;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  color: #93c5fd;
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #bfdbfe;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.sidebar-nav a:hover,
.sidebar-nav a.aktiv {
  background: rgba(255,255,255,0.12);
  color: white;
}

.sidebar-nav a.aktiv {
  background: rgba(255,255,255,0.15);
}

.sidebar-nav .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-praxis {
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.sidebar-praxis .praxis-name {
  color: white;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-praxis .praxis-typ {
  color: #93c5fd;
  font-size: 11px;
  margin-top: 1px;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  color: #93c5fd;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

.page-header {
  background: white;
  border-bottom: 1px solid var(--rand);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.page-header p {
  font-size: 13px;
  color: var(--text-sekundaer);
  margin-top: 2px;
}

.page-body {
  padding: 28px 32px;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rand);
  box-shadow: var(--schatten);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rand);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 20px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rand);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blau { background: var(--akzent-hell); }
.stat-icon.gruen { background: var(--success-hell); }
.stat-icon.orange { background: var(--warning-hell); }
.stat-icon.rot { background: var(--danger-hell); }

.stat-wert {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-sekundaer);
  margin-top: 4px;
}

/* ===== TABELLE ===== */
.tabelle {
  width: 100%;
  border-collapse: collapse;
}

.tabelle th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sekundaer);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--grau);
  border-bottom: 1px solid var(--rand);
}

.tabelle th:first-child { border-radius: var(--radius) 0 0 0; }
.tabelle th:last-child { border-radius: 0 var(--radius) 0 0; }

.tabelle td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rand);
  font-size: 13.5px;
  vertical-align: middle;
}

.tabelle tr:last-child td { border-bottom: none; }
.tabelle tr:hover td { background: var(--grau-hell); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-gruen { background: var(--success-hell); color: var(--success); }
.badge-orange { background: var(--warning-hell); color: var(--warning); }
.badge-rot { background: var(--danger-hell); color: var(--danger); }
.badge-blau { background: var(--akzent-hell); color: var(--akzent); }
.badge-grau { background: var(--grau); color: var(--text-sekundaer); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primaer {
  background: var(--akzent);
  color: white;
}
.btn-primaer:hover:not(:disabled) { background: #1d4ed8; }

.btn-sekundaer {
  background: white;
  color: var(--text);
  border: 1px solid var(--rand);
}
.btn-sekundaer:hover:not(:disabled) { background: var(--grau); }

.btn-danger {
  background: var(--danger-hell);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-success {
  background: var(--success-hell);
  color: var(--success);
  border: 1px solid #bbf7d0;
}
.btn-success:hover:not(:disabled) { background: #dcfce7; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===== FORMULARE ===== */
.form-gruppe {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .pflicht {
  color: var(--danger);
  margin-left: 2px;
}

.form-label .hilfe {
  font-weight: 400;
  color: var(--text-sekundaer);
  font-size: 12px;
  margin-left: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hinweis {
  font-size: 11.5px;
  color: var(--text-sekundaer);
  margin-top: 4px;
}

/* Tags-Input */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: white;
  min-height: 44px;
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tags-container:focus-within {
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--akzent-hell);
  color: var(--akzent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tag-remove {
  cursor: pointer;
  color: var(--akzent);
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
}

.tag-remove:hover { color: var(--danger); }

.tag-input {
  border: none;
  outline: none;
  font-size: 13px;
  min-width: 120px;
  flex: 1;
  font-family: inherit;
  padding: 2px 4px;
}

/* Chips für Schnellauswahl */
.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--rand);
  background: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-sekundaer);
}

.chip:hover { border-color: var(--akzent); color: var(--akzent); background: var(--akzent-hell); }
.chip.aktiv { border-color: var(--akzent); color: var(--akzent); background: var(--akzent-hell); font-weight: 600; }

/* Toggle */
.toggle-gruppe {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--grau-hell);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--akzent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Empfänger-Liste */
.empfaenger-liste { display: flex; flex-direction: column; gap: 8px; }

.empfaenger-item {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 36px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--grau-hell);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
}

/* ===== WIZARD ===== */
.wizard-container {
  max-width: 780px;
  margin: 0 auto;
}

.wizard-schritte {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rand);
  padding: 20px 24px;
  overflow-x: auto;
}

.schritt-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.schritt-kreis {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--grau);
  color: var(--text-sekundaer);
  border: 2px solid var(--rand);
  transition: all 0.2s;
  flex-shrink: 0;
}

.schritt-info {
  margin-left: 10px;
  flex-shrink: 0;
}

.schritt-label {
  font-size: 11px;
  color: var(--text-sekundaer);
  font-weight: 500;
}

.schritt-titel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sekundaer);
}

.schritt-linie {
  flex: 1;
  height: 2px;
  background: var(--rand);
  margin: 0 12px;
  min-width: 20px;
}

/* Wizard Zustände */
.schritt-item.aktiv .schritt-kreis {
  background: var(--akzent);
  color: white;
  border-color: var(--akzent);
}

.schritt-item.aktiv .schritt-titel,
.schritt-item.aktiv .schritt-label { color: var(--akzent); }

.schritt-item.fertig .schritt-kreis {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.schritt-item.fertig .schritt-linie { background: var(--success); }

.wizard-schritt { display: none; }
.wizard-schritt.aktiv { display: block; }

.wizard-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rand);
}

/* ===== WARNBOXEN ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-blau { background: var(--akzent-hell); color: #1e40af; border: 1px solid var(--akzent-rand); }
.alert-orange { background: var(--warning-hell); color: #92400e; border: 1px solid #fcd34d; }
.alert-rot { background: var(--danger-hell); color: #991b1b; border: 1px solid #fca5a5; }
.alert-gruen { background: var(--success-hell); color: #166534; border: 1px solid #86efac; }

/* ===== LOGIN SEITE ===== */
.login-seite {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a4b7c 0%, #1e40af 50%, #1d4ed8 100%);
  padding: 24px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primaer);
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-sekundaer);
  font-size: 13px;
  margin-top: 4px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-sekundaer);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rand);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--schatten-lg);
  transform: translateY(16px);
  transition: transform 0.2s;
}

.modal-overlay.offen .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--rand);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: none;
  background: var(--grau);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sekundaer);
}

.modal-close:hover { background: var(--rand); }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--rand); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--schatten-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--akzent); color: white; }

/* ===== LEER-ZUSTAND ===== */
.leer-zustand {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-sekundaer);
}

.leer-zustand .leer-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.leer-zustand h3 { font-size: 16px; color: var(--text); margin-bottom: 8px; }
.leer-zustand p { font-size: 13px; margin-bottom: 20px; }

/* ===== LOADING ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--rand);
  border-top-color: var(--akzent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ladebalken {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--akzent);
  z-index: 9999;
  transition: width 0.3s;
}

/* ===== VORLAGEN-AUSWAHL ===== */
.vorlagen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.vorlage-karte {
  padding: 16px;
  border: 2px solid var(--rand);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.vorlage-karte:hover { border-color: var(--akzent); background: var(--akzent-hell); }
.vorlage-karte.ausgewaehlt { border-color: var(--akzent); background: var(--akzent-hell); }

.vorlage-icon { font-size: 24px; margin-bottom: 8px; }
.vorlage-titel { font-size: 13px; font-weight: 600; color: var(--text); }
.vorlage-beschreibung { font-size: 12px; color: var(--text-sekundaer); margin-top: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
}

/* ===== DIVERSES ===== */
.trennlinie { height: 1px; background: var(--rand); margin: 20px 0; }
.text-sekundaer { color: var(--text-sekundaer); }
.text-klein { font-size: 12px; }
.fett { font-weight: 600; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }
.volle-breite { width: 100%; }

.hinweis-box {
  background: var(--akzent-hell);
  border: 1px solid var(--akzent-rand);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12.5px;
  color: #1e40af;
  margin-bottom: 16px;
}

.besondere-warnung {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12.5px;
  color: #92400e;
  margin-top: 12px;
}
