/* ================================================================
   GS Pay Scale — feature-specific styles
   Relies on ../assets/app.css for tokens, card, table, tabs, badge
   ================================================================ */

/* ── Page header (matches .page-head in timing/scenarios) ───────── */
.page-head {
  padding: 36px 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.page-head .container {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.page-head h1 em { color: var(--accent); font-style: italic; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 700px; font-size: 1rem; line-height: 1.65; }

/* ── Two-column layout (matches tm-layout pattern) ──────────────── */
.gs-layout {
  padding-top: 28px;
  padding-bottom: 60px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1060px) {
  .gs-layout { grid-template-columns: 1fr 280px; gap: 20px; }
}
@media (max-width: 820px) {
  .gs-layout { grid-template-columns: 1fr; }
  .gs-sidebar { order: -1; }
}

/* ── Right sidebar ───────────────────────────────────────────────── */
.gs-sidebar {
  position: sticky;
  top: 72px;
}
@media (max-width: 820px) {
  .gs-sidebar { position: static; }
}

/* ── Locality card ───────────────────────────────────────────────── */
.locality-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Search input inside the card */
.locality-search-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.locality-search-row .input {
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238a8e9b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  font-size: 0.88rem;
}

/* National / US tile */
.locality-us-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.14s;
}
.locality-us-tile:hover { background: var(--line-2); }
.locality-us-tile[aria-pressed="true"] {
  background: var(--accent-bg);
  border-bottom-color: rgba(45, 95, 78, 0.15);
}
.locality-us-tile[aria-pressed="true"] .us-name { color: var(--accent); }
.us-flag { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.us-name { font-weight: 600; font-size: 0.88rem; color: var(--ink); line-height: 1.2; }
.us-sub { font-size: 0.74rem; color: var(--ink-3); line-height: 1.3; margin-top: 1px; }

/* List header label */
.locality-list-label {
  padding: 6px 14px;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  background: var(--bg);
  border-bottom: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
}

/* Scrollable locality list */
.locality-list {
  overflow-y: auto;
  max-height: 480px;
  overscroll-behavior: contain;
}
.locality-list::-webkit-scrollbar { width: 4px; }
.locality-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
@media (max-width: 820px) {
  .locality-list { max-height: 300px; }
}

/* Individual locality row */
.locality-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.12s;
}
.locality-item:last-child { border-bottom: none; }
.locality-item:hover { background: var(--bg-soft); }
.locality-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.locality-item.is-selected { background: var(--accent-bg); }
.locality-item.is-selected .loc-name { color: var(--accent); }

.loc-text { min-width: 0; flex: 1; }
.loc-name {
  display: block;
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-meta {
  display: block;
  font-size: 0.73rem;
  color: var(--ink-3);
  margin-top: 1px;
}
.locality-empty {
  padding: 20px 16px;
  font-size: 0.85rem;
  color: var(--ink-3);
  text-align: center;
}

/* Adjustment badges — extend app.css .badge */
.loc-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 0.70rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge-high  { background: rgba(45, 95, 78, 0.10);  color: var(--accent); }
.badge-mid   { background: rgba(194, 138, 63, 0.12); color: var(--warm); }
.badge-low   { background: var(--bg-soft);           color: var(--ink-3); border: 1px solid var(--line); }

/* ── Year selector — uses .tabs / .tab from app.css ─────────────── */
.year-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.year-row-label {
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ── Breadcrumb ─────────────────────────────────────────────────── */
.gs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}
.breadcrumb-back {
  background: none;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.80rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
}
.breadcrumb-back:hover { border-color: var(--accent); color: var(--accent); }
.breadcrumb-sep { color: var(--ink-dim); }
.breadcrumb-current {
  font-weight: 500;
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

/* ── Table header card ───────────────────────────────────────────── */
.gs-table-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 6px;
}
.gs-table-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.2;
}
.gs-adj-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent);
  white-space: nowrap;
}
.gs-table-meta {
  font-size: 0.78rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  margin-top: 4px;
}
.gs-meta-sep { color: var(--line); }

