/* Sidebar Layout */
#wrapper {
  min-height: 100vh;
}

#sidebar {
  width: 250px;
  transition: margin 0.25s ease-out;
}

#sidebar.collapsed {
  margin-left: -250px;
}

#sidebar .nav-link {
  padding: 0.75rem 1rem;
  transition: background-color 0.15s ease-in-out;
}

#sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

#sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

/* Sidebar collapsed: hide text, show only icons */
#sidebar.collapsed .sidebar-text {
  display: none;
}

#sidebar.collapsed {
  width: 70px;
  margin-left: 0;
}

#sidebar.collapsed .nav-link {
  text-align: center;
  padding: 0.75rem 0;
}

#sidebar.collapsed .sidebar-huts {
  display: none;
}

/* Phones: no sidebar; the burger drops the whole menu down from the top (app.js toggles .open).
   visibility keeps the hidden links out of the tab order. */
@media (max-width: 767.98px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 100vh;
    overflow-y: auto;
    z-index: 1040;
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform 0.25s ease-out, visibility 0.25s;
  }
  #sidebar.open {
    transform: none;
    visibility: visible;
  }
}

/* Hütten-Liste in der Sidebar */
.sidebar-huts {
  list-style: none;
  padding-left: 0;
}

.sidebar-huts .nav-link {
  padding: 0.25rem 1rem;
  font-size: 0.875rem;
}

.sidebar-huts .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

#page-content-wrapper {
  transition: margin 0.25s ease-out;
}

/* choices.js bringt 24px Abstand mit; auf Bootstrap-Maß reduzieren */
.choices {
  margin-bottom: 0;
  font-size: 1rem;
}

.choices__inner {
  min-height: calc(1.5em + 0.75rem + 2px); /* wie .form-control */
  padding: 0.375rem 0.75rem;
  border-color: var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background-color: var(--bs-body-bg);
}

.form-select-sm + .choices .choices__inner,
.choices[data-type="select-one"] .choices__inner {
  font-size: inherit;
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  font-size: 1rem;
}

.is-focused .choices__inner {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Karten-Formular: Feldgruppen wie auf der Startseite */
.form-card .card-header {
  font-weight: 600;
}

/* Wartungskalender */
.calendar-month {
  table-layout: fixed;
}

.calendar-month th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
  text-align: center;
  background-color: var(--bs-tertiary-bg);
}

.calendar-month td {
  height: 120px;
  padding: 0.375rem;
  vertical-align: top;
  border-right: 1px solid var(--bs-border-color-translucent);
}

.calendar-month td:last-child {
  border-right: 0;
}

/* Öffnungstage: dezenter Grünton */
.calendar-month td.is-open {
  background-color: rgba(var(--bs-success-rgb), 0.07);
}

/* Geschlossene Tage (nur wenn keine Hütte offen hat): dezenter Rotton */
.calendar-month td.is-closed {
  background-color: rgba(var(--bs-danger-rgb), 0.05);
}

.calendar-month td.is-other-month {
  color: var(--bs-tertiary-color);
  background-color: var(--bs-tertiary-bg);
}

.calendar-month td.is-other-month.is-open {
  background-color: rgba(var(--bs-success-rgb), 0.04);
}

.calendar-month td.is-other-month.is-closed {
  background-color: rgba(var(--bs-danger-rgb), 0.03);
}

.calendar-month .day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 50%;
}

.calendar-month td.is-today .day-number {
  background-color: var(--bs-primary);
  color: #fff;
}

.calendar-month .day-content {
  max-height: 82px;
  overflow-y: auto;
  font-size: 0.75rem;
}

