/* ═══════════════════════════════════════════════════════════════════════════
   State Overlay System — Medicaid Guided Process
   24help.org · Institutional Warmth Design
   Colors: Off-white #F8F5F0 · Navy #0B3D91 · Gold #D4AF37 · Sage #8B9D83
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens (extend existing guide tokens) ── */
:root {
  --so-navy:        #0B3D91;
  --so-navy-dark:   #082b6b;
  --so-gold:        #D4AF37;
  --so-gold-light:  #FBF5DC;
  --so-gold-mid:    #F0E0A0;
  --so-sage:        #8B9D83;
  --so-sage-light:  #EEF2EC;
  --so-bg:          #F8F5F0;
  --so-white:       #FFFFFF;
  --so-ink:         #2D3748;
  --so-ink-light:   #4A5568;
  --so-border:      #E2E8F0;
  --so-overlay-bg:  #EEF4FF;
  --so-overlay-border: #0B3D91;
  --so-warn-bg:     #FFFBEB;
  --so-warn-border: #D4AF37;
  --so-success-bg:  #F0F7F4;
  --so-success-border: #8B9D83;
  --so-radius:      12px;
  --so-radius-sm:   8px;
  --so-shadow:      0 4px 12px rgba(11,61,145,0.08);
  --so-transition:  all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATE SELECTOR BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.state-selector-banner {
  background: var(--so-navy);
  color: var(--so-white);
  padding: 1rem 1.5rem;
  border-radius: var(--so-radius);
  margin: 0 0 1.5rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--so-shadow);
  position: relative;
}

.state-selector-banner.has-state {
  background: linear-gradient(135deg, var(--so-navy) 0%, var(--so-navy-dark) 100%);
  border-left: 4px solid var(--so-gold);
}

.state-selector-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.state-selector-content {
  flex: 1;
  min-width: 200px;
}

.state-selector-prompt {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.state-selector-prompt strong {
  color: var(--so-gold);
  font-weight: 700;
}

.state-selector-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.state-select-dropdown {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--so-ink);
  background: var(--so-white);
  border: 2px solid var(--so-gold);
  border-radius: var(--so-radius-sm);
  padding: 0.5rem 2.25rem 0.5rem 0.85rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230B3D91' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  min-width: 200px;
  transition: var(--so-transition);
}

.state-select-dropdown:focus {
  outline: 3px solid var(--so-gold);
  outline-offset: 2px;
}

.state-select-dropdown:hover {
  border-color: var(--so-navy);
}

/* Active state badge */
.state-active-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: rgba(212,175,55,0.15);
  border: 1px solid var(--so-gold);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--so-gold);
  white-space: nowrap;
}

.state-active-badge.visible {
  display: flex;
}

.state-badge-flag {
  font-size: 1rem;
}

.state-badge-change {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0.25rem;
  text-decoration: underline;
  font-family: inherit;
  transition: color 0.2s;
}

.state-badge-change:hover {
  color: var(--so-gold);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATE OVERLAY PANELS (injected into guide steps)
   ═══════════════════════════════════════════════════════════════════════════ */

.state-overlay-panel {
  background: var(--so-overlay-bg);
  border-left: 4px solid var(--so-navy);
  border-radius: 0 var(--so-radius) var(--so-radius) 0;
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
  position: relative;
  overflow: hidden;
  /* Animation */
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.state-overlay-panel.visible {
  opacity: 1;
  transform: translateY(0);
}

.state-overlay-panel.expansion-panel {
  background: var(--so-success-bg);
  border-left-color: var(--so-sage);
}

.state-overlay-panel.no-expansion-panel {
  background: var(--so-warn-bg);
  border-left-color: var(--so-gold);
}

.state-overlay-panel.insider-tip-panel {
  background: linear-gradient(135deg, #FBF5DC 0%, #FFF9EC 100%);
  border-left-color: var(--so-gold);
}

/* Panel header */
.state-overlay-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.state-overlay-flag {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.state-overlay-label {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--so-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.state-overlay-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--so-navy);
  margin: 0;
  line-height: 1.3;
}

/* Panel body */
.state-overlay-body {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--so-ink);
  margin: 0;
}

.state-overlay-body p {
  margin: 0 0 0.5rem 0;
  max-width: none;
}

.state-overlay-body p:last-child {
  margin-bottom: 0;
}

.state-overlay-body a {
  color: var(--so-navy);
  font-weight: 600;
  word-break: break-all;
}

.state-overlay-body a:hover {
  color: var(--so-gold);
}

.state-overlay-body strong {
  font-weight: 700;
  color: var(--so-navy);
}

/* Income limits table inside overlay */
.state-income-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

.state-income-table th {
  background: var(--so-navy);
  color: var(--so-white);
  padding: 0.4rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.state-income-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--so-border);
  color: var(--so-ink);
}

.state-income-table tr:last-child td {
  border-bottom: none;
}

.state-income-table tr:nth-child(even) td {
  background: rgba(11,61,145,0.03);
}

/* Quick action links inside overlay */
.state-overlay-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.state-overlay-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--so-navy);
  color: var(--so-white);
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--so-transition);
  white-space: nowrap;
}

.state-overlay-action-btn:hover {
  background: var(--so-navy-dark);
  color: var(--so-gold);
  text-decoration: none;
}

.state-overlay-action-btn.secondary {
  background: transparent;
  color: var(--so-navy);
  border: 2px solid var(--so-navy);
}

.state-overlay-action-btn.secondary:hover {
  background: var(--so-navy);
  color: var(--so-white);
}

/* Insider tip special styling */
.insider-tip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--so-gold);
  color: var(--so-navy);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATE SELECTOR WITHIN STEP (compact inline version)
   ═══════════════════════════════════════════════════════════════════════════ */

.state-overlay-placeholder {
  background: var(--so-bg);
  border: 2px dashed var(--so-border);
  border-radius: var(--so-radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  text-align: center;
  color: var(--so-ink-light);
  font-size: 0.9rem;
  font-style: italic;
}

.state-overlay-placeholder button {
  background: none;
  border: none;
  color: var(--so-navy);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVIEW FLAG NOTICE (Georgia and others)
   ═══════════════════════════════════════════════════════════════════════════ */

.state-review-flag {
  background: #FFF3CD;
  border: 1px solid #FFC107;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #856404;
  margin-top: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .state-selector-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }

  .state-selector-controls {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .state-select-dropdown {
    width: 100%;
    min-width: unset;
  }

  .state-active-badge {
    width: 100%;
    justify-content: space-between;
  }

  .state-overlay-panel {
    padding: 0.9rem 1rem;
  }

  .state-overlay-actions {
    flex-direction: column;
  }

  .state-overlay-action-btn {
    width: 100%;
    justify-content: center;
  }

  .state-income-table {
    font-size: 0.8rem;
  }

  .state-income-table th,
  .state-income-table td {
    padding: 0.35rem 0.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  .state-selector-banner { display: none; }
  .state-overlay-panel {
    border: 1px solid #ccc;
    background: #f9f9f9 !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
