/**
 * State Cost Chart Styles - HelpingParentsAge.com
 * Loaded conditionally on state cost article pages only.
 * Main style.css handles: header, footer, sidebar, breadcrumbs, article layout, typography.
 * This file handles: cost chart component (state picker, cost card, data panels).
 *
 * File: /css/state-cost-chart.css
 * Loaded in header.php when $is_state_cost_article is true.
 */

/* =================================================================
   CSS VARIABLES (chart-specific, scoped to avoid conflicts)
   ================================================================= */
.cost-chart {
  --chart-bg: #f8fafb;
  --chart-ink: #1f2937;
  --chart-ink-2: #374151;
  --chart-ink-3: #64748b;
  --chart-teal: #0e7490;
  --chart-teal-2: #0891b2;
  --chart-teal-soft: #e0f2fe;
  --chart-clay: #c2410c;
  --chart-clay-soft: #fff7ed;
  --chart-line: #e2e8f0;
  --chart-line-2: #cbd5e1;
  --chart-shadow: 0 2px 6px rgba(26,29,26,0.04), 0 10px 40px rgba(26,29,26,0.08);
  --chart-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --chart-radius: 14px;
  --chart-radius-sm: 8px;
  --chart-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* =================================================================
   CHART WRAPPER
   ================================================================= */
.cost-chart {
  margin: 2rem 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--chart-ink);
}

/* =================================================================
   DISCLAIMER BAR
   ================================================================= */
.cost-chart__disclaimer {
  background: var(--chart-bg);
  border-left: 4px solid var(--chart-teal-2);
  border-radius: var(--chart-radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--chart-ink-2);
}
.cost-chart__disclaimer-heading {
  font-weight: 700;
  color: var(--chart-ink);
  margin-bottom: 6px;
}
.cost-chart__disclaimer p {
  margin: 0 0 8px;
}
.cost-chart__disclaimer p:last-child {
  margin-bottom: 0;
}

/* =================================================================
   STATE PICKER (3-column dropdowns)
   ================================================================= */
.cost-chart__picker {
  background: white;
  border: 1px solid var(--chart-line);
  border-radius: var(--chart-radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--chart-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.cost-chart__picker-col {
  display: flex;
  flex-direction: column;
}
.cost-chart__picker-col label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--chart-ink-3);
  margin-bottom: 8px;
}
.cost-chart__picker-col select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--chart-line-2);
  border-radius: var(--chart-radius-sm);
  font-family: inherit;
  font-size: 16px; /* 16px prevents iOS auto-zoom */
  background: white;
  color: var(--chart-ink);
}
.cost-chart__picker-col select:focus-visible {
  outline: none;
  border-color: var(--chart-teal-2);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.25);
}
.cost-chart__picker-col select:focus:not(:focus-visible) {
  outline: none;
}
.cost-chart__picker-note {
  margin-top: 10px;
  font-size: 14px;
  color: var(--chart-ink-3);
  line-height: 1.5;
}

/* Quick-switch state chips (anchors styled as pill bubbles). Selector
   covers both `button` (legacy) and `a.cost-chart__quick-switch-link`.
   The `a.` prefix raises specificity (0,2,1) so the chip style beats the
   global `.article-content a` rule that lives in style.css. Background,
   border-radius, text-decoration are reinforced with !important so the
   bubble look survives even if a future global anchor rule changes. */
