/* ============================================================
   base.css – CSS-Variablen, Reset, Typografie, Formulare, Buttons
   ============================================================ */

:root {
  --bg-base:        #0d0f12;
  --bg-surface:     #13161b;
  --bg-elevated:    #1a1e26;
  --bg-sidebar:     #0a0c0f;
  --border:         #252a33;
  --border-bright:  #303847;

  --accent:         #e8f04a;
  --accent-dim:     rgba(232, 240, 74, 0.12);
  --accent-glow:    rgba(232, 240, 74, 0.3);

  --text-primary:   #eef0f5;
  --text-secondary: #7a8499;
  --text-muted:     #6b7b8e;

  --success:  #4af097;
  --error:    #f04a4a;
  --warning:  #f0a44a;
  --info:     #4ab4f0;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --sidebar-width:  240px;
  --topbar-height:  60px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --transition:   all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Globaler Seiten-Scrollbar (rechter Bildschirmrand) */
  --scrollbar-thumb: rgba(232, 240, 74, 0.42);
  --scrollbar-thumb-start: rgba(232, 240, 74, 0.58);
  --scrollbar-thumb-end: rgba(232, 240, 74, 0.30);
  --scrollbar-thumb-start-hover: rgba(232, 240, 74, 0.82);
  --scrollbar-thumb-end-hover: rgba(232, 240, 74, 0.50);
}

/* ============================================================
   LIGHT THEME – überschreibt alle CSS-Variablen
   Wird via body.light-theme aktiviert
   ============================================================ */
body.light-theme {
  --bg-base:        #f0f2f5;
  --bg-surface:     #ffffff;
  --bg-elevated:    #e8eaee;
  --bg-sidebar:     #e2e5eb;
  --border:         #d0d4dc;
  --border-bright:  #b8bfcc;

  --accent:         #6b7700;        /* Dunkles Olivgrün – guter Kontrast als Text UND Button */
  --accent-dim:     rgba(107,119,0,0.12);
  --accent-glow:    rgba(107,119,0,0.3);

  --text-primary:   #111318;
  --text-secondary: #4a5568;
  --text-muted:     #8a95a8;

  --success:  #1a7a4a;
  --error:    #c0392b;
  --warning:  #b7720a;
  --info:     #1a6fa8;

  /* Globaler Seiten-Scrollbar (rechter Bildschirmrand) */
  --scrollbar-thumb: rgba(104, 116, 141, 0.55);
  --scrollbar-thumb-start: rgba(104, 116, 141, 0.68);
  --scrollbar-thumb-end: rgba(104, 116, 141, 0.36);
  --scrollbar-thumb-start-hover: rgba(84, 94, 116, 0.88);
  --scrollbar-thumb-end-hover: rgba(84, 94, 116, 0.48);
}

/* Hintergrund-Gradient im Light-Mode */
body.light-theme::before {
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(107,119,0,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(26,111,168,0.04) 0%, transparent 50%);
}

/* Result-Total im Light-Mode: Akzentfarbe (Gelb) bleibt */
body.light-theme .result-total {
  color: var(--accent);
}

