/* =========================
   KOMPENSA UI – PROJECT MAP
========================= */

html,
body {
  height: 100%;
}

body {
  line-height: 1.5;
  overflow: hidden;
  background: var(--bg);
}

/* =========================
   MAP
========================= */

#map {
  position: fixed;
  top: 72px;
  left: 0;
  width: 100%;
  height: calc(100vh - 72px);
  z-index: 1;
}

/* =========================
   SIDE PANEL
========================= */

.map-menu {
  position: fixed;
  top: calc(72px + 30px);
  left: 14px;
  width: 285px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 14px;
  z-index: 500;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.map-menu::-webkit-scrollbar {
  width: 8px;
}

.map-menu::-webkit-scrollbar-track {
  background: transparent;
}

.map-menu::-webkit-scrollbar-thumb {
  background: rgba(42, 95, 99, 0.22);
  border-radius: 999px;
}

.map-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(42, 95, 99, 0.36);
}

.map-menu-header {
  margin-bottom: 12px;
}

.map-menu-title {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.map-menu-subtitle {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.menu-group {
  border: 1px solid #e3e8e0;
  border-radius: 14px;
  background: #ffffff;
  margin-bottom: 10px;
  overflow: hidden;
}

.menu-group summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 12px;
  font-weight: 700;
  font-size: 0.95rem;
  background: #f8fbf9;
  color: var(--text);
}

.menu-group summary::-webkit-details-marker {
  display: none;
}

.menu-group[open] summary {
  border-bottom: 1px solid #e8ede6;
}

.menu-content {
  padding: 12px;
  font-size: 0.88rem;
  color: var(--text);
}

.menu-field {
  margin-bottom: 14px;
}

.menu-field:last-child {
  margin-bottom: 0;
}

.menu-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.menu-label.with-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-value {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.menu-value.muted {
  color: var(--muted);
}

.menu-value.strong {
  font-weight: 800;
}

.menu-note {
  font-size: 0.8rem;
  color: #7a847a;
}

.menu-info-box {
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #f7faf6;
  border: 1px solid #d9e0d6;
  border-radius: 12px;
}

.menu-info-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.menu-info-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #4e5a4e;
}

.map-menu-footer {
  margin-top: 14px;
}

/* =========================
   FORM ELEMENTS
========================= */

.form-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control.form-control-sm {
  border-radius: 10px;
  border-color: #d9e0d6;
  font-size: 0.92rem;
  padding: 0.48rem 0.7rem;
}

.form-control.form-control-sm:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(42, 95, 99, 0.14);
}

/* =========================
   INFO ICONS
========================= */

.info-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #dfe5e2;
  color: #223128;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  flex: 0 0 20px;
}

.info-icon-btn:hover {
  background: #cfd8d4;
}

#resultTable th {
  position: relative;
}

.info-tooltip-box {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2a37;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #d9dde2;
  text-align: left;
}

/* =========================
   SCENARIO / MANUAL TOGGLE
========================= */

.mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 2px solid #e3e8e0;
}

.mode-toggle-btn {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #5f6b5f;
  border-radius: 10px 10px 0 0;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.mode-toggle-btn:hover {
  color: var(--text);
}

.mode-toggle-btn.active {
  background: #ffffff;
  color: var(--primary);
  border-color: #d9e0d6;
}

.mode-toggle-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: #ffffff;
}

.scenario-inline-group {
  margin-top: 10px;
}

.scenario-inline-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.scenario-inline-title.with-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

#scenarioCards .btn {
  line-height: 1.35;
  white-space: normal;
  border-radius: 12px;
  font-weight: 700;
}

#scenarioCards .btn-success {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 0 5px rgba(42, 95, 99, 0.3);
}

/* =========================
   RESULTS BUTTON
========================= */

.results-toggle-btn {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  border-radius: 12px;
  padding: 13px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(42, 95, 99, 0.22);
  transition: all 0.2s ease;
}

.results-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(42, 95, 99, 0.28);
}

.results-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(42, 95, 99, 0.2);
}

/* =========================
   RESULTS OVERLAY
========================= */

.results-overlay {
  position: fixed;
  top: 92px;
  left: 315px;
  right: 20px;
  bottom: 20px;
  z-index: 700;
  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 18px;
}

.results-modal {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 224, 214, 0.95);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 18px;
  overflow: auto;
}

.results-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.results-modal-heading h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 1.2rem;
}

.results-modal-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* =========================
   RESULT TABS
========================= */

.results-tabs {
  display: flex;
  border-bottom: 2px solid #e3e8e0;
}

.results-view-btn {
  border: none;
  background: transparent;
  color: #5f6b5f;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  position: relative;
}

.results-view-btn:hover {
  color: var(--text);
}

