/* ── Reset & base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  background: #f4f4f4;
  color: #333;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#header {
  background: #123274;
  color: white;
  padding: 10px 16px;
  border-bottom: 3px solid #012242;
  display: flex;
  align-items: center;
  gap: 12px;
}
#header-text {
  flex: 1;
}
#header-title {
  font-size: 16px;
  font-weight: bold;
}
#header-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

#sidebar-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 3px;
  opacity: 0.85;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
#sidebar-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}
body.sidebar-hidden #sidebar-toggle svg {
  transform: scaleX(-1);
}

/* ── Shell: sidebar + main ───────────────────────────────────────────────── */
#shell {
  display: flex;
  min-height: calc(100vh - 46px);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: 180px;
  flex-shrink: 0;
  background: #012242;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
}
body.sidebar-hidden #sidebar {
  width: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition:
    background 0.15s,
    color 0.15s;
  user-select: none;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-left-color: #5bc0de;
}
.nav-icon {
  font-size: 15px;
  flex-shrink: 0;
}
.nav-label {
  line-height: 1.3;
}

/* ── Sidebar site selector ───────────────────────────────────────────────── */
#sidebar-site-selector {
  padding: 12px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 4px;
}
#sidebar-site-selector label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#global-site-select {
  width: 100%;
  font-size: 12px;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}
#global-site-select option {
  background: #012242;
  color: #fff;
}

/* ── Main content area ───────────────────────────────────────────────────── */
#main-content {
  flex: 1;
  min-width: 0;
  padding: 12px;
  overflow-y: auto;
}

/* ── Content wrapper (legacy — kept for compatibility) ───────────────────── */
#content {
  max-width: 1100px;
  margin: 12px auto;
  padding: 0 12px;
}

/* ── Colour-coding floating control ──────────────────────────────────────── */
.color-coding-control {
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.color-panel-layout {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-panel-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 10px;
  border-right: 1px solid #ddd;
  align-self: stretch;
  justify-content: center;
}
.color-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.select-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.select-group label {
  font-size: 10px;
  color: #666;
}
.select-group select {
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
}
.checkbox-group {
  display: flex;
  align-items: center;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

/* ── Go button inside floating control ───────────────────────────────────── */
#go-btn {
  padding: 3px 10px;
  background: #337ab7;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
#go-btn:hover {
  background: #286090;
}

#stop-btn {
  padding: 3px 10px;
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
#stop-btn:hover {
  background: #a93226;
}

/* ── Map ─────────────────────────────────────────────────────────────────── */
#map {
  height: 780px;
  border: 1px solid #ccc;
  border-radius: 4px;
  position: relative;
}

/* ── Info text ───────────────────────────────────────────────────────────── */
#map-info {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}
#map-info p + p {
  margin-top: 4px;
}

/* ── Leaflet legend ──────────────────────────────────────────────────────── */
.map-legend {
  background: white;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  min-width: 150px;
  position: relative;
}
.map-legend strong {
  font-size: 12px;
}

/* ── Popup ───────────────────────────────────────────────────────────────── */
.leaflet-popup-content {
  max-width: 500px;
}
.popup-wrap {
  font-size: 12px;
}
.popup-coords {
  margin-bottom: 8px;
  line-height: 1.5;
}
.popup-error {
  color: #d9534f;
  max-width: 280px;
  text-align: center;
  padding: 8px;
}
.popup-footnote {
  font-size: 11px;
  color: #888;
  margin-top: 6px;
}

.popup-table-wrap {
  max-height: 340px;
  overflow-y: auto;
  overflow-x: auto;
  margin-top: 6px;
}
.popup-table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}
.popup-table th,
.popup-table td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  text-align: center;
}
.popup-table thead tr {
  background: #f2f2f2;
}
.depth-cell {
  font-weight: normal;
  vertical-align: middle;
}

/* Download button inside popup */
.download-btn {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 12px;
  background: #5cb85c;
  color: white;
  border: 1px solid #4cae4c;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.download-btn:hover {
  background: #449d48;
  border-color: #398439;
}

