/* Header (fixed, centered) */
.logo-bar{
  position:fixed; inset:0 0 auto 0; height:var(--header-h);
  display:flex; align-items:center; justify-content:center; text-align:center;
  padding:10px 14px; background:var(--bg-header);
  border-bottom:var(--border-nrw); z-index:1000;
}
.logo-wrap{display:flex; flex-direction:column; align-items:center; gap:2px}
.logo-wrap a{display:flex; align-items:center; justify-content:center; line-height:0}
.logo-wrap img{height:42px; display:block}
.logo-wrap h1{margin:2px 0 0; font-size:1.05rem; font-weight:800}
.logo-wrap small{color:var(--accent-yellow); opacity:.95; font-size:.8rem}

/* App layout below header */
#app{
  display:flex;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
  box-sizing: border-box;
  min-width: 300px;
}

@supports (height: 100dvh) {
  #app {
    height: calc(100dvh - var(--header-h));
  }
}

/* Sidebar */
.sidebar{
  width:280px; min-width:50px; transition:width .25s ease;
  border-right: var(--border-nrw); display:flex; flex-direction:column;
  background: var(--bg-sidebar);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar.collapsed{width:50px}
.sidebar.collapsed .sidebar-primary-action{display:none}
.sidebar.collapsed .sidebar-selection-card{display:none}

.sidebar-toggle-btn{
  display:flex; align-items:center; justify-content:center; gap:.5rem;
  background:var(--accent-yellow); color:#000; padding:8px; font-size:1rem; font-weight:900;
  cursor:pointer; user-select:none; border:none; border-radius:0px; white-space:nowrap;
}

.sidebar-items{display:flex; flex-direction:column;}

.sidebar-item{
  display:flex; gap:.55rem; align-items:center; padding:9px 14px; font-weight:700;
  border:var(--border-nrw); border-radius:0px; background:var(--bg-sidebar); color:#eee; cursor:pointer;
}
.sidebar-item .ico{width:20px; text-align:center}
.sidebar-item:hover,.sidebar-item.active{background:#3f3f3f}

.sidebar.collapsed .sidebar-item{justify-content:center}
.sidebar.collapsed .sidebar-item .label{display:none}

.sidebar-selection-card {
  margin: 22px 10px 0;
  padding: 0;
  border: none;
  background: transparent;
}

.sidebar-selection-body {
  color: rgba(231, 236, 242, 0.95);
}

.sidebar-selection-body .card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: none;
  padding: 10px 12px;
  min-width: 0;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-selection-body .title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--accent-yellow);
  letter-spacing: 0.2px;
}

.sidebar-selection-body .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-yellow);
  box-shadow: 0 0 0 3px rgba(243, 198, 35, 0.2);
}

.sidebar-selection-card[data-kind="buildings"] .sidebar-selection-body .dot {
  background: #17c25e;
  box-shadow: 0 0 0 3px rgba(23, 194, 94, 0.2);
}

.sidebar-selection-card[data-kind="surfaces"] .sidebar-selection-body .dot {
  background: #ff3b3b;
  box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.22);
}

.sidebar-selection-card[data-kind="modules"] .sidebar-selection-body .dot {
  background: #00aaee;
  box-shadow: 0 0 0 3px rgba(0, 170, 238, 0.22);
}

.sidebar-selection-body .grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
}

