body {
  background-color: #f4f6f8;
}

.badge-status {
  padding: 0.35em 0.7em;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  display: inline-block;
}

.status-verfuegbar { background-color: #d1e7dd; color: #0f5132; }
.status-ausgeliehen { background-color: #fff3cd; color: #664d03; }
.status-wartung { background-color: #e2e3e5; color: #41464b; }
.status-defekt { background-color: #f8d7da; color: #842029; }

.row-ueberfaellig {
  background-color: #fdeeee !important;
}

.card {
  border: none;
}

/* Corporate Identity: RAL 5012 "Lichtblau" (#0089B6) statt Bootstrap-Standardblau */
:root {
  --bs-primary: #0089b6;
  --bs-primary-rgb: 0, 137, 182;
  --bs-link-color: #0089b6;
  --bs-link-color-rgb: 0, 137, 182;
  --bs-link-hover-color: #00749a;
  --bs-link-hover-color-rgb: 0, 116, 154;
}

.bg-primary {
  background-color: #0089b6 !important;
}
.text-primary {
  color: #0089b6 !important;
}
.border-primary {
  border-color: #0089b6 !important;
}

.btn-primary {
  --bs-btn-bg: #0089b6;
  --bs-btn-border-color: #0089b6;
  --bs-btn-hover-bg: #00749a;
  --bs-btn-hover-border-color: #006a8d;
  --bs-btn-active-bg: #006a8d;
  --bs-btn-active-border-color: #006a8d;
  --bs-btn-disabled-bg: #0089b6;
  --bs-btn-disabled-border-color: #0089b6;
  --bs-btn-focus-shadow-rgb: 0, 137, 182;
}

.btn-outline-primary {
  --bs-btn-color: #0089b6;
  --bs-btn-border-color: #0089b6;
  --bs-btn-hover-bg: #0089b6;
  --bs-btn-hover-border-color: #0089b6;
  --bs-btn-active-bg: #0089b6;
  --bs-btn-active-border-color: #0089b6;
  --bs-btn-disabled-color: #0089b6;
  --bs-btn-disabled-border-color: #0089b6;
}

.form-check-input:checked {
  background-color: #0089b6;
  border-color: #0089b6;
}
.form-check-input:focus {
  border-color: #66bcd8;
  box-shadow: 0 0 0 0.25rem rgba(0, 137, 182, 0.25);
}
.form-control:focus,
.form-select:focus {
  border-color: #66bcd8;
  box-shadow: 0 0 0 0.25rem rgba(0, 137, 182, 0.25);
}

.nav-tabs .nav-link {
  cursor: pointer;
}

.navbar-center-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.app-logo {
  height: 44px;
  max-width: 260px;
  object-fit: contain;
}

.tool-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
}

.tool-thumb-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 0.375rem;
  border: 1px dashed #ced4da;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 1.3rem;
}

/* Tages-Belegungsansicht in der Buchungsmaske */
.timeline {
  position: relative;
  height: 420px;
  overflow: visible;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background: #fff;
  margin-left: 3.2rem;
  margin-right: 3.2rem;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.timeline-hour {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #eee;
  height: 0;
  pointer-events: none;
}

.timeline-hour span.hour-label-left {
  position: absolute;
  left: -3.2rem;
  top: -0.6em;
  width: 3rem;
  font-size: 0.7rem;
  color: #999;
  text-align: right;
}

.timeline-hour span.hour-label-right {
  position: absolute;
  right: -3.2rem;
  top: -0.6em;
  width: 3rem;
  font-size: 0.7rem;
  color: #999;
  text-align: left;
}

.timeline-now {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid #dc3545;
  z-index: 3;
  pointer-events: none;
}

.timeline-block {
  position: absolute;
  left: 4px;
  right: 4px;
  background: rgba(255, 193, 7, 0.85);
  border: 1px solid #d39e00;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  padding: 2px 4px;
  overflow: hidden;
  color: #4d3800;
  z-index: 2;
  pointer-events: none;
}

.timeline-selection {
  position: absolute;
  left: 4px;
  right: 4px;
  background: rgba(0, 137, 182, 0.22);
  border: 2px solid #0089b6;
  border-radius: 0.25rem;
  z-index: 4;
  pointer-events: none;
}

.timeline-selection-live {
  background: rgba(0, 137, 182, 0.35);
  z-index: 6;
}

.timeline-selection-label {
  position: absolute;
  top: -1.3em;
  left: 0;
  font-size: 0.72rem;
  color: #0089b6;
  font-weight: 600;
  white-space: nowrap;
}

/* Wochenansicht */
.timeline-week-wrap {
  display: flex;
  position: relative;
  height: 420px;
  overflow: visible;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background: #fff;
  margin-left: 3.2rem;
  margin-right: 3.2rem;
  touch-action: none;
  user-select: none;
}

.timeline-week-col {
  flex: 1;
  position: relative;
  border-left: 1px solid #f0f0f0;
  cursor: crosshair;
}

.timeline-week-col:first-child {
  border-left: none;
}

.timeline-week-col.is-today {
  background-color: #fbf7e9;
}

.timeline-week-colheader {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.7rem;
  text-align: center;
  padding: 2px 0;
  z-index: 4;
  cursor: pointer;
}

.timeline-week-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: rgba(255, 193, 7, 0.85);
  border: 1px solid #d39e00;
  border-radius: 0.2rem;
  font-size: 0.6rem;
  overflow: hidden;
  color: #4d3800;
  z-index: 2;
}

.timeline-week-selection {
  left: 2px;
  right: 2px;
}

.timeline-week-col.drag-in-range {
  background-color: rgba(0, 137, 182, 0.14);
}

/* Mobilgeraete: Kalender/Navbar kompakter, Wochenansicht per Wischgeste */
@media (max-width: 576px) {
  .timeline {
    height: 50vh;
    min-height: 260px;
    margin-left: 2.1rem;
    margin-right: 0.4rem;
  }
  .timeline-hour span.hour-label-left {
    left: -2.1rem;
    width: 1.9rem;
    font-size: 0.6rem;
  }
  .timeline-hour span.hour-label-right {
    display: none;
  }
  .timeline-week-wrap {
    height: 50vh;
    min-height: 260px;
    margin-left: 0.4rem;
    margin-right: 0.4rem;
    overflow-x: auto;
  }
  .timeline-week-col {
    min-width: 92px;
  }
  .navbar .btn {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Anhaenge zu Wartungseintraegen (Reparaturverlauf) */
.wartung-anhang-item {
  display: inline-block;
}
.wartung-anhang-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 0.25rem;
  border: 1px solid #dee2e6;
}
.wartung-anhang-doc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0.25rem;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  color: #6c757d;
  font-size: 1.1rem;
}
.wartung-anhang-del {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 0.9rem;
  height: 0.9rem;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #dc3545;
  font-size: 0.5rem;
  padding: 0.25rem;
}

/* Drucken: nur QR-Bereich */
@media print {
  body * {
    visibility: hidden;
  }
  .print-area, .print-area * {
    visibility: visible;
  }
  .print-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #6c757d;
  color: #fff;
  font-size: 0.68rem;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  user-select: none;
  flex-shrink: 0;
}
.info-icon:hover, .info-icon:focus {
  background: #495057;
  outline: none;
}

.tool-photo-dropzone {
  border: 2px dashed #adb5bd;
  border-radius: 0.375rem;
  padding: 1rem 0.5rem;
  text-align: center;
  color: #6c757d;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.tool-photo-dropzone.dragover {
  background-color: #e5f3f7;
  border-color: #0089b6;
  color: #0089b6;
}

.badge-pruefung-faellig {
  background-color: #f8d7da;
  color: #842029;
  padding: 0.2em 0.5em;
  border-radius: 0.4rem;
  font-size: 0.7rem;
  display: inline-block;
  margin-top: 2px;
}

.wartung-typ-fehlermeldung {
  color: #842029;
  font-weight: 600;
}

/* ==========================================================================
   Dunkler Modus (folgt Bootstrap 5.3 Color Modes ueber [data-bs-theme="dark"]
   auf <html>). Die meisten Bootstrap-Komponenten (Card, Modal, Formulare,
   Tabellen, Dropdowns) passen sich automatisch an; hier nur Nachbesserungen
   fuer eigene, fest verdrahtete Farben.
   ========================================================================== */

[data-bs-theme="dark"] body {
  background-color: #14181b;
}

[data-bs-theme="dark"] .status-verfuegbar { background-color: #113322; color: #6fe3a0; }
[data-bs-theme="dark"] .status-ausgeliehen { background-color: #3a2f05; color: #ffd873; }
[data-bs-theme="dark"] .status-wartung { background-color: #33383d; color: #c9ccd1; }
[data-bs-theme="dark"] .status-defekt { background-color: #3a1418; color: #ff9baa; }

[data-bs-theme="dark"] .row-ueberfaellig {
  background-color: #3a1f22 !important;
}

[data-bs-theme="dark"] .timeline,
[data-bs-theme="dark"] .timeline-week-wrap {
  background: #1c2024;
  border-color: #3a3f44;
}

[data-bs-theme="dark"] .timeline-hour {
  border-top-color: #2c3034;
}

[data-bs-theme="dark"] .timeline-hour span.hour-label-left,
[data-bs-theme="dark"] .timeline-hour span.hour-label-right {
  color: #8a8f94;
}

[data-bs-theme="dark"] .timeline-week-col {
  border-left-color: #2c3034;
}

[data-bs-theme="dark"] .timeline-week-col.is-today {
  background-color: #2a2712;
}

[data-bs-theme="dark"] .timeline-week-colheader {
  background: #22262a;
  border-bottom-color: #3a3f44;
  color: #dee2e6;
}

[data-bs-theme="dark"] .timeline-block,
[data-bs-theme="dark"] .timeline-week-block {
  background: rgba(255, 193, 7, 0.35);
  border-color: #a07800;
  color: #ffe9a8;
}

[data-bs-theme="dark"] .timeline-selection {
  background: rgba(0, 137, 182, 0.28);
}

[data-bs-theme="dark"] .timeline-selection-live {
  background: rgba(0, 137, 182, 0.42);
}

[data-bs-theme="dark"] .tool-thumb,
[data-bs-theme="dark"] .tool-thumb-placeholder,
[data-bs-theme="dark"] .wartung-anhang-doc {
  background: #22262a;
  border-color: #495057;
}

[data-bs-theme="dark"] .wartung-anhang-thumb {
  border-color: #495057;
}

[data-bs-theme="dark"] .wartung-anhang-del {
  background-color: #22262a;
}

[data-bs-theme="dark"] .tool-photo-dropzone {
  border-color: #495057;
  color: #adb5bd;
}
[data-bs-theme="dark"] .tool-photo-dropzone.dragover {
  background-color: #03303e;
  border-color: #0089b6;
  color: #7fd4ec;
}

[data-bs-theme="dark"] .badge-pruefung-faellig {
  background-color: #3a1418;
  color: #ff9baa;
}

[data-bs-theme="dark"] .wartung-typ-fehlermeldung {
  color: #ff9baa;
}

[data-bs-theme="dark"] .info-icon {
  background: #495057;
}
[data-bs-theme="dark"] .info-icon:hover,
[data-bs-theme="dark"] .info-icon:focus {
  background: #6c757d;
}

/* Schnellzugriff-Schalter fuer den Dunkelmodus in der Navbar */
#theme-quick-toggle-btn i {
  font-size: 0.95rem;
}

/* Nachbesserungen: einige feste Bootstrap-Utility-Klassen (btn-outline-dark,
   text-dark, table-light, bg-white) passen sich NICHT automatisch an
   data-bs-theme="dark" an, weil sie fest auf helle Farben "eingebrannt"
   sind. Das machte u.a. den "Bearbeiten"-Button und einige Tabellen im
   Dunkelmodus kaum lesbar - hier gezielt fuer den Dunkelmodus korrigiert. */

[data-bs-theme="dark"] .btn-outline-dark {
  --bs-btn-color: #dee2e6;
  --bs-btn-border-color: #adb5bd;
  --bs-btn-hover-color: #14181b;
  --bs-btn-hover-bg: #dee2e6;
  --bs-btn-hover-border-color: #dee2e6;
  --bs-btn-active-color: #14181b;
  --bs-btn-active-bg: #dee2e6;
  --bs-btn-active-border-color: #dee2e6;
  --bs-btn-disabled-color: #6c757d;
  --bs-btn-disabled-border-color: #495057;
}

[data-bs-theme="dark"] .text-dark {
  color: #e9ecef !important;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #2c3034;
  --bs-table-color: #e9ecef;
  --bs-table-border-color: #495057;
  --bs-table-striped-bg: #26292d;
  --bs-table-hover-bg: #32373b;
}

[data-bs-theme="dark"] .bg-white {
  background-color: var(--bs-body-bg) !important;
}