/* Button im Light-Mode: Olive + weißer Text */
body.light-theme .btn-primary {
  background: var(--accent);
  color: #ffffff;
}
body.light-theme .btn-primary:hover {
  background: #7d8e00;
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* result-card im Light: kein Gradient, reines Weiß */
body.light-theme .result-card {
  background: #ffffff;
}

/* Badges im Light-Mode etwas kräftiger */
body.light-theme .badge-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-glow);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Globaler Scrollbar für die Seite (rechter Rand) – angepasst an das UI. */
html {
  font-size: 15px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
html::-webkit-scrollbar {
  width: 10px;
}
html::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  background: linear-gradient(180deg, var(--scrollbar-thumb-start), var(--scrollbar-thumb-end));
}
html::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-start-hover), var(--scrollbar-thumb-end-hover));
}
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(232,240,74,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(74,149,240,0.03) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* ---- Utility ---- */
.hidden  { display: none !important; }
.mt-1   { margin-top: 1rem; }
.mt-half { margin-top: 0.5rem; }

/* ---- Divider ---- */
.divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); letter-spacing: 0.01em;
}
.form-group small { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* ---- Sprachwahl ----
   Einheitlicher Stil für Startseite, Login/Registrierung und Einstellungen. */
.language-select {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}
.language-select select {
  width: auto;
  min-width: 120px;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
}
.language-select--compact {
  padding: 0.25rem 0.3rem 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.login-language-select {
  margin-bottom: 0.2rem;
}

.form-checkbox { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) {
  .form-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .form-row--3 { grid-template-columns: 1fr; }
  .form-row--4 { grid-template-columns: 1fr; }
}

.label-with-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.info-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--info);
  cursor: help;
  transition: var(--transition);
}

.info-icon-button:hover,
.info-icon-button:focus-visible {
  border-color: var(--info);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(74, 180, 240, 0.12);
}

.info-icon-button svg,
.info-icon-button i {
  width: 0.8rem;
  height: 0.8rem;
}

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper svg {
  position: absolute; left: 0.9rem;
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.input-wrapper input { padding-left: 2.5rem !important; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="tel"], input[type="date"], textarea, select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}
/* Browser-eigene Search-Deko deaktivieren, damit die UI überall identisch bleibt. */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* Datumsfelder nutzen dieselbe Formsprache wie Textfelder.
   Das native Kalender-Popup bleibt erhalten, nur die Oberfläche passt zum UI. */
input[type="date"] {
  min-height: 2.55rem;
  color-scheme: dark;
}
body.light-theme input[type="date"] {
  color-scheme: light;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.72;
  filter: invert(88%) sepia(78%) saturate(612%) hue-rotate(14deg) brightness(103%) contrast(91%);
}
body.light-theme input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(30%) sepia(32%) saturate(1110%) hue-rotate(30deg) brightness(92%) contrast(92%);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8499' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
.input-with-hint { position: relative; }
.input-with-hint input { width: 100%; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent); color: #0d0f12;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: 700; font-size: 0.875rem;
  cursor: pointer; transition: var(--transition); width: 100%;
}
.btn-primary:hover { background: #f0fa5a; box-shadow: 0 4px 20px var(--accent-glow); transform: translateY(-1px); }
.btn-primary svg, .btn-primary i { width: 16px; height: 16px; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-bright); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem;
  cursor: pointer; transition: var(--transition); width: 100%;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-secondary svg, .btn-secondary i { width: 15px; height: 15px; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(240,74,74,0.1); color: var(--error);
  border: 1px solid rgba(240,74,74,0.25); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem;
  cursor: pointer; transition: var(--transition); width: 100%;
}
.btn-danger:hover { background: rgba(240,74,74,0.2); }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-danger-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: none; color: var(--error);
  border: 1px solid rgba(240,74,74,0.4); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem;
  cursor: pointer; transition: var(--transition); width: 100%;
}
.btn-danger-outline:hover { background: rgba(240,74,74,0.08); border-color: var(--error); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: none; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 500; font-size: 0.875rem;
  cursor: pointer; transition: var(--transition);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-bright); }

.btn-icon {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: 0.4rem; border-radius: var(--radius-sm);
  display: flex; align-items: center; transition: var(--transition);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-elevated); }
.btn-icon svg, .btn-icon i { width: 18px; height: 18px; }

.btn-reset {
  background: none; border: 1px dashed var(--border-bright);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.75rem; padding: 0.45rem 0.75rem;
  cursor: pointer; width: 100%; transition: var(--transition); font-family: var(--font-body);
}
.btn-reset:hover { color: var(--warning); border-color: var(--warning); background: rgba(240,164,74,0.06); }