.calendar-month .calendar-entry {
  display: block;
  margin-bottom: 0.125rem;
  padding: 0.125rem 0.375rem;
  color: var(--bs-body-color);
  text-decoration: none;
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color-translucent);
  border-left: 3px solid var(--bs-secondary);
  border-radius: var(--bs-border-radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-month .calendar-entry:hover {
  background-color: var(--bs-secondary-bg);
}

.calendar-month .calendar-entry .badge {
  font-size: 0.625rem;
}

.calendar-month .status-ok { border-left-color: var(--bs-success); }
.calendar-month .status-due { border-left-color: var(--bs-warning); }
.calendar-month .status-overdue { border-left-color: var(--bs-danger); }

/* Badge radios (inc/field.html): unselected options stay in the background */
.badge-choice {
  /* selected: pastel instead of solid blue */
  --bs-btn-active-color: var(--bs-primary-text-emphasis);
  --bs-btn-active-bg: var(--bs-primary-bg-subtle);
  --bs-btn-active-border-color: var(--bs-primary-border-subtle);
  --bs-btn-hover-color: var(--bs-primary-text-emphasis);
  --bs-btn-hover-bg: var(--bs-primary-bg-subtle);
  --bs-btn-hover-border-color: var(--bs-primary-border-subtle);
}
.btn-check:not(:checked) + .badge-choice {
  --bs-btn-color: var(--bs-secondary-color);
  --bs-btn-border-color: var(--bs-border-color);
}

/* Display badges (status, role, SV …): pastel colours with a thin border, less weight.
   Bootstrap's text-bg-* use !important, so these must too. */
.badge {
  font-weight: 500;
  border: var(--bs-border-width) solid transparent;
}
.badge.text-bg-primary {
  color: var(--bs-primary-text-emphasis) !important;
  background-color: var(--bs-primary-bg-subtle) !important;
  border-color: var(--bs-primary-border-subtle);
}
.badge.text-bg-secondary {
  color: var(--bs-secondary-text-emphasis) !important;
  background-color: var(--bs-secondary-bg-subtle) !important;
  border-color: var(--bs-secondary-border-subtle);
}
.badge.text-bg-success {
  color: var(--bs-success-text-emphasis) !important;
  background-color: var(--bs-success-bg-subtle) !important;
  border-color: var(--bs-success-border-subtle);
}
.badge.text-bg-danger {
  color: var(--bs-danger-text-emphasis) !important;
  background-color: var(--bs-danger-bg-subtle) !important;
  border-color: var(--bs-danger-border-subtle);
}
.badge.text-bg-warning {
  color: var(--bs-warning-text-emphasis) !important;
  background-color: var(--bs-warning-bg-subtle) !important;
  border-color: var(--bs-warning-border-subtle);
}
.badge.text-bg-info {
  color: var(--bs-info-text-emphasis) !important;
  background-color: var(--bs-info-bg-subtle) !important;
  border-color: var(--bs-info-border-subtle);
}
.badge.text-bg-light {
  color: var(--bs-light-text-emphasis) !important;
  background-color: var(--bs-light-bg-subtle) !important;
  border-color: var(--bs-light-border-subtle);
}

/* Plan view (floor_plans/detail.html) */
.plan-map {
  height: 75vh;
  min-height: 320px;
}
.plan-map.plan-placing {
  cursor: crosshair;
}
.plan-preview {
  max-height: 320px;
  object-fit: contain;
}

/* Links in the structure tree: read like text, underline on hover */
.tree-link {
  color: var(--bs-body-color);
  text-decoration: none;
}
.tree-link:hover {
  color: var(--bs-link-hover-color);
  text-decoration: underline;
}

/* Issue markers in the plan (floor_plan.js): colours of the status badges (inc/issue_badges.html) */
.leaflet-marker-icon.plan-issue {
  /* leaflet.css loads after app.css and sets display: block on markers */
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box; /* Leaflet sets 26px incl. border, so the anchor stays in the middle */
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.8rem;
  line-height: 1;
}
.plan-issue i::before {
  vertical-align: 0; /* Bootstrap Icons shift glyphs down for text; here they sit in a circle */
}
.plan-issue .bi-exclamation-triangle-fill {
  transform: translateY(-1px); /* the triangle's weight is low, nudge it to look centred */
}
.plan-issue-open { color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); }
.plan-issue-in_progress { color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle); }
.plan-issue-done { color: var(--bs-success-text-emphasis); background: var(--bs-success-bg-subtle); }
.plan-issue-prio-low { font-size: 0.65rem; }
.plan-issue-prio-high { font-size: 1rem; border-width: 3px; }
.plan-issue-check { border-style: dashed; }

.issue-photo {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
}

@media (min-width: 768px) {
  .border-end-md { border-right: var(--bs-border-width) solid var(--bs-border-color); }
}

/* Issue photos: delete button on the thumbnail, gallery overlay (issues/detail.html) */
.photo-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  --bs-btn-padding-x: 0.35rem;
  --bs-btn-padding-y: 0.15rem;
  opacity: 0.8;
}
.photo-delete:hover {
  opacity: 1;
  color: var(--bs-danger);
}
.gallery-photo {
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  object-fit: contain;
}

/* choices.js in auto-width filter columns (Hütte in Anlagen-/Mängelliste) would shrink to its
   hidden select's width and be hard to hit; give it room for a hut name. */
.col-auto > .choices {
  min-width: 16rem;
}

/* Icons at the right end of tree rows (map, room type): same box, so they line up */
.tree-icon {
  display: inline-block;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}
.plan-map-inline {
  height: 55vh;
}
.plan-map {
  scroll-margin-top: 5rem; /* jump to #plan-map keeps the card header in view */
}