/* ── Transient map notice ────────────────────────────────────────────────── */
.map-notice {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
}

/* ── Map loading overlay ─────────────────────────────────────────────────── */
#map-loading {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.45);
  z-index: 9998;
  pointer-events: none;
  align-items: center;
  justify-content: center;
}
#map-loading.active {
  display: flex;
}
.map-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #ccc;
  border-top-color: #337ab7;
  border-radius: 50%;
  animation: map-spin 0.7s linear infinite;
}
@keyframes map-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Profiles page ───────────────────────────────────────────────────────── */

.profiles-header {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.profiles-header h2 {
  font-size: 16px;
  font-weight: bold;
  color: #012242;
  margin: 0;
}

.profiles-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.profiles-controls label {
  font-weight: bold;
  white-space: nowrap;
}
.profiles-controls select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 260px;
}

.profile-message {
  color: #666;
  font-size: 13px;
  padding: 16px 0;
}
.profile-message.profile-error {
  color: #d9534f;
}

#profile-plots {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 900px) {
  #profile-plots {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1400px) {
  #profile-plots {
    grid-template-columns: repeat(3, 1fr);
  }
}

.profiles-content {
  width: 100%;
}

.profile-panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 14px 14px 10px;
  margin-bottom: 0;
}
.profile-panel h3 {
  font-size: 14px;
  font-weight: bold;
  color: #012242;
  margin: 0 0 10px 0;
}
.profile-desc {
  font-size: 12px;
  color: #666;
  margin: 8px 0 0 0;
  line-height: 1.5;
}

.canvas-wrap {
  width: 100%;
  overflow-x: auto;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Profile lightbox ───────────────────────────────────────────────────── */

.profile-panel {
  cursor: zoom-in;
}

#profile-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.78);
  overflow-y: auto;
  padding: 24px 16px 32px;
  box-sizing: border-box;
}
#profile-lightbox.open {
  display: block;
}
#profile-lightbox-close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
}
#profile-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
#profile-lightbox-inner {
  max-width: 100%;
  margin: 0 auto;
  clear: both;
}
#profile-lightbox-title {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  margin: 0 0 12px 0;
}
#profile-lightbox-canvas-wrap {
  width: 100%;
}
#profile-lightbox-canvas {
  display: block;
  width: 100%;
  height: auto;
}
#profile-lightbox-desc {
  color: #ccc;
  font-size: 13px;
  margin: 12px 0 0 0;
  line-height: 1.5;
}

/* ── Recommendation page ─────────────────────────────────────────────────── */

.rec-content {
  width: 100%;
}

.rec-header {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.rec-header h2 {
  font-size: 16px;
  font-weight: bold;
  color: #012242;
  margin: 0;
}

.rec-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.rec-controls label {
  font-weight: bold;
  white-space: nowrap;
}
.rec-controls select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 260px;
}

.rec-message {
  color: #666;
  font-size: 13px;
  padding: 16px 0;
}
.rec-error {
  color: #d9534f;
}

#rec-body > * + * {
  margin-top: 24px;
}
#rec-table-wrap {
  margin-top: 8px;
}

/* Recommendation card */
.rec-strategy-card {
  border-radius: 6px;
  padding: 18px 20px 14px;
  margin-bottom: 24px;
}
.rec-strategy-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}
.rec-strategy-sub {
  font-size: 13px;
  margin-bottom: 8px;
  opacity: 0.85;
}
.rec-reasons {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
}

