/**
 * Calculator Page Styles
 * 
 * Consolidated styles for all calculator pages.
 * This file contains all CSS that was previously inlined in calculator PHP files.
 * Load this file for all calculator pages.
 */

/********************************
 * Age Calculator Specific
 ********************************/
.age-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.age-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  text-align: center;
  transition: transform 0.2s;
}
.age-stat-card:hover { border-color: var(--primary-400); transform: translateY(-2px); }
.age-stat-value { font-size: 2.5rem; font-weight: 700; color: var(--primary-600); display: block; }
.age-stat-label { font-size: var(--font-size-sm); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

.life-metrics {
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  margin-top: var(--space-8);
}
.metric-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--text-secondary); }
.metric-value { font-weight: 600; color: var(--text-primary); }

.next-birthday-banner {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-lg);
}
.next-birthday-banner h4 { margin: 0; font-size: 1.25rem; opacity: 0.9; }
.next-birthday-countdown { font-size: 2rem; font-weight: 800; margin: var(--space-2) 0; }

/********************************
 * Calculator Layout & Typography
 ********************************/
.calculator-section {
  padding: var(--space-4) 0;
  background: var(--bg);
  margin-bottom: var(--space-12);
}

.calculator-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.calculator-grid,
.calculator-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: stretch;
}

@media (max-width: 992px) {
  .calculator-grid,
  .calculator-form-grid {
    grid-template-columns: 1fr;
  }
}

/********************************
 * Calculator Input Panel
 ********************************/
.calculator-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/********************************
 * Input Groups
 ********************************/
.input-group {
  display: flex;
  align-items: stretch;
  position: relative;
}

.input-prefix,
.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
}

.input-prefix {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: none;
}

.input-suffix {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left: none;
}

.input-group .form-input {
  border-radius: 0;
  text-align: right;
}

.input-group .form-input:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .form-input:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/********************************
 * Range Slider Styling
 ********************************/
.range-slider {
  width: 100%;
  height: 6px;
  margin-top: var(--space-3);
  background: var(--neutral-200);
  border-radius: var(--radius-full);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-600);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-600);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/********************************
 * Results Panel
 ********************************/
.calculator-results {
  position: sticky;
  top: calc(72px + var(--space-4));
}

.results-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.results-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

/********************************
 * Results Grid
 ********************************/
.results-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.result-item:hover {
  background: var(--surface-hover);
}

.result-item.highlight {
  background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
  border: 1px solid var(--primary-200);
}

.result-item.highlight .result-value {
  color: var(--primary-600);
  font-size: var(--font-size-xl);
}

.result-label {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.result-value {
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  font-family: var(--font-display);
}

/********************************
 * Chart Container
 ********************************/
.chart-container {
  position: relative;
  height: 250px;
  margin-top: var(--space-4);
}

/********************************
 * Info Section
 ********************************/
.info-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-12);
}

.info-section h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-4);
}

.info-section h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.info-section p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.info-section ol,
.info-section ul {
  margin-left: var(--space-6);
  color: var(--text-secondary);
}

.info-section li {
  margin-bottom: var(--space-2);
  line-height: var(--line-height-relaxed);
}

.info-section ol {
  list-style: decimal;
}

.info-section ul {
  list-style: disc;
}

/********************************
 * Related Tools Section
 ********************************/
.related-tools {
  margin-bottom: var(--space-12);
}

.related-tools h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-6);
}

/********************************
 * Page Header
 ********************************/
