/* AGE CALCULATOR - STYLESHEET - Purple Theme */
:root {
  --primary: #a855f7;
  --primary-dark: #9333ea;
  --primary-light: #c084fc;
  --primary-bg: #faf5ff;
  --secondary: #581c87;
  --accent: #f59e0b;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --error: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); font-size: 16px; line-height: 1.6; color: var(--gray-800); background: var(--gray-50); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-weight: 600; line-height: 1.3; color: var(--gray-900); }
h1 { font-size: 2.25rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; }
p { margin-bottom: 1rem; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); text-decoration: underline; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.content-narrow { max-width: 800px; margin: 0 auto; }
main { flex: 1; padding: 2rem 0 3rem; }

/* Header */
.header { background: var(--secondary); border-bottom: 1px solid var(--primary-dark); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.125rem; color: white; text-decoration: none; }
.logo:hover { text-decoration: none; color: var(--primary-light); }
.logo-icon { width: 32px; height: 32px; color: var(--primary-light); }
.nav-desktop { display: flex; align-items: center; gap: 1.5rem; }
.nav-desktop > a, .nav-dropdown > .nav-dropdown-toggle { font-size: 0.9375rem; font-weight: 500; color: rgba(255,255,255,0.8); padding: 0.5rem 0; border-bottom: 2px solid transparent; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 0.25rem; }
.nav-desktop > a:hover, .nav-desktop > a.active, .nav-dropdown:hover > .nav-dropdown-toggle { color: white; text-decoration: none; border-bottom-color: var(--primary-light); }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle svg { width: 14px; height: 14px; transition: transform 0.2s; }
.nav-dropdown:hover .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 200px; padding: 0.5rem 0; padding-top: 0.5rem; z-index: 100; }
.nav-dropdown-menu::before { content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 12px; background: transparent; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 0.5rem 1rem; color: var(--gray-700); font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.nav-dropdown-menu a:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.nav-dropdown-menu a.active { color: var(--primary); background: var(--primary-bg); }
.nav-toggle { display: none; background: none; border: none; padding: 0.5rem; cursor: pointer; color: white; }
.nav-toggle svg { width: 24px; height: 24px; }
.nav-mobile { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--secondary); border-bottom: 1px solid var(--primary-dark); padding: 1rem; box-shadow: var(--shadow-lg); }
.nav-mobile.active { display: block; }
.nav-mobile a { display: block; padding: 0.5rem 1rem; color: rgba(255,255,255,0.9); font-weight: 500; border-radius: var(--radius-md); }
.nav-mobile-section { padding: 0.5rem 1rem 0.25rem; font-size: 0.6875rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem; }
.nav-mobile a.sub { padding-left: 1.5rem; font-size: 0.875rem; color: rgba(255,255,255,0.7); }
@media (max-width: 768px) { .nav-desktop { display: none; } .nav-toggle { display: block; } }

/* Calculator Card */
.intro-text { font-size: 1.125rem; color: var(--gray-600); margin-bottom: 1.5rem; max-width: 700px; }
.calculator-card { background: white; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); margin-bottom: 1.5rem; overflow: hidden; max-width: 720px; margin-left: auto; margin-right: auto; }

.calc-tabs { display: flex; background: var(--secondary); border-bottom: 1px solid var(--primary-dark); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calc-tab { flex: 1; min-width: 70px; padding: 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 500; color: rgba(255,255,255,0.7); background: transparent; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.calc-tab:hover { color: white; background: rgba(255,255,255,0.1); }
.calc-tab.active { color: white; background: rgba(168,85,247,0.3); border-bottom-color: var(--primary-light); }
.calc-tab svg { width: 18px; height: 18px; }
.calc-panel { display: none; padding: 1.25rem; }
.calc-panel.active { display: block; }

/* Form Elements */
.form-grid { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--gray-700); }
.form-hint { font-size: 0.75rem; color: var(--gray-500); }
.form-input { width: 100%; height: 44px; padding: 0 1rem; font-size: 1rem; color: var(--gray-800); background: white; border: 1px solid var(--gray-300); border-radius: var(--radius-md); }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-select { height: 44px; padding: 0 1rem; font-size: 1rem; color: var(--gray-800); background: white; border: 1px solid var(--gray-300); border-radius: var(--radius-md); cursor: pointer; width: 100%; }

.calculate-btn { width: 100%; height: 48px; margin-top: 1rem; font-size: 1rem; font-weight: 600; color: white; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); border: none; border-radius: var(--radius-lg); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; box-shadow: 0 4px 14px 0 rgba(168, 85, 247, 0.4); }
.calculate-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px 0 rgba(168, 85, 247, 0.5); }