/* ── Pay table — extend app.css table.data ───────────────────────── */
#payTableWrap {
  border-radius: var(--radius-lg);
  margin-top: 12px;
}
#payTable thead th {
  font-family: var(--font-mono);
}
#payTable thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-soft);
}
#payTable tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-card);
  border-right: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.80rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 56px;
}
#payTable tbody tr:nth-child(even) td:first-child { background: var(--bg-soft); }
#payTable tbody tr:hover td:first-child { background: rgba(45, 95, 78, 0.04); }

/* Capped cells (EX-IV statutory limit) */
#payTable td.capped {
  background: rgba(194, 138, 63, 0.08);
  color: #8a5a1f;
  font-weight: 500;
  position: relative;
}
#payTable td.capped::after {
  content: '†';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.60rem;
  line-height: 1;
  color: #c28a3f;
}
#payTable tbody tr:nth-child(even) td.capped { background: rgba(194, 138, 63, 0.12); }
#payTable tbody tr:hover td.capped { background: rgba(194, 138, 63, 0.16); }

/* ── Loading skeleton ────────────────────────────────────────────── */
.gs-skeleton {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  margin-top: 12px;
}
.skel-row {
  height: 40px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line-2) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: gs-shimmer 1.4s infinite;
  border-bottom: 1px solid var(--line-2);
}
.skel-row:last-child { border-bottom: none; }
.skel-row.skel-head { height: 42px; background: var(--bg-soft); animation: none; }
@keyframes gs-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Error state ─────────────────────────────────────────────────── */
.gs-error {
  margin-top: 12px;
  border: 1px solid rgba(154, 72, 84, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(154, 72, 84, 0.04);
  padding: 24px;
  text-align: center;
}
.gs-error p { margin-bottom: 14px; }

/* ── Fallback note ───────────────────────────────────────────────── */
.fallback-note {
  font-size: 0.78rem;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── Interactive Map ─────────────────────────────────────────────── */
.map-container {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0 0 8px;
}
.map-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 6px;
  max-width: 1200px;
  margin: 0 auto;
}
.map-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.map-back-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 14px;
  font: inherit;
  font-size: 0.80rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
}
.map-back-btn:hover { border-color: var(--accent); color: var(--accent); }

.map-svg-wrap {
  max-width: 1200px;
  margin: 0 auto;
  height: 65vh;
  min-height: 340px;
  max-height: 620px;
  padding: 0 24px;
}
.map-svg-wrap svg {
  width: 100%;
  height: 100%;
}

.map-disclaimer {
  max-width: 1200px;
  margin: 4px auto 0;
  padding: 0 24px;
  font-size: 0.72rem;
  color: var(--ink-3);
  font-style: italic;
}

/* Choropleth color scale — 6 steps from light to dark green */
.map-state-path,
.map-county-path {
  stroke: #fff;
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.12s, stroke-width 0.12s;
}
.map-state-path:hover,
.map-county-path:hover {
  stroke-width: 1.5;
  stroke: #2d5f4e;
  filter: brightness(1.10);
}
.map-county-path.is-selected {
  stroke: #2d5f4e;
  stroke-width: 2.5;
  filter: brightness(1.15);
}
.map-state-path.is-selected {
  stroke: #2d5f4e;
  stroke-width: 2;
  filter: brightness(1.10);
}

/* Tooltip */
.map-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  max-width: 280px;
  line-height: 1.35;
}
.map-tooltip .tt-name { font-weight: 600; }
.map-tooltip .tt-pct { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }

/* Color scale legend */
.map-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 1200px;
  margin: 6px auto 0;
  padding: 0 24px;
}
.map-legend-bar {
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.08);
}
.map-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--ink-3);
}

@media (max-width: 820px) {
  .map-svg-wrap { height: 280px; min-height: 220px; padding: 0 12px; }
  .map-header { padding: 10px 12px 4px; }
  .map-disclaimer { padding: 0 12px; }
  .map-legend { padding: 0 12px; }
}