.page-header {
  text-align: center;
  padding: var(--space-8) 0;
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.page-description {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/********************************
 * Breadcrumb
 ********************************/
.breadcrumb {
  margin-bottom: var(--space-4);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.breadcrumb li::after {
  content: '/';
  margin-left: var(--space-2);
  color: var(--text-tertiary);
}

.breadcrumb li:last-child::after {
  display: none;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary-600);
}

.breadcrumb [aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

/********************************
 * Form Error States
 ********************************/
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--error);
}

/********************************
 * Loading State
 ********************************/
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/********************************
 * Calculator Tabs - Premium Design
 ********************************/
.calculator-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto var(--space-8) auto;
  padding: var(--space-1);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: var(--space-1);
  box-shadow: var(--shadow-sm);
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.calculator-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.tab-button {
  padding: var(--space-3) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.tab-button i {
  font-size: 1.1rem;
  transition: transform var(--transition-normal);
}

.tab-button:hover i {
  transform: scale(1.1);
}

.tab-button:hover {
  color: var(--primary-600);
  background: var(--surface-hover);
}

.tab-button.active {
  color: var(--text-inverse);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Glassmorphism effect in dark mode */
:root[data-theme="dark"] .calculator-tabs {
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(99, 102, 241, 0.2);
}

.tab-content {
  display: none;
  opacity: 0;
}

.tab-content.active {
  display: block;
  animation: slideUpFadeIn 0.5s var(--transition-spring) forwards;
}

/********************************
 * Formula Card - Premium Design
 ********************************/
.formula-card {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: all var(--transition-normal);
}

.formula-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.formula-card .formula-title {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.formula-card .formula-text {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.formula-card .formula-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/********************************
 * Guidelines / Rules Cards
 ********************************/
.guidelines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
  align-items: stretch;
}

.guidelines-card {
  background: var(--bg-secondary);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
}

.guidelines-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.guidelines-card h4 {
  color: var(--primary-700);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-lg);
}

.guidelines-card ul {
  padding-left: 1.2rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  list-style-type: disc;
}

.guidelines-card li {
  margin-bottom: var(--space-2);
}

:root[data-theme="dark"] .guidelines-card {
  background: var(--surface);
  border-color: var(--border);
}

:root[data-theme="dark"] .guidelines-card h4 {
  color: var(--primary-400);
}

@media (max-width: 576px) {
  .guidelines-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .guidelines-card {
    padding: var(--space-5);
  }
}

/* Light Mode specific (more colorful) */
:root[data-theme="light"] .formula-card {
  background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
  border-color: var(--primary-200);
}

/* Dark Mode specific (subtle and deep) */
:root[data-theme="dark"] .formula-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.08));
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

@keyframes slideUpFadeIn {
  from { 
    opacity: 0; 
    transform: translateY(15px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Mobile specific overrides */
@media (max-width: 576px) {
  .calculator-tabs {
    justify-content: flex-start;
    padding: var(--space-1);
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    border-radius: var(--radius-xl);
  }
  
  .tab-button {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-xs);
    flex: 1 0 auto;
    text-align: center;
    gap: var(--space-1-5);
  }

  .tab-button i {
    font-size: 0.95rem;
  }
}

/********************************
 * Form Sections
 ********************************/
.form-section {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden; /* prevent content from spilling out */
}

/* Global fix for button groups to prevent overflow on mobile */
.form-section .flex.gap-2,
.form-section .flex.gap-3,
.form-section .flex.gap-4 {
  flex-wrap: wrap;
}

.form-section .flex.gap-2 > button,
.form-section .flex.gap-3 > button,
.form-section .flex.gap-4 > button {
  flex: 1 1 auto;
  min-width: 120px;
}

@media (max-width: 576px) {
  .form-section {
    padding: var(--space-4);
    border-radius: var(--radius-xl);
  }
}

.form-section h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-5);
  color: var(--primary-600);
}

.calculator-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-5);
  color: var(--primary-600);
}

/********************************
 * Form Controls
 ********************************/
.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: all var(--transition-normal);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/********************************
 * Range Container
 ********************************/
