/**
 * Health Plan Optimizer Styles
 * Tool-specific styles for the HDHP vs Traditional calculator
 */

/* ===== Tool Hero ===== */
.tool-hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.tool-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.tool-hero h1 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.tool-tagline {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.tool-badge {
  display: inline-block;
  background: var(--accent-primary);
  color: #000;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

/* ===== Calculator Container ===== */
.optimizer-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 1024px) {
  .optimizer-container {
    grid-template-columns: 1fr;
  }
}

/* ===== Form Section ===== */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.form-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.form-actions button {
  flex: 1;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
}

.btn-quick-fill {
  background: var(--accent-primary);
  color: #000;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-quick-fill:hover {
  background: var(--accent-primary-hover);
}

.btn-reset {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ===== Form Groups ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* Input with prefix/suffix */
.input-with-addon {
  display: flex;
  align-items: stretch;
}

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.input-addon-left {
  border-right: none;
  border-radius: 6px 0 0 6px;
}

.input-addon-right {
  border-left: none;
  border-radius: 0 6px 6px 0;
}

.input-with-addon input {
  border-radius: 0;
  flex: 1;
}

.input-with-addon input:first-child {
  border-radius: 6px 0 0 6px;
}

.input-with-addon input:last-child {
  border-radius: 0 6px 6px 0;
}

/* ===== Form Sections ===== */
.form-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section-title:first-child {
  margin-top: 0;
}

/* ===== Plan Comparison Grid ===== */
.plan-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.plan-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.plan-column h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.plan-column .form-group {
  margin-bottom: 1rem;
}

.plan-column .form-group:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .plan-comparison {
    grid-template-columns: 1fr;
  }
}

/* ===== Radio Group ===== */
.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  width: auto;
  margin: 0;
}

/* ===== Toggle Switch ===== */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.toggle-group:last-child {
  border-bottom: none;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.toggle-label span {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.toggle-label small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  transition: 0.2s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  background-color: #000;
  transform: translateX(24px);
}

/* ===== Usage Slider ===== */
.usage-slider-container {
  margin-top: 0.5rem;
}

.usage-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  outline: none;
  -webkit-appearance: none;
}

.usage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.usage-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
}

.usage-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.usage-current {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-primary);
}

/* ===== Advanced Mode ===== */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.advanced-field {
  display: none;
}

/* ===== Validation Errors ===== */
#validation-errors {
  display: none;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

#validation-errors p {
  color: #ef4444;
  font-size: 0.875rem;
  margin: 0.25rem 0;
}

/* ===== Results Section ===== */
.results-section {
  display: none;
}

.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.results-card h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== Primary Results ===== */
.primary-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.result-column {
  text-align: center;
}

.result-column h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.result-column .amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== Difference Display ===== */
.difference-display {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.diff-positive .amount {
  color: var(--accent-primary);
}

.diff-negative .amount {
  color: #ef4444;
}

.diff-neutral .amount {
  color: var(--text-muted);
}

.difference-display .winner {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.difference-display .amount {
  font-size: 2.5rem;
  font-weight: 700;
}

.difference-display .per-year {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== Confidence Badge ===== */
.confidence-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.confidence-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.confidence-high {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-primary);
}

.confidence-medium {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.confidence-low {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.confidence-explanation {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== Recommendation ===== */
.recommendation {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ===== Breakdown Table ===== */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.breakdown-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.breakdown-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown-table tr.total-row td {
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--border-color);
}

.breakdown-table .tax-row td {
  color: var(--accent-primary);
}

.breakdown-table small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.state-warning {
  color: #fbbf24 !important;
}

/* ===== Wealth Impact Panel ===== */
.wealth-panel {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

.wealth-panel h3 {
  font-size: 0.875rem;
  color: var(--accent-secondary);
  margin-bottom: 1rem;
}

.wealth-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wealth-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.wealth-item span:first-child {
  color: var(--text-secondary);
}

.wealth-item span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.wealth-item.total {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  font-weight: 700;
}

.wealth-item.total span:last-child {
  color: var(--accent-secondary);
}

/* ===== Break-Even ===== */
.break-even {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 1rem;
}

.break-even h4 {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.break-even p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: 0;
}

/* ===== Stress Test Table ===== */
.stress-test-section {
  display: none;
  margin-top: 1rem;
}

.stress-test-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.stress-test-table th,
.stress-test-table td {
  padding: 0.625rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.stress-test-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
}

.stress-test-table td.positive {
  color: var(--accent-primary);
}

.stress-test-table td.negative {
  color: #ef4444;
}

/* ===== Range Section ===== */
.range-section {
  display: none;
  margin-top: 1rem;
}

.range-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.range-table th,
.range-table td {
  padding: 0.625rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.range-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
}

.range-table th:first-child,
.range-table td:first-child {
  text-align: left;
}

/* ===== Assumptions/Disclaimers ===== */
.assumptions {
  margin-top: 1.5rem;
}

.assumptions summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.5rem 0;
}

.assumptions summary:hover {
  color: var(--text-primary);
}

.assumptions-content {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 0.5rem;
}

.assumptions-content ul {
  margin: 0;
  padding-left: 1.25rem;
}

.assumptions-content li {
  margin-bottom: 0.375rem;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* ===== State Warning ===== */
#state-warning {
  display: none;
  font-size: 0.75rem;
  color: #fbbf24;
  margin-top: 0.25rem;
}

/* ===== Light Theme Overrides ===== */
[data-theme="light"] .btn-quick-fill {
  color: #000;
}

[data-theme="light"] .toggle-switch input:checked + .toggle-slider:before {
  background-color: #fff;
}

[data-theme="light"] .recommendation {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.1) 0%, rgba(22, 163, 74, 0.05) 100%);
  border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="light"] .wealth-panel {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.03) 100%);
}

[data-theme="light"] #validation-errors {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
}

[data-theme="light"] #validation-errors p {
  color: #dc2626;
}

[data-theme="light"] .confidence-high {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

[data-theme="light"] .confidence-medium {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

[data-theme="light"] .confidence-low {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 600px) {
  .form-section {
    padding: 1rem;
  }

  .plan-comparison {
    grid-template-columns: 1fr;
  }

  .primary-results {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .result-column .amount {
    font-size: 1.5rem;
  }

  .difference-display .amount {
    font-size: 2rem;
  }

  .breakdown-table {
    font-size: 0.8125rem;
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.5rem;
  }

  .confidence-section {
    flex-direction: column;
    text-align: center;
  }
}
