/* ================================
   Waldis – Custom Styles (Bootstrap 5 Edition)
   Minimal custom CSS - maximale Bootstrap-Nutzung
   ================================ */

/* ---------- Custom CSS Variables (Bootstrap-kompatibel) ---------- */
:root {
  --bs-success-rgb: 47, 133, 90;
  --bs-primary: #81c784 !important; /* Pastelliges Grün für Light Theme */
  --bs-primary-rgb: 129, 199, 132 !important;
  --bs-link-color: #4caf50 !important; /* Dunkleres Grün für Links in Light Theme */
  --bs-link-color-rgb: 76, 175, 80 !important;
}

[data-bs-theme="dark"] {
  --bs-primary: #1565c0 !important; /* Dunkles Blau für Dark Theme */
  --bs-primary-rgb: 21, 101, 192 !important;
  --bs-success-rgb: 76, 175, 80 !important;
  --bs-link-color: #90caf9 !important; /* Helleres Blau für Links in Dark Theme */
  --bs-link-color-rgb: 144, 202, 249 !important;
}

/* Button-Farben für Theme-Konsistenz */
.btn-primary {
  --bs-btn-bg: var(--bs-primary) !important;
  --bs-btn-border-color: var(--bs-primary) !important;
  --bs-btn-hover-bg: var(--bs-primary) !important;
  --bs-btn-hover-border-color: var(--bs-primary) !important;
  --bs-btn-active-bg: var(--bs-primary) !important;
  --bs-btn-active-border-color: var(--bs-primary) !important;
}

/* ---------- Navbar Backdrop-Filter ---------- */
.navbar {
  background-color: rgba(var(--bs-body-bg-rgb), 0.95) !important;
}

.navbar-blur {
  backdrop-filter: blur(8px);
}

/* ---------- Card Border-Left für Kategorien ---------- */
.card.border-success,
.card.border-danger,
.card.border-primary {
  border-left-width: 4px !important;
}

.card-border-left {
  border-left-width: 4px !important;
}

/* VAG Logo - klein und zentriert */
.vag-logo-small {
  height: 0.875rem !important;
  width: auto !important;
  vertical-align: middle !important;
}

/* Admin Cards - Hover-Effekte */
.admin-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--bs-border-color);
}

.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: var(--bs-primary);
}

/* ---------- Time-Picker Modal (Custom Component) ---------- */
#clockOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#clockOverlay.is-open {
  display: flex;
  pointer-events: auto;
}

.clock-modal {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  width: min(92vw, 420px);
  color: var(--bs-body-color);
}

.clock-legend {
  color: var(--bs-secondary-color);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.clock-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.clock-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}

.clock-row select {
  min-width: 90px;
}

.clock-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ---------- Stundenplan (Timetable) - Spezialkomponente ---------- */
.timetable-intro {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background-color: rgba(var(--bs-primary-rgb), 0.1);
  border-radius: var(--bs-border-radius);
  border-left: 4px solid var(--bs-primary);
}

.timetable-navigation {
  margin-bottom: 1.5rem;
}

.timetable-container {
  overflow-x: auto;
  margin-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
}

.timetable-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bs-body-bg);
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  border-radius: var(--bs-border-radius);
  border: 1px solid var(--bs-border-color);
  min-width: 1000px;
  table-layout: fixed;
}

.timetable-grid th {
  background: var(--bs-tertiary-bg);
  padding: 1rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--bs-border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  width: 16%;
  font-weight: 600;
}

.timetable-grid th:first-child {
  width: 120px;
  min-width: 120px;
}

.timetable-grid td {
  border: 1px solid var(--bs-border-color);
  padding: 0.5rem;
  vertical-align: middle;
  text-align: center;
  width: 16%;
}

.timetable-grid td:first-child {
  width: 120px;
  min-width: 120px;
  background: var(--bs-tertiary-bg);
  font-weight: 600;
}

.timetable-grid th.current-day {
  background: rgba(var(--bs-primary-rgb), 0.15) !important;
  border: 2px solid var(--bs-primary) !important;
  font-weight: bold !important;
}

.timetable-grid .current-day {
  background: rgba(var(--bs-primary-rgb), 0.05) !important;
}

.time-detail {
  display: block;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
}