.range-container {
  margin-top: var(--space-2);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/********************************
 * Calculate Button
 ********************************/
.calculate-button {
  grid-column: 1 / -1;
  padding: var(--space-4) var(--space-8);
  background: var(--gradient-button);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: var(--font-size-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.calculate-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.calculate-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

/********************************
 * Results Section
 ********************************/
.results-section {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--space-8);
  border: 1px solid var(--border);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.results-header h3 {
  font-size: var(--font-size-2xl);
  color: var(--primary-600);
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.result-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-align: center;
  transition: all var(--transition-normal);
  border: 1px solid var(--border);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.result-card h4 {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.result-card .value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--primary-600);
  font-family: var(--font-display);
}

.result-card .value.positive {
  color: var(--success);
}

.result-card .value.negative {
  color: var(--error);
}

/********************************
 * Chart Tabs
 ********************************/
.chart-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chart-tab {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.chart-tab:hover {
  background: var(--surface-hover);
  color: var(--primary-600);
}

.chart-tab.active {
  background: var(--primary-600);
  color: var(--text-inverse);
  border-color: var(--primary-600);
}

/********************************
 * Export Buttons
 ********************************/
.export-buttons {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.export-button {
  padding: var(--space-3) var(--space-5);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.export-button:hover {
  background: var(--surface-hover);
  color: var(--primary-600);
  border-color: var(--primary-600);
}

/********************************
 * Growth Table
 ********************************/
.growth-table-container {
  margin-top: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-height: 400px;
  overflow-y: auto;
}

.growth-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-4);
  background: var(--surface);
}

.growth-table th,
.growth-table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.growth-table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  z-index: 1;
}

.growth-table tr:hover {
  background-color: var(--bg-secondary);
}

/********************************
 * Recommendation Box
 ********************************/
.recommendation-box {
  background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-top: var(--space-6);
}

.recommendation-box h4 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--primary-600);
  margin-bottom: var(--space-3);
}

.recommendation-box p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

/********************************
 * Projection Summary
 ********************************/
.projection-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-4);
}

.projection-summary p {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.projection-summary p:last-child {
  margin-bottom: 0;
}

/********************************
 * Toggle Switch
 ********************************/
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.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(--neutral-300);
  transition: var(--transition-normal);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-normal);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-600);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/********************************
 * Optional Label
 ********************************/
.optional {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-weight: 400;
}

/********************************
 * Info Cards Grid
 ********************************/
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.info-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  border: 1px solid var(--border);
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.info-card h4 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.info-card h4 i {
  color: var(--primary-600);
}

.info-card p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

/********************************
 * FAQ Section
 ********************************/
.faq-section {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.faq-section h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-6);
  color: var(--primary-600);
}

.faq-item {
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-4);
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.faq-question {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.faq-question:hover {
  background: var(--bg-secondary);
}

.faq-question i {
  transition: transform var(--transition-normal);
}

.faq-question.active i {
  transform: rotate(180deg);
}

.faq-answer {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  display: none;
  padding: 0 var(--space-3);
}

.faq-answer.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

/********************************
 * Ads Container
 ********************************/
.ads-container {
  margin: var(--space-8) 0;
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid var(--border);
}

.ads-placeholder {
  padding: var(--space-8);
  background-color: var(--neutral-100);
  border-radius: var(--radius-lg);
  color: var(--text-tertiary);
  font-style: italic;
}

/********************************
 * Responsive Adjustments
 ********************************/
@media (max-width: 639px) {
  .calculator-tabs {
    padding: 0 var(--space-2);
  }
  
  .tab-button {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    min-width: auto;
  }
  
  .results-section {
    padding: var(--space-4);
  }
  
  .results-summary {
    grid-template-columns: 1fr;
  }
  
  .result-card {
    padding: var(--space-3);
  }
  
  .result-card .value {
    font-size: var(--font-size-xl);
  }
  
  .chart-container {
    height: 250px;
  }
  
  .export-buttons {
    width: 100%;
  }
  
  .export-button {
    flex: 1;
    justify-content: center;
  }
  
  .growth-table {
    font-size: var(--font-size-sm);
  }
  
  .growth-table th,
  .growth-table td {
    padding: var(--space-2);
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .faq-section {
    padding: var(--space-5);
  }
}

@media (max-width: 380px) {
  .calculator-section {
    padding: var(--space-2) 0;
  }
  .form-section {
    padding: var(--space-3);
  }
  .form-control, .form-select {
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-3);
  }
  .calculate-button {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
  }
  .hero h1 {
    font-size: 2rem;
  }
  .calculator-title, .form-section h3 {
    font-size: var(--font-size-lg);
  }
  .info-card {
    padding: var(--space-4);
  }
}

@media (min-width: 640px) and (max-width: 991px) {
  .results-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .results-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-container {
    height: 350px;
  }
}

/********************************
 * Two-Column Calculator Form Grid (full-page tabbed calculators)
 ********************************/
.calculator-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
  align-items: stretch;
}