/* Results Section */
.results-section { display: none; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-200); }
.results-section.visible { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Age Result Card */
.age-result-card { text-align: center; padding: 2rem; margin-bottom: 1.5rem; border-radius: var(--radius-xl); background: linear-gradient(135deg, var(--primary-bg) 0%, #f3e8ff 100%); border: 2px solid var(--primary-light); }
.age-value { font-size: 4rem; font-weight: 700; color: var(--primary-dark); line-height: 1; margin-bottom: 0.5rem; }
.age-label { font-size: 1.25rem; color: var(--gray-600); }
.age-sublabel { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.25rem; }

/* Results Grid */
.results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-top: 1rem; }
.results-grid-3 { grid-template-columns: repeat(3, 1fr); }
.results-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 600px) { .results-grid, .results-grid-3, .results-grid-4 { grid-template-columns: repeat(2, 1fr); } }
.result-item { padding: 0.875rem; background: var(--gray-50); border-radius: var(--radius-md); text-align: center; }
.result-item-label { font-size: 0.6875rem; color: var(--gray-500); margin-bottom: 0.25rem; text-transform: uppercase; }
.result-item-value { font-size: 1.125rem; font-weight: 600; color: var(--gray-800); }
.result-item-value.highlight { color: var(--primary-dark); }

/* Birthday Countdown */
.countdown-card { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; padding: 1.5rem; border-radius: var(--radius-xl); text-align: center; margin: 1rem 0; }
.countdown-title { font-size: 0.875rem; opacity: 0.9; margin-bottom: 0.5rem; }
.countdown-value { font-size: 2rem; font-weight: 700; }
.countdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 1rem; }
.countdown-item { background: rgba(255,255,255,0.2); padding: 0.75rem 0.5rem; border-radius: var(--radius-md); }
.countdown-item-value { font-size: 1.5rem; font-weight: 700; }
.countdown-item-label { font-size: 0.6875rem; opacity: 0.9; }

/* Content Sections */
.content-section { background: white; border-radius: var(--radius-xl); box-shadow: var(--shadow-md); padding: 1.5rem; margin-bottom: 1.5rem; max-width: 800px; margin-left: auto; margin-right: auto; }
.content-section h2 { margin-top: 0; }
.content-section h2::after { content: ''; display: block; width: 60px; height: 3px; background: var(--primary); margin-top: 0.5rem; border-radius: var(--radius-full); }

/* Key Takeaways */
.key-takeaways { background: var(--primary-bg); border: 1px solid var(--primary-light); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.5rem; max-width: 800px; margin-left: auto; margin-right: auto; }
.key-takeaways-title { font-weight: 600; color: var(--primary-dark); margin-bottom: 0.5rem; font-size: 0.9375rem; }
.key-takeaways ul { margin: 0; padding-left: 1.25rem; font-size: 0.875rem; }
.key-takeaways li { margin-bottom: 0.375rem; color: var(--gray-700); }

