/* =========================
   KOMPENSA UI (APP)
   Rensad version
   2026-04-11
========================= */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f7f8f5;
  color: #1f2a1f;
}

body {
  line-height: 1.5;
  overflow: hidden;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: #2f5d3a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-sizing: border-box;
}

.topbar-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: #ffffff;
}

.demo-badge {
  background: #ffffff;
  color: #2f5d3a;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
}

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

.map-menu {
  position: fixed;
  top: 155px;
  left: 10px;
  width: 250px;
  max-height: calc(100vh - 175px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 10px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid #d9e0d6;
}

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

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

.map-menu::-webkit-scrollbar-thumb {
  background: rgba(47, 93, 58, 0.28);
  border-radius: 999px;
}

.map-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(47, 93, 58, 0.45);
}

.map-menu-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #2f5d3a;
  margin-bottom: 8px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid #e5ebe2;
}

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

.menu-group summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 10px;
  font-weight: 700;
  font-size: 0.95rem;
  background: #f7faf6;
  color: #1f2a1f;
}

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

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

.menu-content {
  padding: 9px 10px 10px;
  font-size: 0.86rem;
  color: #1f2a1f;
}

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

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

.menu-info-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #2f5d3a;
  margin-bottom: 6px;
}

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

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

#summaryBox {
  font-size: 0.9rem;
}

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

/* =========================
   LEAFLET POPUP – GLASS
========================= */

.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.25) !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.22);
  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;
}

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

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

#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.4;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #d9dde2;
  text-align: left;
}

.results-toggle-btn {
  width: 100%;
  margin-top: 10px;
  border: none;
  background: linear-gradient(135deg, #2f5d3a, #3f7a4c);
  color: #ffffff;
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(47, 93, 58, 0.25);
  transition: all 0.2s ease;
}

.results-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(47, 93, 58, 0.35);
}

.results-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(47, 93, 58, 0.25);
}

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

/* =========================
   RESULT TABS (Per bostad / Per verk)
========================= */

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.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: #1f2a1f;
}

.results-view-btn.active {
  background: #ffffff;
  color: #2f5d3a;
  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;
}

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

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

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

.results-modal-header h3 {
  margin: 0;
  color: #1f2a1f;
}

.export-btn {
  margin-right: 10px;
  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: #1f2a1f;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.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 FÖR VERK
========================= */

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

.hover-legend-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: #2f5d3a;
}

.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;
}

/* =========================
   MODE TABS (Scenario / Manuell)
========================= */

.mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  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: #1f2a1f;
}

.mode-toggle-btn.active {
  background: #ffffff;
  color: #2f5d3a;
  border-color: #d9e0d6;
}

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

#scenarioCards .btn {
  line-height: 1.35;
  white-space: normal;
}

#scenarioCards .btn-success {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 0 5px rgba(47, 93, 58, 0.35);
}

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

.scenario-inline-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f2a1f;
  margin-bottom: 8px;
}

/* =========================
   RESPONSIVT
========================= */

@media (max-width: 1100px) {
  .map-menu {
    width: 230px;
  }
}

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

  #map {
    position: relative;
    top: 70px;
    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: 82px;
    bottom: 12px;
  }

  .results-toggle-btn {
    right: 12px;
    top: 82px;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-title {
    font-size: 1.25rem;
  }
}