/* Layout and the few things Bootstrap doesn't cover. */

html, body { height: 100%; }
body { display: flex; flex-direction: column; }

.trac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #2f6b45;
  color: #fff;
}
.trac-subtitle { opacity: .85; font-size: .85rem; }

.trac-main { flex: 1; display: flex; min-height: 0; }
.trac-panel {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--bs-border-color);
}
#panel-body { flex: 1; overflow-y: auto; }
.trac-map-wrap { flex: 1; position: relative; }
#map { position: absolute; inset: 0; }
#map.trac-picking { cursor: crosshair; }

.trac-panel, .trac-page {
  --bs-link-color: #24613b;
  --bs-link-color-rgb: 36, 97, 59;
  --bs-link-hover-color: #1b4a2d;
  --bs-link-hover-color-rgb: 27, 74, 45;
}
[data-bs-theme="dark"] :is(.trac-panel, .trac-page) {
  --bs-link-color: #7cc796;
  --bs-link-color-rgb: 124, 199, 150;
  --bs-link-hover-color: #a3dbb6;
  --bs-link-hover-color-rgb: 163, 219, 182;
}
.trac-tabs { font-weight: 600; }
.trac-tabs .nav-link:not(.active) { color: var(--bs-secondary-color); }
.trac-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bs-border-color);
}
.trac-snippet {
  font-size: .85rem;
  color: var(--bs-secondary-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trac-empty { padding: 24px 16px; text-align: center; color: var(--bs-secondary-color); }

.trac-detail { padding: 12px 16px 24px; }
.trac-back { text-decoration: none; font-size: .9rem; }
.trac-h {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color);
  margin: 18px 0 6px;
}
.trac-report-text { white-space: pre-wrap; }

/* Buttons that show progress while their htmx request runs. */
.trac-when-busy, .htmx-request .trac-when-idle { display: none; }
.htmx-request .trac-when-busy { display: inline; }
.trac-toasts { margin-top: 48px; }  /* below the header */
/* Work-related words in report notes (trail/keywords.py); clickable for supervisors. */
.trac-kw { padding: 0 2px; border-radius: 3px; background: var(--bs-warning-bg-subtle); color: inherit; }
#panel-body:has(#issue-form-slot) .trac-kw { cursor: pointer; }
#panel-body:has(#issue-form-slot) .trac-kw:hover { background: var(--bs-warning-border-subtle); }
.trac-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.trac-photos img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: var(--bs-secondary-bg);
}
.trac-lightbox .modal-header .btn-close { margin-left: auto; }
.trac-lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 110px); margin: 0 auto; }
.trac-lightbox-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  border: 0;
  background: none;
  color: #fff;
  font-size: 3rem;
  opacity: .6;
}
.trac-lightbox-nav:hover { opacity: 1; }
.trac-fields { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.trac-fields dt { font-weight: normal; color: var(--bs-secondary-color); }
.trac-fields dd { margin: 0; overflow-wrap: anywhere; }
.trac-form { padding: 12px; background: var(--bs-tertiary-bg); border-radius: var(--bs-border-radius-lg); }

.trac-pick-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 8px 14px;
  border-radius: var(--bs-border-radius-lg);
  background: var(--bs-dark);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
/* Map icons: a white Bootstrap icon on a round badge in the layer's color (see ICONS in trac.js). */
.trac-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--badge);
  color: #fff;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.trac-badge .bi { line-height: 1; }
.trac-badge-count {
  position: absolute;
  top: -7px;
  right: -9px;
  min-width: 17px;
  padding: 0 4px;
  border: 1.5px solid #fff;
  border-radius: 9px;
  background: #212529;
  color: #fff;
  font: 600 10px/14px system-ui, sans-serif;
  text-align: center;
}
/* Issues keep their own shape: a diamond in the status color. */
.trac-issue-pin {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 2px solid #fff;
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 13px;
}
.trac-issue-pin .bi { line-height: 1; transform: rotate(-45deg); }
.trac-legend { display: inline-block; width: 16px; height: 16px; margin: 0 6px 0 2px; vertical-align: -3px; }
.trac-legend-line { background: linear-gradient(var(--line), var(--line)) center / 100% 3px no-repeat; }
.trac-legend-line[data-dashed="true"] {
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 7px) center / 100% 2px no-repeat;
}
.trac-popup-list { margin: 4px 0 0; padding-left: 16px; }

@media (max-width: 800px) {
  .trac-main { flex-direction: column; }
  .trac-map-wrap { flex: none; height: 45vh; order: -1; }
  .trac-panel { width: 100%; flex: 1; border-right: none; border-top: 1px solid var(--bs-border-color); }
  .trac-subtitle { display: none; }
}

/* Pages without the map (Team, sign-in). */
.trac-page { flex: 1; overflow-y: auto; }
.trac-auth-card { max-width: 420px; margin: 48px auto; }
.trac-toolbar .form-select { flex: 1 1 120px; }
