/* Global homepage additions -- kept separate from styles.css so every
   existing page's cache-bust version stays untouched by this change. */
.global-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin-block-end: 0.5rem;
}
.global-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}
.global-controls input,
.global-controls select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #ccc);
  font: inherit;
  min-width: 14rem;
}
.toggle-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
}
.search-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}
.search-wrap input {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #ccc);
  font: inherit;
  min-width: 18rem;
}
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-color, #fff);
  border: 1px solid var(--border-color, #ccc);
  border-radius: 0.5rem;
  margin-top: 0.25rem;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.search-results a {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: inherit;
}
.search-results a:hover,
.search-results a:focus-visible {
  background: rgba(43, 122, 75, 0.12);
}
.search-kind {
  font-size: 0.8rem;
  color: var(--muted-color, #777);
}
.map-gridline {
  stroke: currentColor;
  stroke-opacity: 0.12;
  stroke-width: 1;
}
.country-shape {
  stroke: var(--bg-color, #fff);
  stroke-width: 0.5;
}
.country-shape-uncovered {
  fill: #d8d4c8;
  fill-opacity: 0.5;
}
.country-shape-active {
  cursor: pointer;
  stroke-width: 0.75;
}
.country-shape-active:hover,
.country-shape-active:focus-visible {
  stroke: var(--accent-color, #2b7a4b);
  stroke-width: 2;
  outline: none;
}
.country-shape-selected {
  stroke: var(--accent-color, #2b7a4b);
  stroke-width: 2.5;
}
.connection-line {
  fill: none;
  stroke-width: 1.5;
}
.connection-line-measured {
  stroke: #1c6fd6;
}
.connection-line-capacity-only {
  stroke: #9a9a9a;
  stroke-dasharray: 4 3;
}
#detailPanel {
  position: relative;
  min-width: 16rem;
  max-width: 22rem;
  padding: 1rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 0.5rem;
}
#detailPanelClose {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}
.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.9rem;
}
.detail-list dt {
  color: var(--muted-color, #777);
}
.detail-list dd {
  margin: 0;
}
.detail-children {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}
#compareTableBody small {
  color: var(--muted-color, #777);
  font-weight: normal;
}
.table-row-region {
  opacity: 0.85;
}

@media (prefers-color-scheme: dark) {
  .country-shape {
    stroke: #1a1a1a;
  }
  .country-shape-uncovered {
    fill: #333;
  }
  .search-results {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

@media (max-width: 640px) {
  .electricity-map-layout {
    flex-direction: column;
  }
  #detailPanel {
    max-width: none;
  }
}
