/* sawit additions on top of the eDash Project Selector CSS (project-selector.css,
   copied unchanged). The page runs standalone here, so the shell stands in for
   eDash's .edash-content. */

html,
body {
  height: 100%;
  margin: 0;
}
body.edash-fullscreen-page {
  --edash-content-pad: 0px;
}
.sw-shell {
  position: fixed;
  inset: 0;
}
.ps-page {
  inset: 0;
}
.demo-map-card::after {
  content: '';
}

/* ---------- brand bar (top-left) ---------- */
.sw-brandbar {
  position: absolute;
  top: 32px;
  left: 32px;
  z-index: 650;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 8px;
  border-radius: 999px;
}
.sw-brandbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font:
    700 14.5px/1 'Montserrat',
    sans-serif;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: #25343f;
}
.sw-brandbar .brand b {
  color: #0b7a82;
  font-weight: 700;
}
.sw-brandbar .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #129da5, #0b7a82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(40, 240, 184, 0.5);
}
.sw-brandbar .brand-mark svg {
  width: 16px;
  height: 16px;
}
.sw-brandbar .lang {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(37, 52, 63, 0.06);
  box-shadow: inset 0 0 0 1px rgba(37, 52, 63, 0.1);
}
.sw-brandbar .lang button {
  border: 0;
  background: transparent;
  font:
    700 11px/1 'Montserrat',
    sans-serif;
  color: #333d6d;
  padding: 7px 10px;
  min-width: 36px;
  border-radius: 999px;
  cursor: pointer;
}
.sw-brandbar .lang button[aria-pressed='true'] {
  background: #0b7a82;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 1px rgba(40, 240, 184, 0.5);
}
.sw-demo-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b3570a;
  background: #fdecd8;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
/* ---------- fit button sits above locate ---------- */
.ps-locate-btn.sw-fit-btn {
  bottom: 90px;
}

/* ---------- the panel scrolls inside the viewport ---------- */
.ps-table-scroll .ps-table-rows {
  max-height: 260px;
  overflow-y: auto;
}
.ps-table-row-actions .ps-row-action-btn {
  width: 28px;
  height: 28px;
}

/* ---------- status cards are filters ---------- */
.sw-status-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}
.sw-status-grid .ps-category-item {
  cursor: pointer;
  font: inherit;
  padding: 10px 4px;
  transition:
    opacity 0.15s ease,
    border-color 0.15s ease;
}
.sw-status-grid .ps-category-item:hover {
  border-color: var(--cat-color, #0f6a71);
}
.sw-status-grid .ps-category-item.is-off {
  opacity: 0.45;
}
.sw-status-grid .ps-category-item.is-off .ps-category-value {
  text-decoration: line-through;
}
.sw-status-grid .ps-category-icon {
  width: 28px;
  height: 28px;
  font-size: 12px;
}
.sw-status-grid .ps-category-value {
  font-size: 16px;
}
.sw-status-grid .ps-category-label {
  font-size: 10px;
}

/* ---------- legend card (in place of the Today chart) ---------- */
.sw-legend .ps-today-head {
  margin-bottom: 8px;
}
.sw-legend-note {
  color: #7c8b8d;
  font-weight: 500;
}
.sw-legend-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.sw-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: #25343f;
}
.sw-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.sw-legend-swatch.is-line {
  height: 3px;
  border-radius: 2px;
  border: 0;
  box-shadow: none;
}

