/* #BEmesh shell: the top bar, page switcher, chips, buttons, cards and fields shared by the configurator and the tool pages. Colours come from bemesh-tokens.css. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 13px;
}

button {
  font: inherit;
  font-size: inherit;
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  z-index: 5;
}

.wordmark {
  font-weight: 700;
  flex-shrink: 0;
}

.wordmark b {
  color: var(--gold);
}

/* The switcher starts at the same x on every page. */
@media (min-width: 601px) {
  .topbar .wordmark {
    min-width: 150px;
  }
}

.spacer {
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
  min-width: 0;
}

.icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.icon.on {
  background: var(--gold-bg);
  border-color: var(--gold);
}

.btn {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--on-gold);
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn.small {
  padding: 3px 8px;
  font-size: 12px;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.segmented button:first-child {
  border-left: 0;
}

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--panel);
}

.switcher {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.switcher a {
  padding: 4px 10px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.switcher a:first-child {
  border-left: 0;
}

.switcher a:hover {
  background: var(--bar);
}

.switcher a[aria-current="page"] {
  background: var(--ink);
  color: var(--panel);
}

/* Phone: each page shows these links in its own menu instead. */
@media (max-width: 600px) {
  .switcher {
    display: none;
  }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 14px;
}

.muted {
  color: var(--mut);
}

.input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.input::placeholder {
  color: var(--mut);
}

/* A dropdown opened from a top bar icon or chip (☰, download, filters). */
.menu {
  position: absolute;
  z-index: 1000;
  min-width: 200px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px var(--shadow);
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu a:hover,
.menu button:hover {
  background: var(--bar);
}

.menu hr {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.menu-wrap {
  position: relative;
}

.menu-wrap .menu {
  top: 34px;
  right: 0;
}

.menu[hidden] {
  display: none;
}

.menu a[aria-current="page"] {
  background: var(--gold-bg);
}

.menu a {
  white-space: nowrap;
}

.menu .ext {
  margin-left: auto;
  padding-left: 12px;
  font-size: 11px;
}

.menu-user {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 8px;
  font-weight: 600;
}

.menu-mynodes {
  font-weight: 400;
  color: var(--mut);
}

.menu-mynodes[hidden] {
  display: none;
}

/* The page links are in the ☰ menu on a phone only. */
.menu .menu-page {
  display: none;
}

@media (max-width: 600px) {
  .menu .menu-page {
    display: flex;
  }

  .menu hr.menu-page {
    display: block;
  }

  .signin-chip {
    display: none;
  }
}

/* EN · NL · FR in the top bar; on a phone it moves into the ☰ menu. */
.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lang-switch button {
  padding: 4px 7px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.lang-switch button:first-child {
  border-left: 0;
}

.lang-switch button:hover {
  background: var(--bar);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--panel);
}

.menu .lang-switch,
.menu hr.menu-lang {
  display: none;
}

.menu .lang-switch {
  margin: 2px 8px 4px;
}

.menu .lang-switch button {
  flex: 1;
  justify-content: center;
  width: auto;
  padding: 6px 8px;
  border-radius: 0;
  border-left: 1px solid var(--line);
}

.menu .lang-switch button:first-child {
  border-left: 0;
}

.menu .lang-switch button[aria-pressed="true"],
.menu .lang-switch button[aria-pressed="true"]:hover {
  background: var(--ink);
  color: var(--panel);
}

@media (max-width: 600px) {
  .topbar .lang-switch:not(.menu-lang) {
    display: none;
  }

  .menu .lang-switch {
    display: flex;
  }

  .menu hr.menu-lang {
    display: block;
  }
}

.signin-chip {
  color: inherit;
  text-decoration: none;
}

.signin-chip:hover {
  background: var(--gold-bg);
  border-color: var(--gold);
}

/* A panel floating on a Leaflet map. */
.map-float {
  position: absolute;
  z-index: 800;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Leaflet chrome follows the theme (load leaflet.css before this file). */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-tooltip {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before,
.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before {
  border-color: transparent;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--mut);
}

.leaflet-bar {
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-bar a,
.leaflet-bar a.leaflet-disabled {
  background: var(--panel);
  color: var(--ink);
  border-bottom-color: var(--line);
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background: var(--bar);
}

.leaflet-bar a.leaflet-disabled {
  opacity: 0.5;
}

/* Dark map tiles: the OpenStreetMap layer only. Markers, polygons, popups and controls follow the tokens. */
.map-dark .osm-tiles {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
}

.leaflet-bar a.map-shade-button {
  width: 36px;
  height: 36px;
  line-height: 36px;
  font-size: 18px;
  text-decoration: none;
}
