/* =========================================================================
   APPALACHIA FOCUS add-on styles (loaded after styles.css)
   Snapshot panel + toggle button for the 3-state slideshow build.
   ========================================================================= */

/* Solid, legible legend panel (base style makes it 80% transparent). */
#legend {
  background: #ffffff !important;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.2) !important;
  border: 1px solid #e4e4e4;
  border-radius: 8px !important;
  padding: 10px 12px !important;
}

/* Collapsible legend header (mirrors the Data Layers collapse). */
#legend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Poppins', 'Arial', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #333;
}
.legend-toggle-icon { font-size: 15px; line-height: 1; color: #666; }
#legend-collapsible { margin-top: 8px; }
#legend.legend-collapsed #legend-collapsible { display: none; }

/* Multi-select dropdowns for the States / Subregions selectors. Collapsible
   in-flow (the control panel has overflow:hidden, so a floating menu would be
   clipped) — the panel expands inside the control panel and scrolls if long. */
.ms-dropdown { margin: 0 0 6px; }
.ms-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #222;
  text-align: left;
}
.ms-trigger:hover { border-color: #999; }
.ms-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: #888; font-size: 10px; transition: transform 0.15s ease; flex: 0 0 auto; }
.ms-dropdown.ms-open .ms-caret { transform: rotate(180deg); }
.ms-panel {
  display: none;
  margin-top: 4px;
  max-height: 232px;
  overflow-y: auto;
  border: 1px solid #e4e4e4;
  border-radius: 6px;
  padding: 4px 2px;
}
.ms-dropdown.ms-open .ms-panel { display: block; }

/* Small hint under the States / Subregions group titles. */
.control-hint {
  font-size: 10.5px;
  color: #8a8a8a;
  margin: 0 0 4px 2px;
  font-style: italic;
}

/* Color dot for the subregion selector options. */
.sr-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  flex: 0 0 auto;
}

/* Legend keys for the geography lines (match the map line styles). */
.legend-region-line,
.legend-subregion-line,
.legend-state-line {
  width: 26px;
  height: 0;
  flex: 0 0 auto;
  margin-right: 8px;
  align-self: center;
}
.legend-region-line { border-top: 3px solid #3d2b1f; }
.legend-state-line { border-top: 2px solid #3f3f3f; }

/* Subregion color key: 5 chips, each followed by its label. */
.legend-subregion-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 5px;
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.3;
}
.legend-subregion-chips span {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 auto;
}

#ap-toggle {
  position: absolute;
  top: 92px;
  left: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #6d3410;
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
#ap-toggle:hover { background: #834317; }
#ap-toggle.ap-hidden { display: none; }

#ap-panel {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  width: 420px;
  max-width: 92vw;
  height: 100%;
  overflow-y: auto;
  background: #ffffff;
  box-shadow: 2px 0 22px rgba(0, 0, 0, 0.22);
  transform: translateX(-104%);
  transition: transform 0.28s ease;
  font-family: 'Poppins', sans-serif;
  color: #1c1c1c;
}
#ap-panel.ap-open { transform: translateX(0); }

.ap-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  background: #6d3410;
  color: #fff;
  position: sticky;
  top: 0;
}
.ap-panel-title {
  font-family: 'Archivo', 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.01em;
}
#ap-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.ap-panel-sub {
  padding: 12px 18px;
  font-size: 12px;
  line-height: 1.5;
  color: #4a4a4a;
  border-bottom: 1px solid #ececec;
}

.ap-cards { padding: 6px 14px 0; }

.ap-card { margin: 14px 0 4px; }
.ap-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: 'Archivo', 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 16px;
  color: #6d3410;
  margin-bottom: 6px;
}
.ap-badge {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6d3410;
  background: #f0e2d7;
  border-radius: 10px;
  padding: 2px 8px;
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ap-table thead th {
  text-align: right;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a8a8a;
  padding: 4px 6px;
  border-bottom: 1.5px solid #e2e2e2;
}
.ap-table thead th:first-child { text-align: left; }
.ap-table tbody th {
  text-align: left;
  font-weight: 500;
  color: #333;
  padding: 6px 6px;
  border-bottom: 1px solid #f0f0f0;
  width: 46%;
}
.ap-table tbody td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 6px 6px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.ap-col-app { background: #faf4ee; }
td.ap-col-app { font-weight: 600; color: #6d3410; }
.ap-unit { color: #9a9a9a; font-weight: 400; }
.ap-note {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: #b06a3a;
  font-style: italic;
}

.ap-foot {
  padding: 14px 18px 26px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #8a8a8a;
}

@media (max-width: 600px) {
  #ap-panel { width: 100%; max-width: 100%; }
  #ap-toggle { top: 80px; }
}
