/* ==========================================================================
   DESIGN TOKENS
   Palette inspired by a calm study desk: paper-warm light mode,
   ink-blue dark mode, single coral accent for focus/highlight states.
   ========================================================================== */
:root {
  --accent: #e8743b;        /* coral — used sparingly for highlights/CTAs */
  --accent-soft: #f3a07a;
  --success: #4caf78;
  --danger: #e25c5c;

  /* Light mode */
  --bg: #f4f1ea;
  --bg-grad-a: #f4f1ea;
  --bg-grad-b: #e7e0d2;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-solid: #ffffff;
  --border: rgba(40, 35, 25, 0.10);
  --text: #2c2620;
  --text-muted: #6f6657;
  --shadow: 0 8px 30px rgba(60, 50, 30, 0.10);
}

[data-theme="dark"] {
  --bg: #14161c;
  --bg-grad-a: #14161c;
  --bg-grad-b: #1d2230;
  --surface: rgba(30, 33, 44, 0.55);
  --surface-solid: #1c1f29;
  --border: rgba(255, 255, 255, 0.08);
  --text: #ecebe6;
  --text-muted: #9a9cab;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
  color: var(--text);
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4 { margin: 0; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 1.4rem; }
.brand h1 { font-size: 1.25rem; letter-spacing: 0.02em; font-weight: 600; }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.theme-toggle:hover { transform: scale(1.08); }

/* ==========================================================================
   LAYOUT — main (school) ~65% / sidebar (life) ~35%
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 24px;
  padding: 28px 32px 10px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.area-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.main-area, .side-area {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   GLASSMORPHIC CARDS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 22px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subcategory-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 14px 0 8px;
}
.subcategory-title:first-of-type { margin-top: 0; }

/* ==========================================================================
   CLOCK
   ========================================================================== */
.clock-card { text-align: center; }
.clock {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.date-display {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 1rem;
  text-transform: capitalize;
}

/* ==========================================================================
   TIMETABLE
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.timetable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.timetable th, .timetable td {
  padding: 9px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.timetable th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timetable td.hour-cell {
  color: var(--text-muted);
  font-weight: 600;
}
.timetable td.active-class {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}

/* ==========================================================================
   FORMS / BUTTONS / MISC TEXT
   ========================================================================== */
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.inline-form input {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 0.9rem;
}
.inline-form input:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border);
}

.hint-text { font-size: 0.76rem; color: var(--text-muted); margin: 10px 0 0; }

/* ==========================================================================
   LISTS — exams / homework / appointments / life todos
   ========================================================================== */
.exam-list, .todo-list, .appointment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-list li, .appointment-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.exam-countdown-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.exam-countdown-badge.urgent { background: var(--danger); }

.delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  margin-left: 10px;
  line-height: 1;
}
.delete-btn:hover { color: var(--danger); }

.todo-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
}
.todo-list li input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.todo-list li span { flex: 1; }
.todo-list li.completed span { text-decoration: line-through; color: var(--text-muted); }

.empty-state { color: var(--text-muted); font-size: 0.86rem; font-style: italic; }

/* ==========================================================================
   TIMER / REUSABLE LAYOUTS
   ========================================================================== */
.pomodoro { text-align: center; }
.pomodoro-mode {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pomodoro-display {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.pomodoro-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   CALENDAR
   ========================================================================== */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.calendar-month-label {
  font-weight: 700;
  flex: 1;
  text-align: center;
  text-transform: capitalize;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  padding-bottom: 4px;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.84rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  position: relative;
}
.calendar-day.empty { background: transparent; border: none; }
.calendar-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.calendar-day.holiday { background: rgba(232, 116, 59, 0.18); border-color: var(--accent-soft); }
.calendar-day .marker-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--success);
  position: absolute;
  bottom: 5px;
}
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-today { background: var(--accent); }
.dot-holiday { background: var(--accent-soft); }
.dot-appointment { background: var(--success); }

/* ==========================================================================
   QUOTE / MOTIVATION
   ========================================================================== */
.quote-card { text-align: center; }
.quote-text {
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
  color: var(--text);
}

/* ==========================================================================
   SAVINGS & PROGRESS TRACKER
   ========================================================================== */