.sidebar-selection-body .k {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-selection-body .v {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-selection-body .hr {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0;
}

.selection-quick-actions {
  display: grid;
  gap: 6px;
}

.selection-quick-actions .btn {
  width: 100%;
}

.selection-quick-actions .btn-primary {
  background: rgba(243, 198, 35, 0.18);
  color: #f6d96a;
  box-shadow: 0 0 0 1px rgba(243, 198, 35, 0.35);
}

.selection-quick-actions .btn-primary:hover {
  background: rgba(243, 198, 35, 0.26);
  color: #ffe082;
  box-shadow: 0 0 0 1px rgba(243, 198, 35, 0.5);
  transform: none;
}

/* Content & map */
.content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #121212;
}

.view-container {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Geocoder (expanded with clear + search actions) */
.leaflet-control-geocoder {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: 340px;
  min-width: 340px;
  max-width: calc(100vw - 110px);
}

.leaflet-control-geocoder .leaflet-control-geocoder-icon {
  float: none;
  flex: 0 0 35px;
  width: 35px;
  height: 35px;
  line-height: 35px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-position: center center;
  background-size: 22px 22px;
}

.leaflet-control-geocoder .leaflet-control-geocoder-form {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.leaflet-control-geocoder .leaflet-control-geocoder-form input {
  width: 100% !important;
  height: 35px;
  margin: 0;
  padding: 0 10px;
  font-size: 13px;
  line-height: normal;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Base style for your custom circle buttons */
.leaflet-marker-icon.cell-btn {
  box-sizing: border-box;
  width: 24px !important;   /* MUST match iconSize in JS */
  height: 24px !important;  /* MUST match iconSize in JS */
  border-radius: 50%;

  background: #2ecc71;      /* default, overridden below */
  cursor: pointer;
  user-select: none;

  position: absolute;       /* Leaflet manages left/top/transform */
  padding: 0;
  border: none;
}

/* Specific colors for add / remove */
.leaflet-marker-icon.cell-btn--add {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.leaflet-marker-icon.cell-btn--remove {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* PLUS / MINUS SHAPES (pure CSS, geometrically centered) */
.leaflet-marker-icon.cell-btn::before,
.leaflet-marker-icon.cell-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: #fff;
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

/* Horizontal bar (for both + and -) */
.leaflet-marker-icon.cell-btn::before {
  width: 14px;
  height: 3px;
}

/* Vertical bar – only for the + button */
.leaflet-marker-icon.cell-btn--add::after {
  width: 3px;
  height: 14px;
}

/* Remove button: no vertical bar → minus sign only */
.leaflet-marker-icon.cell-btn--remove::after {
  content: none;
}

/* Optional: subtle hover/active feedback without moving center */
.leaflet-marker-icon.cell-btn:hover {
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.leaflet-marker-icon.cell-btn:active {
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

/* Leaflet tooltips: haal standaard rand/pijl weg */
.leaflet-tooltip.feature-tooltip {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.is-editing .leaflet-tooltip.feature-tooltip {
  display: none;
}

/* Jouw “PV Works” look */
.feature-tooltip {
  position:absolute;
  left: 10px;
  top: 10px;
  pointer-events:auto;
}

.feature-tooltip .card {
  background: rgba(15, 15, 15, 0.88);
  border: var(--border-dv);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  color: var(--text-light);
  font: 12px/1.35;
  min-width: 240px;

  /* “glass” feel (werkt in moderne browsers) */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.feature-tooltip .title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--accent-yellow);
  letter-spacing: 0.2px;
}

.feature-tooltip .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-yellow);
  box-shadow: 0 0 0 3px rgba(243, 198, 35, 0.20);
}

.feature-tooltip .grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
}

.feature-tooltip .k {
  color: var(--muted);
}

.feature-tooltip .v {
  font-weight: 700;
  color: var(--text-light);
  text-align: right;
}

.feature-tooltip .hr {
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 8px 0;
}

.feature-tooltip input, .feature-tooltip select {
  background: rgba(255, 255, 255, 0.06); /* subtle dark glass */
  border: var(--border-dv);
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--text-light);
  font-weight: 600;
  width: 100%;
  outline: none;
  color-scheme: dark;
}

/* Number steppers */
.num-stepper {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-width: 0;
}

.num-stepper input[type="number"] {
  width: 100%;
  padding-right: 26px;
  -moz-appearance: textfield;
}

.num-stepper input[type="number"]::-webkit-outer-spin-button,
.num-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.num-stepper-buttons {
  position: absolute;
  right: 4px;
  top: 3px;
  bottom: 3px;
  display: flex;
  flex-direction: column;
  width: 18px;
  border-left: var(--border-dv);
}

.num-stepper-btn {
  flex: 1 1 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.num-stepper-btn::before {
  content: "";
  width: 4px;
  height: 4px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
}

.num-stepper-btn--up::before {
  transform: rotate(-135deg);
}

.num-stepper-btn:hover::before {
  border-right-color: var(--accent-yellow);
  border-bottom-color: var(--accent-yellow);
}

.num-stepper-btn:active::before {
  filter: brightness(0.9);
}

.feature-tooltip input:focus {
  border-color: var(--accent-yellow);       /* yellow highlight */
  box-shadow: 0 0 4px rgba(243, 198, 35, 0.35);
}

.feature-tooltip select option {
  background: rgba(20, 20, 20, 0.95);   /* dark dropdown */
  color: var(--text-light);
  padding: 6px;
}

.feature-tooltip select option:hover {
  background: rgba(243, 198, 35, 0.25); /* yellow hover */
}

/* Buttons */
.btn {
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: rgba(243, 198, 35, 0.18);
  color: #f6d96a;
  box-shadow: 0 0 0 1px rgba(243, 198, 35, 0.35);
}

.btn-primary:hover {
  background: rgba(243, 198, 35, 0.26);
  color: #ffe082;
  transform: none;
  box-shadow: 0 0 0 1px rgba(243, 198, 35, 0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-yellow);
  box-shadow: 0 0 0 1px rgba(243, 198, 35, 0.45);
}

.btn-secondary:hover {
  background: var(--accent-yellow-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f6f6f6;
}

.btn-danger {
  background: #ff4d4d;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(255, 70, 70, 0.35);
}

.btn-danger:hover {
  background: #ff2b2b;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(255, 70, 70, 0.45);
}

.btn-toggle {
  display: inline-flex;
  background: var(--accent-blue);
  color: var(--text-dark);
  border-radius: 999px;
  padding: 8.5px 18px;
  font-weight: 500;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}

/* hover when not active */
.btn-toggle:hover {
  background: var(--accent-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.35);
}

/* active/checked state */
.btn-toggle.is-active {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.8);
  transform: translateY(0);
}

/* active + hover (subtle, no big jump) */
.btn-toggle.is-active:hover {
  background: rgba(56, 189, 248, 0.22);
}

/* optional: group styles */
.btn-toggle-group {
  display: inline-flex;
  white-space: nowrap;
  gap: 0.5rem;
}

input[type="radio"]:checked + .btn-toggle {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.8);
}

/* Utility classes */
.is-hidden {
  display: none !important;
}

/* Messages */
#toast {
  visibility: hidden;
  min-width: 200px;
  margin-left: -100px;
  background: #333;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 12px;
  position: fixed;
  left: 50%;
  bottom: 40px;
  font-size: 16px;
  opacity: 0;
  transition: opacity .4s, bottom .4s;
}

/* Extra*/
.divider {
  background: rgba(255, 255, 255, 0.08);
  height: 1px;
  margin: 6px 0;
}
.hint {font-size: 13px; color: rgba(255, 255, 255, 0.8);}

.edit-mode-actions {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: rgba(15, 15, 15, 0.85);
  border: var(--border-dv);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  z-index: 700;
  pointer-events: auto;
}

.sidebar-primary-action {
  margin-top: auto;
  padding: 10px 10px 12px;
  border-top: var(--border-nrw);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-export-btn {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 215, 0, 0.65);
  background: linear-gradient(180deg, #ffe066 0%, #ffd700 55%, #f0b90b 100%);
  color: #171200;
  letter-spacing: 0.01em;
  box-shadow:
    0 8px 16px rgba(255, 215, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.sidebar-export-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffea8a 0%, #ffd83f 55%, #f2bf21 100%);
  box-shadow:
    0 10px 20px rgba(255, 215, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.sidebar-export-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.sidebar-export-hint {
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.78);
}

/* Small screens */
@media (max-width: 600px){
  #app { flex-direction: column;}
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .sidebar.collapsed{width: 100%}
  .sidebar-toggle-btn{
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border-right: none;
    border-bottom: var(--border-nrw);
    border-radius: 0;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .sidebar-items{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
  }
  .sidebar-item{
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    justify-content: flex-start;
    border-left: none;
    border-right: none;
    border-bottom: var(--border-nrw);
  }
  .sidebar-item .label{display:inline}
  .sidebar-item .ico{width:20px; font-size:16px}

  /* Collapsed on phone: icon-only horizontal row next to square toggle */
  .sidebar.collapsed{
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-areas:
      "toggle items"
      "selection selection"
      "action action";
    align-items: stretch;
  }
  .sidebar.collapsed .sidebar-toggle-btn{
    grid-area: toggle;
    width: 44px;
    height: 44px;
    padding: 0;
    border-right: var(--border-nrw);
    justify-content: center;
  }
  .sidebar.collapsed .sidebar-items{
    grid-area: items;
    display:flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sidebar.collapsed .sidebar-item{
    min-width: 44px;
    width: 44px;
    padding: 0;
    justify-content: center;
    border-right: var(--border-nrw);
  }
  .sidebar.collapsed .sidebar-item .label{display:none}
  .sidebar.collapsed .sidebar-item .ico{width:auto}

  .sidebar-selection-card{
    grid-area: selection;
    margin: 10px 10px 0;
  }
  .sidebar-primary-action{
    grid-area: action;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar-panel{max-height:55%}

  .leaflet-bottom {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
  }
}

