/* VARIABLES FROM STARTSEITE.HTML */
:root {
  --bg: #0b0d10;
  --panel: #141820;
  --text: #e8ecf1;
  --muted: #a7b0bd;
  --line: #263044;
  --accent: #5aa8ff;
  --green-bg: #103d1d;
  --green-bd: #2fbf71;
  --red-bg: #3b1216;
  --red-bd: #ff6b6b;
  --yellow-bg: #3d340f;
  --yellow-bd: #ffd166;
  --primary: var(--accent); /* Added for compatibility */
  --danger: var(--red-bd); /* Added for compatibility */
  --success: var(--green-bd); /* Added for compatibility */
}

/* GENERAL STYLES FROM STARTSEITE.HTML */
* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(20, 24, 32, 0.98), rgba(20, 24, 32, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(120%) blur(6px);
}

.toolbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar .title {
  font-weight: 600;
  letter-spacing: .2px;
}

.spacer {
  flex: 1
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f131a;
  color: var(--text);
  cursor: pointer;
  transition: .15s background, .15s transform;
  text-decoration: none;
  font-size: 14px;
}

.btn:hover {
  background: #0c1017
}

.btn:active {
  transform: translateY(1px)
}

main {
  max-width: 1200px;
  margin: 16px auto 40px;
  padding: 0 16px
}

/* STYLES FOR FORMS, ADAPTED FROM OLD LAYOUT.CSS */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 650px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

h1 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 22px;
  text-align: center;
  font-weight: 600;
}

.input-group { margin-bottom: 16px; }

.input-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

input, select {
  width: 100%;
  background: #0b0d10;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  transition: border-color .15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.actions .btn {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  font-weight: 600;
}

.actions .btn:hover {
    background: #4a90e2;
}

.error-message {
    color: #ffb3b3;
    background: rgba(59, 18, 22, 0.5);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--red-bd);
    margin-bottom: 20px;
    text-align: center;
}

.success-message {
    color: #b3ffcc;
    background: rgba(16, 61, 29, 0.5);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--green-bd);
    margin-bottom: 20px;
    text-align: center;
}

.sub-links {
    margin-top: 24px;
    text-align: center;
}
.sub-links a { color: var(--accent); text-decoration: none; font-size: 14px; }
.sub-links a:hover { text-decoration: underline; }

body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px;
}

.login-form {
    width: 100%;
    max-width: 400px;
}

/* TIMETABLE SPECIFIC STYLES FROM STARTSEITE.HTML */
.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0f131a;
  color: var(--muted);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%
}
.dot.green {
  background: var(--green-bd)
}
.dot.red {
  background: var(--red-bd)
}
.dot.yellow {
  background: var(--yellow-bd)
}
.weekbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0 16px 0;
  color: var(--muted);
}
.weekbar .range {
  font-weight: 600;
  color: var(--text)
}
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
}
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(4, 1fr)
  }
}
@media (max-width: 720px) {
  .grid {
    grid-template-columns: repeat(2, 1fr)
  }
}
@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr
  }
}
.day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}
.day header {
  position: static;
  background: transparent;
  border: none;
  backdrop-filter: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.day .weekday {
  font-weight: 700
}
.day .date {
  color: var(--muted);
  font-size: 13px
}
.events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px
}
.event {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #101622;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.event .summary {
  font-weight: 600
}
.event .meta {
  color: var(--muted);
  font-size: 13px
}
.event .location {
  color: #b7c3d4;
  font-size: 13px
}
.event .label {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  color: var(--muted);
  background: #0f131a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}
.event.neu {
  background: var(--green-bg);
  border-color: var(--green-bd);
  box-shadow: 0 0 0 1px color-mix(in hsl, var(--green-bd), transparent 70%);
}
.event.geloescht {
  background: var(--red-bg);
  border-color: var(--red-bd);
  opacity: 0.95;
}
.event.geloescht .content {
  text-decoration: line-through;
  color: #ffb3b3;
}
.event.geaendert {
  background: var(--yellow-bg);
  border-color: var(--yellow-bd);
}
.changes {
  margin-top: 4px;
  font-size: 13px;
  color: #ffe8a3;
}
.changes del {
  color: #f7c37a;
}
.arrow {
  font-size: 18px;
  line-height: 1
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #0e1219;
}
.changes-list {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.changes-list h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
}
.changes-list .item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.changes-list .item:first-child {
  border-top: none;
}
.changes-list .meta {
  color: var(--muted);
  font-size: 13px;
}
.label-chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
  background: #0f131a;
  margin-left: 8px;
}
.label-chip.neu {
  border-color: var(--green-bd);
  color: var(--green-bd);
}
.label-chip.geaendert {
  border-color: var(--yellow-bd);
  color: var(--yellow-bd);
}
.label-chip.geloescht {
  border-color: var(--red-bd);
  color: var(--red-bd);
}
.mark-read {
  justify-self: end;
  align-self: start;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f131a;
  color: var(--text);
  cursor: pointer;
}
.mark-read:hover {
  background: #0c1017;
}
.event .actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.event .actions .mark-read {
  padding: 6px 10px;
  font-size: 12px;
}

/* BLUE/SPECIAL EVENT STYLES */
:root {
  --blue-bg: #10253d;
  --blue-bd: #5ab3ff;
}

.event.special {
  background: var(--blue-bg);
  border-color: var(--blue-bd);
  box-shadow: 0 0 0 1px color-mix(in hsl, var(--blue-bd), transparent 70%);
}

.dot.blue {
  background: var(--blue-bd);
}

/* LAYOUT FOR TIMETABLE WITH SIDEBAR */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.main-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* SIDEBAR FOR EXAMS */
.exam-list {
  position: sticky;
  top: 90px;
}

.exam-list h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

.exam-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font-size: 14px;
}

.exam-item:first-child {
  border-top: none;
}

.exam-item .summary {
  font-weight: 600;
  color: var(--blue-bd);
}

.exam-item .meta {
  color: var(--muted);
  font-size: 13px;
}