.results-view-btn.active {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid #d9e0d6;
  border-bottom: none;
}

.results-view-btn.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #ffffff;
}

/* =========================
   SUMMARY BOX
========================= */

.summary-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7faf8;
  border: 1px solid #dce6e1;
  font-size: 0.9rem;
  color: var(--text);
}

/* =========================
   TABLES
========================= */

.table-responsive {
  max-height: calc(100vh - 270px);
  overflow: auto;
}

.kompensa-table {
  background: #ffffff;
  margin-bottom: 0;
}

.kompensa-table thead th {
  font-size: 0.86rem;
  font-weight: 700;
  vertical-align: middle;
}

.kompensa-table tbody td {
  font-size: 0.88rem;
  vertical-align: middle;
}

.highlight-row {
  background-color: #fff3cd;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

/* =========================
   ACTION BUTTONS
========================= */

.export-btn {
  border: none;
  background: linear-gradient(135deg, #3a6ea5, #4a86c5);
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.results-close-btn {
  border: 1px solid #d9e0d6;
  background: #ffffff;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

.results-close-btn:hover {
  background: #f4f7f3;
}

/* =========================
   LEAFLET
========================= */

.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.3) !important;
  backdrop-filter: blur(10px) saturate(135%);
  -webkit-backdrop-filter: blur(10px) saturate(135%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14) !important;
}

.leaflet-popup-content {
  background: transparent !important;
  color: #1f2a1f !important;
  font-weight: 500;
}

.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.38) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none !important;
}

.leaflet-control-zoom {
  margin-top: 14px !important;
}

/* =========================
   TURBINE LABEL
========================= */

.turbine-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0 0 4px #000;
}

.turbine-label::before {
  display: none !important;
}

/* =========================
   HOVER LEGEND
========================= */

.hover-legend {
  position: fixed;
  right: 20px;
  bottom: 34px;
  z-index: 800;
  width: 300px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #d9e0d6;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text);
}

.hover-legend-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.hover-legend-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.hover-legend-divider {
  height: 1px;
  background: #e6ece8;
  margin: 10px 0;
}

.hover-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hover-legend-item:last-child {
  margin-bottom: 0;
}

.hover-legend-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 22px;
}

.zone-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #007bff;
  flex: 0 0 14px;
}

.zone-dot-1 { opacity: 0.35; }
.zone-dot-2 { opacity: 0.25; }
.zone-dot-3 { opacity: 0.18; }
.zone-dot-4 { opacity: 0.12; }
.zone-dot-5 { opacity: 0.06; }

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1200px) {
  .map-menu {
    width: 265px;
  }

  .results-overlay {
    left: 294px;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-logo {
    height: 30px;
  }

  .topbar-project-name {
    max-width: 180px;
    font-size: 0.92rem;
  }

  .topbar-link {
    font-size: 0.9rem;
  }

  #map {
    position: relative;
    top: 72px;
    height: 55vh;
  }

  .map-menu {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: calc(100% - 24px);
    max-height: none;
    margin: 12px auto;
  }

  .results-overlay {
    left: 12px;
    right: 12px;
    top: 86px;
    bottom: 12px;
  }

  .hover-legend {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }

  .results-modal-header {
    flex-direction: column;
  }

  .results-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Logout-knapp */
.logout-btn {
  background-color: transparent;
  border: 1px solid #ccc;
  color: #333;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background-color: #f5f5f5;
  border-color: #999;
}

@media (max-width: 640px) {
  .topbar-project-label {
    display: none;
  }

  .topbar-project-name {
    max-width: 120px;
  }

  .results-tabs {
    width: 100%;
  }

  .results-view-btn {
    flex: 1;
    text-align: center;
  }

  .export-btn,
  .results-close-btn {
    width: 100%;
  }

  /* Disabled state för resultat-knapp */
  .results-toggle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
}
/* =========================
   TOTALHÖJD SAVE STATUS
========================= */

.totalhojd-save-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.totalhojd-save-btn {
  min-width: auto;
  padding: 8px 11px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.totalhojd-save-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.totalhojd-save-status.success {
  color: var(--success);
}

.totalhojd-save-status.error {
  color: var(--danger);
}

/* =========================
   MAP FAQ / HELP
========================= */

.help-menu-group {
  margin-top: 2px;
}

.map-faq-list {
  display: grid;
  gap: 8px;
}

.map-faq-item {
  border: 1px solid #e3e8e0;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.map-faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  padding-right: 34px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text);
  position: relative;
}

.map-faq-item summary::-webkit-details-marker {
  display: none;
}

.map-faq-item summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-weight: 800;
}

.map-faq-item[open] summary::after {
  content: "−";
}

.map-faq-item p {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