/* Kleine Buttons für Karten-Aktionen */
.btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); flex: 1;
}
.btn-sm svg, .btn-sm i { width: 13px; height: 13px; }
.btn-sm-primary { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(232,240,74,0.2); }
.btn-sm-primary:hover { background: rgba(232,240,74,0.2); }
.btn-sm-danger  { background: rgba(240,74,74,0.08); color: var(--error); border: 1px solid rgba(240,74,74,0.2); }
.btn-sm-danger:hover  { background: rgba(240,74,74,0.15); }
.btn-sm-info    { background: rgba(74,180,240,0.1); color: var(--info); border: 1px solid rgba(74,180,240,0.2); }
.btn-sm-info:hover    { background: rgba(74,180,240,0.18); }
.btn-sm-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-sm-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--bg-surface); border: 1px solid var(--success);
  border-radius: var(--radius-sm); padding: 0.75rem 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--success); font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); z-index: 9999;
  animation: slideInRight 0.3s ease;
}
.toast svg { width: 16px; height: 16px; }
@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: var(--bg-surface); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
}
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }

/* ---- Cards ---- */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-bright); }
.card-title {
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.5rem;
}
.card-title svg, .card-title i { width: 15px; height: 15px; color: var(--accent); }
.card-subtitle {
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.card-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

/* ---- Animations ---- */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   SETTINGS – Link-Karte (klickbar, verweist auf Unterseite)
   ============================================================ */
.settings-link-card {
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border) !important;
}
.settings-link-card:hover {
  border-color: var(--accent) !important;
  background: var(--bg-elevated);
}
.settings-link-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.settings-link-inner svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: var(--transition);
}
.settings-link-card:hover .settings-link-inner svg {
  color: var(--accent);
  transform: translateX(3px);
}

/* ============================================================
   SETTINGS – breites Grid für Material-Unterseite
   (Liste links, Formular rechts – auf breiten Screens nebeneinander)
   ============================================================ */
.settings-grid--wide {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) {
  .settings-grid--wide { grid-template-columns: 1fr; }
}

/* ============================================================
   ZURÜCK-BUTTON (Material-Unterseiten)
   ============================================================ */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 1.25rem;
  transition: var(--transition);
}
.btn-back:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   SIDEBAR – Sub-Navigation (eingerückte Unterpunkte)
   Vertikale Linie zeigt Hierarchie, kleinere Schrift, gedimmt
   ============================================================ */
.nav-item--sub {
  padding-left: 1.25rem;
  margin-left: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.nav-item--sub i,
.nav-item--sub [data-lucide],
.nav-item--sub svg {
  width: 13px !important;
  height: 13px !important;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-item--sub:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}
.nav-item--sub.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  border-top: 1px solid rgba(232,240,74,0.15);
  border-bottom: 1px solid rgba(232,240,74,0.15);
  border-right: 1px solid rgba(232,240,74,0.15);
}
/* active::before von .nav-item ausblenden bei sub-items (eigene Linie links) */
.nav-item--sub.active::before { display: none; }

/* ============================================================
   THEME TOGGLE – Dark / Light Auswahl in Einstellungen
   ============================================================ */
.theme-toggle-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Verstecktes Radio-Input */
.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

/* Klickbare Kachel */
.theme-option {
  flex: 1;
  cursor: pointer;
}
.theme-option-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  transition: var(--transition);
  text-align: center;
}
.theme-option-inner svg {
  color: var(--text-muted);
  transition: var(--transition);
}
.theme-option-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.theme-option-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Hover */
.theme-option:hover .theme-option-inner {
  border-color: var(--border-bright);
  background: var(--bg-elevated);
}

/* Aktiv / Ausgewählt */
.theme-option input[type="radio"]:checked + .theme-option-inner {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.theme-option input[type="radio"]:checked + .theme-option-inner svg,
.theme-option input[type="radio"]:checked + .theme-option-inner .theme-option-label {
  color: var(--accent);
}

/* ============================================================
   TEXTAREA – für Impressum, AGB etc.
   ============================================================ */
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
textarea::placeholder { color: var(--text-muted); }