/* Tables */
.table-responsive { overflow-x: auto; margin: 1rem 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
.data-table th { font-weight: 600; color: var(--gray-700); background: var(--gray-50); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
.faq-question { width: 100%; padding: 1rem; display: flex; align-items: center; justify-content: space-between; font-size: 0.9375rem; font-weight: 500; text-align: left; color: var(--gray-800); background: var(--gray-50); border: none; cursor: pointer; }
.faq-question:hover { background: var(--gray-100); }
.faq-question svg { width: 18px; height: 18px; color: var(--gray-400); transition: transform 0.15s ease; flex-shrink: 0; }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer { display: none; padding: 1rem; background: white; font-size: 0.9375rem; }
.faq-item.open .faq-answer { display: block; }

/* Blog Grid */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.blog-card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.blog-card-content { padding: 1rem; }
.blog-card-meta { font-size: 0.75rem; color: var(--gray-500); margin-bottom: 0.375rem; }
.blog-card h3 { margin: 0 0 0.375rem; font-size: 1rem; }
.blog-card h3 a { color: var(--gray-900); }
.blog-card p { font-size: 0.8125rem; color: var(--gray-600); margin-bottom: 0; }

/* Fun Facts */
.fun-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 1rem 0; }
@media (max-width: 600px) { .fun-facts { grid-template-columns: 1fr; } }
.fun-fact { display: flex; gap: 0.75rem; padding: 0.875rem; background: var(--gray-50); border-radius: var(--radius-md); }
.fun-fact-icon { font-size: 1.5rem; }
.fun-fact-content h4 { font-size: 0.875rem; margin: 0 0 0.25rem; }
.fun-fact-content p { font-size: 0.8125rem; margin: 0; color: var(--gray-600); }

/* Footer */
.footer { background: var(--gray-900); color: var(--gray-400); padding: 2.5rem 0 1.5rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand .logo { color: white; margin-bottom: 1rem; }
.footer-brand .logo-icon { color: var(--primary-light); }
.footer-brand p { font-size: 0.875rem; }
.footer-nav h4 { color: white; font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; margin-bottom: 1rem; }
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: 0.5rem; }
.footer-nav a { font-size: 0.875rem; color: var(--gray-400); }
.footer-nav a:hover { color: white; text-decoration: none; }
.footer-bottom { padding-top: 1.5rem; border-top: 1px solid var(--gray-800); font-size: 0.8125rem; text-align: center; }

/* Related Grid (Blog Articles) */
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-top: 2rem; }
@media (max-width: 600px) { .related-grid { grid-template-columns: 1fr; } }
.related-card { display: block; padding: 1rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); text-decoration: none; }
.related-card:hover { background: var(--primary-bg); border-color: var(--primary-light); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card-title { font-size: 0.9375rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.25rem; }
.related-card-desc { font-size: 0.8125rem; color: var(--gray-600); margin: 0; }

/* CSS Charts */
.chart-bar-group { display: flex; flex-direction: column; gap: 0.625rem; margin: 1rem 0; }
.chart-bar-item { display: flex; align-items: center; gap: 0.75rem; }
.chart-bar-label { min-width: 120px; font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); text-align: right; }
.chart-bar-track { flex: 1; height: 28px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; position: relative; }
.chart-bar-fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%); display: flex; align-items: center; justify-content: flex-end; padding-right: 0.5rem; font-size: 0.75rem; font-weight: 600; color: white; min-width: 2rem; }
.chart-bar-fill.accent { background: linear-gradient(90deg, var(--accent) 0%, #d97706 100%); }
.chart-bar-fill.success { background: linear-gradient(90deg, var(--success) 0%, #16a34a 100%); }
.chart-bar-fill.error { background: linear-gradient(90deg, var(--error) 0%, #dc2626 100%); }
@media (max-width: 600px) { .chart-bar-label { min-width: 80px; font-size: 0.75rem; } }

/* Comparison bars (male/female, before/after) */
.chart-compare { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }
.chart-compare-row { display: flex; flex-direction: column; gap: 0.25rem; }
.chart-compare-label { font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); }
.chart-compare-bars { display: flex; gap: 0.375rem; align-items: center; }
.chart-compare-bar { height: 24px; border-radius: var(--radius-full); display: flex; align-items: center; padding: 0 0.5rem; font-size: 0.6875rem; font-weight: 600; color: white; min-width: 2rem; }
.chart-compare-bar.male { background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%); justify-content: flex-end; }
.chart-compare-bar.female { background: linear-gradient(90deg, #ec4899 0%, #db2777 100%); justify-content: flex-end; }
.chart-compare-legend { display: flex; gap: 1rem; margin-bottom: 0.5rem; font-size: 0.75rem; color: var(--gray-600); }
.chart-compare-legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 0.375rem; vertical-align: middle; }
.chart-compare-legend .legend-male::before { background: #3b82f6; }
.chart-compare-legend .legend-female::before { background: #ec4899; }

/* Stacked percentage bar */
.chart-stacked { margin: 1rem 0; }
.chart-stacked-bar { display: flex; height: 36px; border-radius: var(--radius-full); overflow: hidden; margin-bottom: 0.5rem; }
.chart-stacked-segment { display: flex; align-items: center; justify-content: center; font-size: 0.6875rem; font-weight: 600; color: white; min-width: 1.5rem; padding: 0 0.25rem; }
.chart-stacked-segment:nth-child(1) { background: var(--primary); }
.chart-stacked-segment:nth-child(2) { background: var(--primary-dark); }
.chart-stacked-segment:nth-child(3) { background: var(--accent); }
.chart-stacked-segment:nth-child(4) { background: var(--success); }
.chart-stacked-segment:nth-child(5) { background: #3b82f6; }
.chart-stacked-segment:nth-child(6) { background: var(--error); }
.chart-stacked-segment:nth-child(7) { background: var(--gray-500); }
.chart-stacked-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.75rem; color: var(--gray-600); }
.chart-stacked-legend span { display: flex; align-items: center; gap: 0.375rem; }
.chart-stacked-legend span::before { content: ''; width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.chart-stacked-legend span:nth-child(1)::before { background: var(--primary); }
.chart-stacked-legend span:nth-child(2)::before { background: var(--primary-dark); }
.chart-stacked-legend span:nth-child(3)::before { background: var(--accent); }
.chart-stacked-legend span:nth-child(4)::before { background: var(--success); }
.chart-stacked-legend span:nth-child(5)::before { background: #3b82f6; }
.chart-stacked-legend span:nth-child(6)::before { background: var(--error); }
.chart-stacked-legend span:nth-child(7)::before { background: var(--gray-500); }

/* Vertical bar chart */
.chart-vertical { display: flex; align-items: flex-end; gap: 0.375rem; height: 180px; margin: 1rem 0; padding: 0 0.25rem; border-bottom: 2px solid var(--gray-200); }
.chart-v-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; height: 100%; justify-content: flex-end; }
.chart-v-bar { width: 100%; max-width: 48px; border-radius: var(--radius-md) var(--radius-md) 0 0; background: linear-gradient(0deg, var(--primary) 0%, var(--primary-light) 100%); position: relative; min-height: 4px; }
.chart-v-bar.accent { background: linear-gradient(0deg, var(--accent) 0%, #fbbf24 100%); }
.chart-v-val { font-size: 0.625rem; font-weight: 600; color: var(--gray-700); }
.chart-v-label { font-size: 0.5625rem; color: var(--gray-500); text-align: center; margin-top: 0.25rem; padding-top: 0.25rem; }
@media (max-width: 600px) { .chart-vertical { height: 140px; gap: 0.25rem; } .chart-v-bar { max-width: 32px; } }