.lesson-cell {
  height: 100px;
  position: relative;
}

.break-cell {
  background: var(--bs-secondary-bg);
  text-align: center;
  height: 50px;
  color: var(--bs-secondary-color);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lesson-display {
  height: 100%;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.lesson-display:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.subject-short {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  color: white;
  font-weight: bold;
  border-radius: 3px;
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.subject-name {
  font-weight: bold;
  font-size: 0.9rem;
  line-height: 1.2;
  margin-top: 0.25rem;
}

.room-info, .teacher-info {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.2;
}

.lesson-notes {
  margin-top: 0.5rem;
  padding: 0.25rem;
  background: rgba(var(--bs-primary-rgb), 0.1);
  border-radius: 3px;
  border-left: 3px solid var(--bs-primary);
  font-size: 0.7rem;
}

.no-lesson {
  color: var(--bs-secondary-color);
  font-style: italic;
  text-align: center;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* Fach-Farben */
.subject-bg[data-color="#e74c3c"] { background-color: #e74c3c; }
.subject-bg[data-color="#3498db"] { background-color: #3498db; }
.subject-bg[data-color="#2ecc71"] { background-color: #2ecc71; }
.subject-bg[data-color="#f39c12"] { background-color: #f39c12; }
.subject-bg[data-color="#9b59b6"] { background-color: #9b59b6; }
.subject-bg[data-color="#e67e22"] { background-color: #e67e22; }
.subject-bg[data-color="#27ae60"] { background-color: #27ae60; }
.subject-bg[data-color="#8e44ad"] { background-color: #8e44ad; }
.subject-bg[data-color="#16a085"] { background-color: #16a085; }

.subject-border[data-color="#e74c3c"] { border-left-color: #e74c3c; }
.subject-border[data-color="#3498db"] { border-left-color: #3498db; }
.subject-border[data-color="#2ecc71"] { border-left-color: #2ecc71; }
.subject-border[data-color="#f39c12"] { border-left-color: #f39c12; }
.subject-border[data-color="#9b59b6"] { border-left-color: #9b59b6; }
.subject-border[data-color="#e67e22"] { border-left-color: #e67e22; }
.subject-border[data-color="#27ae60"] { border-left-color: #27ae60; }
.subject-border[data-color="#8e44ad"] { border-left-color: #8e44ad; }
.subject-border[data-color="#16a085"] { border-left-color: #16a085; }

/* Mobile Responsiveness für Stundenplan */
@media (max-width: 768px) {
  .timetable-grid {
    min-width: 500px;
    font-size: 0.7rem;
  }

  .timetable-grid th,
  .timetable-grid td {
    padding: 0.3rem 0.2rem;
  }

  .timetable-grid th:first-child,
  .timetable-grid td:first-child {
    width: 70px;
    min-width: 70px;
  }

  .lesson-cell {
    height: 70px;
  }

  .break-cell {
    height: 40px;
  }

  .subject-name {
    font-size: 0.7rem;
  }

  .room-info, .teacher-info {
    font-size: 0.6rem;
  }

  .subject-short {
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
  }
}

/* Druckansicht - Header, Footer und Druck-Button ausblenden */
@media print {
  .navbar,
  .site-footer,
  .js-print {
    display: none !important;
  }

  .content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .container {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .timetable-container {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .timetable-grid {
    font-size: 10px !important;
    min-width: auto !important;
  }

  .timetable-grid th,
  .timetable-grid td {
    padding: 0.2rem !important;
    border: 1px solid #000 !important;
  }

  .lesson-cell {
    height: 50px !important;
  }

  .break-cell {
    height: 30px !important;
  }

  .subject-name {
    font-size: 8px !important;
    font-weight: bold !important;
  }

  .room-info, .teacher-info {
    font-size: 7px !important;
  }

  .subject-short {
    font-size: 7px !important;
    padding: 0.1rem 0.2rem !important;
  }

  /* Seitenumbrüche vermeiden */
  .timetable-grid,
  .timetable-grid tr,
  .timetable-grid td {
    page-break-inside: avoid !important;
  }

  /* Titel für Druck */
  h1 {
    page-break-after: avoid !important;
    margin-bottom: 1rem !important;
  }
}