@media (max-width: 768px) {
  .calculator-form-grid {
    grid-template-columns: 1fr;
  }
}

/********************************
 * Result Card Highlight Variant
 ********************************/
.result-card-highlight {
  transition: all var(--transition-normal);
}

:root[data-theme="light"] .result-card-highlight {
  background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
  border-color: var(--primary-200) !important;
}

:root[data-theme="dark"] .result-card-highlight {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  border-color: var(--primary-500) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

:root[data-theme="dark"] .result-card-highlight h4 {
  color: rgba(255, 255, 255, 0.8) !important;
}

:root[data-theme="dark"] .result-card-highlight .value {
  color: #ffffff !important;
}

/********************************
 * Winner Banner (Comparison tab)
 ********************************/
.winner-banner {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: var(--font-size-base);
  text-align: center;
  display: none;
}

.winner-banner.sip-wins {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border: 1px solid #6ee7b7;
  display: block;
}

.winner-banner.lumpsum-wins {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e3a8a;
  border: 1px solid #93c5fd;
  display: block;
}

/********************************
 * Hero Badges
 ********************************/
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--primary-600);
}

/********************************
 * Inline Select (period frequency)
 ********************************/
.form-select-inline {
  width: auto !important;
  flex-shrink: 0;
  margin-left: var(--space-2);
  padding: var(--space-3) var(--space-3);
  min-width: 110px;
}

/********************************
 * Info Card Icon
 ********************************/
.info-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-4);
}

/********************************
 * Full-page Info Section
 ********************************/
.info-section.full-page {
  background: var(--bg-secondary);
  border-radius: 0;
  border: none;
  padding: var(--space-20) 0;
  margin-bottom: 0;
}

.info-section.full-page .info-card {
  background: var(--surface);
}

/********************************
 * Full-page FAQ Section
 ********************************/
.faq-section.full-page {
  background: var(--bg);
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: var(--space-20) 0;
}

.faq-section.full-page .faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding-bottom: 0;
}

.faq-section.full-page .faq-item:last-child {
  border-bottom: 1px solid var(--border);
}

.faq-section.full-page .faq-question {
  padding: var(--space-5) var(--space-6);
  border-radius: 0;
}

.faq-section.full-page .faq-answer {
  padding: 0 var(--space-6) var(--space-5);
}

/********************************
 * Section Header
 ********************************/
.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-header h2 {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.section-header p {
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  max-width: 600px;
  margin: 0 auto;
}

/********************************
 * Canvas Chart Height Fix
 ********************************/
#sip-chart,
#lumpsum-chart,
#comparison-chart {
  width: 100% !important;
  max-height: 360px;
}

/********************************
 * AI Content Rendering (Markdown)
 ********************************/
.ai-output-content {
  line-height: 1.6;
  color: var(--text-primary);
}

.ai-output-content h1, 
.ai-output-content h2, 
.ai-output-content h3, 
.ai-output-content h4 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  color: var(--primary-600);
  font-weight: 700;
}

.ai-output-content h1 { font-size: 1.5rem; }
.ai-output-content h2 { font-size: 1.25rem; }
.ai-output-content h3 { font-size: 1.1rem; }

.ai-output-content p {
  margin-bottom: var(--space-3);
}

.ai-output-content ul, 
.ai-output-content ol {
  margin-left: var(--space-5);
  margin-bottom: var(--space-3);
}

.ai-output-content li {
  margin-bottom: var(--space-1);
}

.ai-output-content code {
  background: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.9em;
}

.ai-output-content pre {
  background: var(--bg-secondary);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

.ai-output-content blockquote {
  border-left: 4px solid var(--primary-300);
  padding-left: var(--space-4);
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-3);
}