/* ---------- block facts in the detail sheet ---------- */
.sw-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e7edee;
  font-size: 12px;
}
.sw-facts dt {
  color: #7c8b8d;
  font-weight: 500;
}
.sw-facts dd {
  margin: 0;
  color: #25343f;
  font-weight: 600;
  text-align: right;
}
.sw-facts dd small {
  display: block;
  font-weight: 500;
  color: #7c8b8d;
  font-size: 10.5px;
}
.sw-facts .is-nodata {
  color: #7c8b8d;
  font-style: italic;
  font-weight: 500;
}
.sw-facts .is-flag {
  color: #b3570a;
}
.ps-detail-target strong {
  color: var(--sw-status, #fa891a);
}

/* ---------- hover tooltip and attribution ---------- */
.ps-pin-tooltip .maplibregl-popup-tip {
  display: none;
}
.maplibregl-ctrl-attrib {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
}
.ps-pin-tooltip .maplibregl-popup-content {
  font-family: 'Montserrat', sans-serif;
}

/* ---------- my-location dot ---------- */
.sw-me {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3e7cb1;
  border: 3px solid #fff;
  box-shadow:
    0 0 0 6px rgba(62, 124, 177, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---------- narrow screens ---------- */
@media (max-width: 720px) {
  .sw-brandbar {
    top: 12px;
    left: 12px;
    right: 12px;
    gap: 8px;
  }
  .sw-brandbar .lang {
    margin-left: auto;
  }
  .ps-panel {
    top: 72px;
    left: 12px;
    right: 12px;
    max-height: calc(100% - 84px - 150px);
  }
  .ps-left-stack {
    left: 12px;
    right: 76px;
    bottom: 12px;
    max-height: calc(100% - 96px);
  }
  .ps-locate-btn {
    right: 12px;
    bottom: 12px;
  }
  .ps-locate-btn.sw-fit-btn {
    bottom: 68px;
  }
  .sw-legend {
    padding: 10px 12px 12px;
  }
  .sw-legend-items {
    gap: 4px 8px;
  }
  .ps-summary {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .ps-summary-label {
    font-size: 8.5px;
  }
  .ps-page.is-detail .sw-legend {
    display: none;
  }
  .ps-detail-panel {
    box-sizing: border-box;
    max-height: 46vh;
    overflow-y: auto;
    padding: 14px 16px 16px;
  }
  .sw-facts {
    gap: 4px 10px;
    font-size: 11.5px;
    margin-top: 10px;
    padding-top: 10px;
  }
  .ps-detail-actions {
    margin-top: 10px;
  }
}
@media (max-width: 720px) and (max-height: 760px) {
  .ps-page:not(.is-detail) .sw-legend {
    display: none;
  }
  .ps-panel {
    max-height: calc(100% - 84px - 80px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sw-status-grid .ps-category-item {
    transition: none;
  }
}

/* ---------- basemap switcher ---------- */
.sw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sw-chip {
  position: relative;
  cursor: pointer;
}
.sw-chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.sw-chip span {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #e7edee;
  background: #f4f7f7;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #3d5f66;
  transition:
    background 0.15s,
    color 0.15s;
}
.sw-chip input:checked + span {
  background: #0f6a71;
  border-color: #0f6a71;
  color: #fff;
}
.sw-chip input:focus-visible + span {
  outline: 2px solid #129da5;
  outline-offset: 2px;
}
.sw-overlays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
}

/* ---------- the basemap button and its popover: above fit, always reachable ---------- */
.ps-locate-btn.sw-base-btn {
  bottom: 148px;
}
.ps-locate-btn.sw-base-btn[aria-expanded='true'] {
  color: #0b7a82;
}
.sw-base-pop {
  position: absolute;
  right: 90px;
  bottom: 148px;
  z-index: 550;
  box-sizing: border-box;
  width: 268px;
  max-height: calc(100% - 180px);
  overflow-y: auto;
  padding: 14px 14px 12px;
  border-radius: 18px;
}
.sw-base-pop[hidden] {
  display: none;
}
.sw-base-pop .ps-section-title {
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .ps-locate-btn.sw-base-btn {
    bottom: 124px;
  }
  .sw-base-pop {
    right: 68px;
    bottom: 124px;
    width: min(268px, calc(100% - 84px));
    max-height: calc(100% - 150px);
  }
}

/* ---------- the open panel must not sit on the round buttons ----------
   On a desktop the Estate Blocks panel is as tall as the map and is drawn
   over the button column (z-index 600 against 500). While it is open the
   buttons and the basemap popover move left of it; a phone keeps them
   under it, where the panel is short enough to clear them. */
@media (min-width: 721px) {
  .ps-locate-btn {
    transition:
      right 0.2s var(--ease, ease),
      color 0.15s ease,
      transform 0.15s ease;
  }
  .sw-base-pop {
    transition: right 0.2s var(--ease, ease);
  }
  .ps-page:not(.is-detail):has(.ps-panel.is-open) .ps-locate-btn {
    right: 344px;
  }
  .ps-page:not(.is-detail):has(.ps-panel.is-open) .sw-base-pop {
    right: 402px;
  }
}
@media (min-width: 721px) and (prefers-reduced-motion: reduce) {
  .ps-locate-btn,
  .sw-base-pop {
    transition: none;
  }
}

/* ---------- Weather card (reuses the panel's own tiles; no blur of its own) ---------- */
.sw-wx [hidden] {
  display: none !important;
}
.sw-wx-tiles .ps-gen-item {
  min-width: 0;
  overflow-wrap: anywhere;
}
.sw-wx-tiles .ps-gen-item.is-nodata .ps-gen-value {
  font-size: 11px;
  font-weight: 600;
  color: #7c8b8d;
}
.sw-wx-status {
  font-size: 12px;
  color: #7c8b8d;
}
.sw-wx-status.is-failed {
  color: #8a4b12;
}
.sw-wx-note {
  margin: 8px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: #7c8b8d;
  overflow-wrap: anywhere;
}
.sw-wx-note a {
  color: #0f6a71;
}