.cost-chart__quick-switch {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cost-chart__quick-switch button,
.cost-chart__quick-switch a.cost-chart__quick-switch-link {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 12px !important;
  min-height: 30px; /* compact bubble — still 30px+ tap target on touch */
  border: 1px solid var(--chart-line-2) !important;
  background: #f1f5f9 !important;
  border-radius: 999px !important;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--chart-ink-2) !important;
  /* Anchor-specific reset so it looks identical to the prior button */
  display: inline-flex !important;
  align-items: center;
  text-decoration: none !important;
  line-height: 1.2;
  box-shadow: none !important;
}
/* On touch-only devices, bump tap target back up to 44px for ADA */
@media (hover: none) and (pointer: coarse) {
  .cost-chart__quick-switch button,
  .cost-chart__quick-switch a.cost-chart__quick-switch-link {
    min-height: 38px;
    padding: 8px 14px !important;
  }
}
.cost-chart__quick-switch button:hover,
.cost-chart__quick-switch a.cost-chart__quick-switch-link:hover {
  background: var(--chart-teal-soft) !important;
  border-color: var(--chart-teal) !important;
  color: var(--chart-ink-2) !important;
  text-decoration: none !important;
}
.cost-chart__quick-switch button.is-active,
.cost-chart__quick-switch a.cost-chart__quick-switch-link.is-active {
  background: var(--chart-teal) !important;
  color: white !important;
  border-color: var(--chart-teal) !important;
}
.cost-chart__quick-switch button:focus-visible,
.cost-chart__quick-switch a.cost-chart__quick-switch-link:focus-visible {
  outline: 3px solid var(--chart-teal-2);
  outline-offset: 2px;
}
.cost-chart__quick-switch button:focus:not(:focus-visible),
.cost-chart__quick-switch a.cost-chart__quick-switch-link:focus:not(:focus-visible) {
  outline: none;
}

/* =================================================================
   MAIN TWO-COLUMN LAYOUT
   ================================================================= */
.cost-chart__main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
}

/* =================================================================
   COST CARD (left column)
   ================================================================= */
.cost-chart__card {
  background: white;
  border: 1px solid var(--chart-line);
  border-radius: var(--chart-radius);
  padding: 20px;
  box-shadow: var(--chart-shadow);
  margin-bottom: 14px;
}
.cost-chart__card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--chart-line);
}
.cost-chart__card-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--chart-teal);
  margin: 0;
}
.cost-chart__total-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--chart-ink-3);
  margin-bottom: 4px;
}
.cost-chart__total-monthly {
  font-size: 48px;
  font-weight: 700;
  color: var(--chart-teal);
  line-height: 1;
}
.cost-chart__total-annual {
  font-size: 13px;
  color: var(--chart-ink-3);
  margin-top: 4px;
}

/* =================================================================
   LINE ITEMS (inside cost card)
   ================================================================= */
.cost-chart__category-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--chart-teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--chart-teal-soft);
}
.cost-chart__category-header:first-child {
  margin-top: 0;
}
.cost-chart__line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--chart-line);
}
.cost-chart__line:last-child {
  border-bottom: none;
}
.cost-chart__line-label {
  font-weight: 500;
  font-size: 15px;
}
.cost-chart__line-desc {
  font-size: 13px;
  color: var(--chart-ink-3);
  display: block;
  margin-top: 1px;
  line-height: 1.35;
}
.cost-chart__line-amount {
  font-family: var(--chart-mono);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  min-width: 80px;
}

/* =================================================================
   BADGES (PRIMARY, DERIVED, ESTIMATE, MODELED)
   ================================================================= */
.cost-chart__badge {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.cost-chart__badge--primary {
  background: #d1ecf1;
  color: #064e5c;
}
.cost-chart__badge--derived {
  background: #fde8c8;
  color: #6b4400;
}
.cost-chart__badge--estimate {
  background: #e8e5df;
  color: #4b5563;
}

/* Medicaid savings line */
.cost-chart__savings-line {
  background: var(--chart-clay-soft);
  margin: 4px -12px;
  padding: 6px 12px;
  border-radius: var(--chart-radius-sm);
}

/* =================================================================
   DATA PANELS (right column)
   ================================================================= */
.cost-chart__data-panel { }

.cost-chart__data-section {
  background: white;
  border: 1px solid var(--chart-line);
  border-radius: var(--chart-radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--chart-shadow);
}
.cost-chart__data-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--chart-teal);
  margin: 0 0 8px;
  font-weight: 700;
}
.cost-chart__data-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 14px;
  border-bottom: 1px dotted var(--chart-line);
}
.cost-chart__data-row:last-child {
  border-bottom: none;
}
.cost-chart__data-key {
  color: var(--chart-ink-3);
}
.cost-chart__data-val {
  font-family: var(--chart-mono);
  font-weight: 500;
  text-align: right;
}

/* =================================================================
   COVERAGE GRID (Medicaid yes/no)
   ================================================================= */
