/* Page-specific styles. Shared header styles load last. */

/* MDWDS components and sdac-table.css set display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

.view-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem 1rem;
  margin-block-end: 1rem;
  padding: .5rem .75rem;
  border: 1px solid #dfe1e2;
  background: #f6f8fa;
}

.view-selector__label {
  margin: 0;
  color: #565c65;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .125rem;
  min-inline-size: 0;
}

.view-tab {
  appearance: none;
  min-inline-size: 0;
  min-block-size: 2.75rem;
  margin: 0;
  padding: .375rem .75rem;
  border: 0;
  border-block-end: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #162e51;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.view-tab:hover:not([aria-selected="true"]) {
  background: #eff6fb;
  text-decoration: underline;
}

.view-tab[aria-selected="true"] {
  border-block-end-color: #005ea2;
  background: #e8f1f8;
  font-weight: 700;
}

.view-tabs .view-tab:focus-visible {
  outline: 3px solid #162e51;
  outline-offset: -5px;
}

@media (max-width: 36rem) {
  .view-selector { display: block; }

  .view-tabs {
    flex-direction: column;
    margin-block-start: .375rem;
  }

  .view-tab {
    border-block-end: 0;
    border-inline-start: 3px solid transparent;
  }

  .view-tab[aria-selected="true"] { border-inline-start-color: #005ea2; }
}

@media (forced-colors: active) {
  .view-tab[aria-selected="true"] {
    border-color: Highlight;
    text-decoration: underline;
  }

  .view-tabs .view-tab:focus-visible { outline-color: CanvasText; }
}

/* Compact report controls follow the BEA explorer's toolbar layout. */
.table-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.table-title-row h2 { margin: 0; }
.download-table.usa-button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  width: auto;
  min-height: 0;
  margin: 0 0 0 auto;
  padding: .4rem .75rem;
  font-size: .9rem;
  line-height: 1;
  white-space: nowrap;
}
.download-table .usa-icon { width: 1rem; height: 1rem; }
.download-menu { position: relative; margin-left: auto; }
.download-menu > summary { cursor: pointer; list-style: none; }
.download-menu > summary::-webkit-details-marker { display: none; }
.download-menu > summary::after { content: "\25BE"; }
.download-menu > summary:focus-visible { outline: .25rem solid #2491ff; }
.download-options {
  box-sizing: border-box;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: min(20rem, calc(100vw - 24px));
  padding: .5rem;
  background: #fff;
  border: 1px solid #a9aeb1;
}
.download-options .usa-button { box-sizing: border-box; display: block; width: 100%; margin: .25rem 0; text-align: left; }
.view-controls { justify-content: flex-start; align-items: end; gap: 8px 16px; margin: 12px 0 4px; }
.view-control-group { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; max-width: 100%; padding-bottom: 6px; }
.view-control-group .usa-button-group { flex-wrap: nowrap; margin: 0; }
.view-control-group .usa-button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}
.view-controls .filters {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
  margin: 0 0 0 auto;
  padding: 0 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.filters .field { flex: 0 1 auto; max-width: 100%; }
.filters .usa-label { min-height: 24px; margin: 0; font-size: 12px; font-weight: 400; }
.filters .usa-select {
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 4px 24px 4px 8px;
  font-size: 13px;
}
.filters .usa-select:disabled { background-color: #e6e6e6; color: #565c65; cursor: not-allowed; opacity: 1; }
.view-controls .field__label { min-height: 24px; margin: 0; }
.view-controls .field__label .usa-label { min-height: 0; }
.view-controls .field__info { font-size: 16px; }

/* Compact report tables with handbook-style geography colors. */
.panel { border: 0; border-radius: 0; }
.table-scroll .usa-table .geography-row--region > th { padding-left: 24px; }
.table-scroll .usa-table .geography-row--county > th { padding-left: 40px; }
@media screen {
  .table-scroll .usa-table { font-size: 1rem; line-height: 1.5; }
  .table-scroll .usa-table th,
  .table-scroll .usa-table td { border-color: #dfe1e2; padding: 8px 12px; }
  .table-scroll .usa-table thead th { padding: 8px 12px; font-size: .87rem; line-height: 1.5; }
  .table-scroll .usa-table tbody tr:nth-child(n) > * { background: #fff; }
  .table-scroll .usa-table tbody tr.geography-row--state > * { background: #162e51; color: #fff; }
  .table-scroll .usa-table tbody tr.geography-row--region > * { background: #e9eef7; }
}

/* PFA info button beside its label; the definition is long, so its tooltip reads better left-aligned */
.field__label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.field__label .usa-label { margin: 0; }
.field__info { display: inline-flex; padding: 0; border: 0; background: none; color: #005ea2; font-size: 20px; cursor: pointer; }
.field__info:hover { color: #1a4480; }
.usa-tooltip__body { text-align: left; }

/* Show the selected table (with notes) or charts on screen; print shows both. */
@media screen { [data-part].view-hidden { display: none; } }

/* Only one panel shows at a time, so neither needs space above it */
.trend-panel { margin-top: 0; }

/* Charts */
.trend-charts { padding-top: 20px; }
.chart-box { position: relative; height: 300px; }
/* Spans both chart columns */
.chart-note { grid-column: 1 / -1; margin: 0; color: #1b1b1b; }
.trend-charts canvas, .pfa-share-pie canvas { display: block; max-width: 100%; }
.pfa-share { border-bottom: 0; }
.pfa-share-layout { margin-top: 0; }
.pfa-share-pie.pfa-share-bars { position: relative; width: min(100%, 640px); height: 200px; aspect-ratio: auto; }
.pfa-share-pie.pfa-sales-bars { position: relative; width: 100%; height: 360px; aspect-ratio: auto; flex-shrink: 1; }

@media (max-width: 700px) {
  .trend-charts { padding-top: 16px; }
  .view-controls .filters { flex-basis: 100%; }
  .view-control-group { gap: 8px; }
}

@media print {
  .view-selector, .download-menu { display: none !important; }
}