.savings-info { font-size: 1rem; font-weight: 600; margin-bottom: 10px; }
.progress-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width 0.5s ease;
}
.savings-goal-name { font-size: 0.82rem; color: var(--text-muted); margin: 8px 0 14px; }
.savings-form input { max-width: 110px; }

/* ==========================================================================
   BOOKMARKS
   ========================================================================== */
.bookmark-grid { 
  display: flex; 
  flex-direction: column; /* Ordnet die Links sauber untereinander an */
  gap: 10px; /* Sorgt für einen angenehmen Abstand zwischen den Buttons */
}

.bookmark-chip {
  text-decoration: none;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 12px; /* Wirkt moderner und weniger wie eine Pille */
  padding: 12px 16px; /* Etwas mehr Höhe für ein besseres Klickgefühl */
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease; /* Weicherer Übergang für Hover-Effekte */
  display: block; /* Zwingt den Button auf die volle Breite */
  text-align: center; /* Zentriert den Text (kannst du auf 'left' setzen, falls gewünscht) */
}

.bookmark-chip:hover { 
  background: var(--accent); 
  color: #fff; 
  transform: translateY(-2px); /* Hebt den Button beim Drüberfahren leicht an */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1); /* Fügt einen sanften Schatten hinzu */
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 20px; }
  .topbar { padding: 14px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ==========================================================================
   TASCHENRECHNER
   ========================================================================== */
.calc-display {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.6rem;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-buttons .btn {
  padding: 14px 10px;
  font-size: 1.1rem;
}

/* ==========================================================================
   GLOBALE WARNMELDUNGEN (BANNERS)
   ========================================================================== */
.global-alerts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 32px 0;
  max-width: 1400px;
  margin: 0 auto;
}

.alert-banner {
  background-color: var(--danger);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 14px 24px;
  border-radius: 12px;
  width: 100%;
  text-align: center;
  box-shadow: 0 6px 20px rgba(226, 92, 92, 0.35);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   QUICK NOTES
   ========================================================================== */
#quickNotesArea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 90px;
  transition: outline 0.2s ease;
}
#quickNotesArea:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

/* ==========================================================================
   STUNDENPLAN ERWEITERUNG (Fächer & Räume)
   ========================================================================== */
.timetable td {
  vertical-align: middle;
}
.timetable .fach {
  font-weight: 600;
  font-size: 0.95em;
}
.timetable .raum {
  font-size: 0.75em;
  color: var(--text-muted);
  margin-top: 3px;
}
.timetable td.active-class .raum {
  color: rgba(255, 255, 255, 0.85); /* Damit der Raum im aktiven (farbigen) Block lesbar bleibt */
}

/* ==========================================================================
   FORMELSAMMLUNG / SPICKZETTEL
   ========================================================================== */
.formula-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}
.formula-item {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 35px 12px 14px; /* Rechts Platz für den Löschen-Button */
  position: relative;
}
.formula-item-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.formula-item-content {
  font-size: 1.05rem;
  color: var(--text);
  font-family: 'Courier New', Courier, monospace; /* Gut lesbar für Mathe/Regeln */
  white-space: pre-wrap; /* Damit Zeilenumbrüche erhalten bleiben */
  font-weight: 600;
}
.formula-item .delete-btn {
  position: absolute;
  top: 12px;
  right: 10px;
  margin-left: 0;
}
.banner-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
  overflow: hidden;
}
.banner-progress-fill {
  height: 100%;
  background: #fff;
  transition: width 1s linear;
}

.vocab-card-box {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.vocab-card-box:hover { transform: translateY(-2px); }
.vocab-card-front { font-size: 1.4rem; font-weight: 700; }
.vocab-card-back { font-size: 1.15rem; color: var(--accent); margin-top: 10px; }
.weather-forecast {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.weather-forecast-day { flex: 1; text-align: center; font-size: 0.78rem; color: var(--text-muted); }
.weather-forecast-day .wf-label { font-weight: 700; text-transform: capitalize; margin-bottom: 4px; }
.weather-forecast-day .wf-icon { font-size: 1.3rem; margin-bottom: 2px; }
.weather-forecast-day .wf-max { color: var(--text); font-weight: 600; }
.weather-forecast-day .wf-min { color: var(--text-muted); }
/* Keine einsame Klammer mehr hier drunter! */