.cost-chart__coverage-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  font-size: 14px;
}
.cost-chart__coverage-grid > div {
  padding: 4px 0;
  border-bottom: 1px dotted var(--chart-line);
}
.cost-chart__cov-yes {
  color: var(--chart-teal);
  font-weight: 600;
}
.cost-chart__cov-no {
  color: var(--chart-clay);
  font-weight: 600;
}
.cost-chart__cov-null {
  color: var(--chart-ink-3);
  font-style: italic;
}

/* =================================================================
   CONFIDENCE DOTS (data quality indicators)
   ================================================================= */
.cost-chart__dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.cost-chart__dot--high { background: #4caf50; }
.cost-chart__dot--medium { background: #f59e0b; }
.cost-chart__dot--low { background: #cbd5e1; }
.cost-chart__dot--null { background: #e5e7eb; border: 1px dashed #9ca3af; }

/* =================================================================
   PANEL SUMMARY (plain language descriptions)
   ================================================================= */
.cost-chart__panel-details {
  margin-bottom: 4px;
}
.cost-chart__panel-summary {
  font-size: 13px;
  color: var(--chart-ink-2);
  line-height: 1.55;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--chart-line);
}
.cost-chart__source-link {
  font-size: 13px;
  color: var(--chart-ink-3);
  font-style: italic;
  margin-top: 6px;
}

/* =================================================================
   SECTION SUBHEADINGS (e.g., vision panel periodic vs monthly)
   ================================================================= */
.cost-chart__section-subhead {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--chart-ink-3);
  margin-bottom: 4px;
}
.cost-chart__section-subhead--highlight {
  color: var(--chart-teal);
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--chart-line);
}

/* =================================================================
   WHY THIS MATTERS (full-width bar at bottom)
   ================================================================= */
.cost-chart__footer-note {
  background: var(--chart-bg);
  border-left: 4px solid var(--chart-teal-2);
  border-radius: var(--chart-radius-sm);
  padding: 16px 20px;
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--chart-ink-2);
}
.cost-chart__footer-note strong {
  color: var(--chart-ink);
}

/* =================================================================
   SCREEN READER ONLY
   ================================================================= */
.cost-chart .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 980px) {
  .cost-chart__main {
    grid-template-columns: 1fr;
  }
  .cost-chart__picker {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .cost-chart__card {
    padding: 16px;
  }
  .cost-chart__total-monthly {
    font-size: 36px;
  }
  .cost-chart__card-header {
    flex-direction: column;
    gap: 12px;
  }
  .cost-chart__card-header h2 {
    font-size: 20px;
  }
  .cost-chart__data-section {
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .cost-chart {
    margin: 1rem 0;
  }
  .cost-chart__picker {
    padding: 16px;
    gap: 16px;
  }
  .cost-chart__total-monthly {
    font-size: 30px;
  }
  .cost-chart__line {
    grid-template-columns: 1fr auto;
    gap: 4px;
  }
  .cost-chart__badge {
    display: none; /* badges take too much space on small screens */
  }
}

/* =================================================================
   ADA: REDUCED MOTION
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  .cost-chart__quick-switch button,
  .cost-chart__quick-switch .cost-chart__quick-switch-link,
  .cost-chart__picker-col select {
    transition: none;
  }
}

/* =================================================================
   ADA: HIGH CONTRAST
   ================================================================= */
@media (prefers-contrast: high) {
  .cost-chart__quick-switch button,
  .cost-chart__quick-switch .cost-chart__quick-switch-link {
    border: 2px solid var(--chart-ink);
  }
  .cost-chart__data-section {
    border: 2px solid var(--chart-ink);
  }
  .cost-chart__card {
    border: 2px solid var(--chart-ink);
  }
}

/* =================================================================
   PRINT
   ================================================================= */
@media print {
  .cost-chart__quick-switch,
  .cost-chart__picker-col select {
    display: none;
  }
  .cost-chart__card,
  .cost-chart__data-section {
    box-shadow: none;
    border: 1px solid #000;
    break-inside: avoid;
  }
  .cost-chart__main {
    display: block;
  }
  .cost-chart__data-section {
    margin-bottom: 16px;
  }
}