/* Comparison table section */
.rec-section-title {
  font-size: 14px;
  font-weight: bold;
  color: #012242;
  margin-bottom: 6px;
}
.rec-table-desc {
  font-size: 12px;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.5;
}
.rec-note {
  font-size: 12px;
  color: #6c5700;
  background: #fff8e1;
  border-left: 4px solid #f0c040;
  padding: 8px 12px;
  margin-top: 10px;
  margin-bottom: 12px;
  border-radius: 3px;
  line-height: 1.5;
}
.rec-wave-wrap {
  margin-bottom: 18px;
}
.rec-wave-table {
  border-collapse: collapse;
  font-size: 12px;
}
.rec-wave-table th {
  background: white;
  border: 1px solid #ddd;
  padding: 6px 10px;
  text-align: left;
  font-weight: bold;
  color: #012242;
}
.rec-wave-table td {
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
  background: white;
}
.rec-wave-table td:last-child {
  text-align: right;
  font-weight: bold;
  white-space: nowrap;
}
.rec-footnote {
  font-size: 11px;
  color: #888;
  margin-top: 10px;
  line-height: 1.5;
}
.legend-ok {
  color: #28a745;
  font-weight: bold;
}
.legend-warn {
  color: #856404;
  font-weight: bold;
}
.legend-fail {
  color: #721c24;
  font-weight: bold;
}
.legend-neutral {
  color: #666;
}

.rec-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}
.rec-table th {
  background: black;
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: center;
  font-weight: bold;
  font-size: 12px;
  color: white;
}
.rec-table-cond-header {
  text-align: left !important;
}
.rec-table td {
  border: 1px solid #e0e0e0;
  padding: 7px 10px;
  vertical-align: middle;
}
.rec-table-cond {
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
}
.rec-table-cell {
  text-align: center;
}

/* Per-strategy table blocks */
.rec-strategy-table-wrap {
  margin-bottom: 24px;
}
.rec-strategy-table-name {
  font-size: 14px;
  font-weight: bold;
  color: #012242;
  margin-bottom: 6px;
}
.rec-no-criteria {
  font-size: 12px;
  color: #555;
  padding: 8px 12px;
  margin: 0;
}

/* Summary row */
.rec-summary-row td {
  font-weight: bold;
  font-size: 12px;
  border-top: 2px solid #012242;
}

/* Cell status colours */
.cell-ok {
  background: #d4edda;
  color: #155724;
}
.cell-warn {
  background: #fff3cd;
  color: #856404;
}
.cell-fail {
  background: #f8d7da;
  color: #721c24;
}
.cell-neutral {
  background: transparent;
  color: #888;
}

/* ── Info / Mer informasjon page ─────────────────────────────────────────── */

.info-content {
  max-width: 900px;
}

.info-section {
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.info-section h2 {
  font-size: 15px;
  font-weight: bold;
  color: #012242;
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e8f0;
}

.info-section h3 {
  font-size: 13px;
  font-weight: bold;
  color: #012242;
  margin: 0 0 8px 0;
}

.info-section h4 {
  font-size: 12px;
  font-weight: bold;
  color: #444;
  margin: 0 0 6px 0;
}

.info-list {
  font-size: 12px;
  color: #444;
  line-height: 1.6;
  margin: 0 0 20px 0;
  padding-left: 20px;
}

.info-intro {
  font-size: 13px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* Glossary terms */
.info-term {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.info-term:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.info-term dt {
  font-weight: bold;
  font-size: 13px;
  color: #012242;
  margin-bottom: 2px;
}
.info-term dd {
  font-size: 13px;
  color: #444;
  line-height: 1.6;
  margin-left: 0;
}

/* Parameters table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
  margin-bottom: 20px;
}
.info-table th {
  background: #f2f2f2;
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
  font-weight: bold;
  color: #012242;
}
.info-table td {
  border: 1px solid #e0e0e0;
  padding: 7px 10px;
  vertical-align: top;
  line-height: 1.5;
}
.info-table tr:nth-child(even) td {
  background: #fafafa;
}

/* Data sources */
.info-section p {
  font-size: 13px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 10px;
}
.info-section p:last-child {
  margin-bottom: 0;
}

.info-refs {
  font-size: 12px;
  color: #555;
  line-height: 1.7;
  padding-left: 20px;
  margin-top: 6px;
  margin-bottom: 0;
}

/* Credits list */
.info-credits-list {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  font-size: 13px;
  color: #444;
  line-height: 1.9;
}

.info-version {
  font-size: 12px;
  color: #999;
  margin-top: 10px;
  margin-bottom: 0 !important;
}

.info-logos {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e8f0;
}
.info-logos img {
  height: 52px;
  width: auto;
  object-fit: contain;
}
