/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

/* Global Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    text-decoration: none;
}

/* Header Styles */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
}

.site-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tagline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.trust-badges {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: var(--success-color);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 3rem 0;
}

/* Calculator Card */
.calculator-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 3rem;
}

/* Tab Navigation */
.calc-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.calc-form {
    max-width: 800px;
}

.form-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-section {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1.5rem;
}

.form-section legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: var(--text-primary);
}

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

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

/* Results Section */
.results-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.results-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1.5rem;
}

.result-card h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.alert-info {
    background-color: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 1rem;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    padding: 1rem;
    color: #92400e;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

.results-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Education Section */
.education-section {
    margin-bottom: 3rem;
}

.benefits-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (min-width: 768px) {
    .benefits-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.benefit-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1.5rem;
    text-align: center;
}

.benefit-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.cta-section {
    background-color: var(--bg-tertiary);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
}

.cta-section h3 {
    margin-bottom: 1rem;
}

/* FAQ Section */
.faq-section {
    margin-bottom: 3rem;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
}

.faq-item summary {
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 1.5rem;
}

.faq-item summary::before {
    content: '+';
    position: absolute;
    right: 0;
    top: 0;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.faq-item[open] summary::before {
    content: '-';
}

.faq-item p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* Footer */
.site-footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
}

.footer-section a:hover {
    color: var(--text-primary);
}

.disclaimer {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .site-title {
        font-size: 1.5rem;
    }
    
    .calculator-card {
        padding: 1.5rem;
    }
    
    .calc-tabs {
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .results-actions {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .calc-tabs,
    .form-actions,
    .results-actions,
    .cta-section {
        display: none;
    }
    
    .tab-content {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .result-card {
        break-inside: avoid;
    }
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Chart Styles */
#growth-chart, #distribution-chart {
    max-width: 100%;
    height: auto;
    margin-top: 1rem;
}

/* Distribution Planning Styles */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.checkbox-group input[type="number"] {
    width: auto;
    margin-left: 0.5rem;
}

#k12-options, #college-options {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

#k12-options h4, #college-options h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.full-width {
    grid-column: 1 / -1;
}

.timeline-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.distribution-details {
    margin-top: 2rem;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
}

#distribution-table {
    width: 100%;
    border-collapse: collapse;
}

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

#distribution-table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

#distribution-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

#distribution-table tbody tr:last-child td {
    border-bottom: none;
}

.badge.qualified {
    background-color: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.badge.non-qualified {
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.recommendation {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.recommendation.alert {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.recommendation.warning {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.recommendation.info {
    background-color: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
}

.recommendation.success {
    background-color: #d1fae5;
    border: 1px solid #86efac;
    color: #065f46;
}

.recommendation i {
    font-style: normal;
    font-size: 1.25rem;
}

.result-item.highlight {
    background-color: var(--bg-tertiary);
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Dark Mode Support (for users with system preference) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --border-color: #4b5563;
    }
    
    .badge {
        background-color: #059669;
    }
    
    .alert-info {
        background-color: #1e3a8a;
        border-color: #2563eb;
        color: #dbeafe;
    }
    
    .alert-warning {
        background-color: #78350f;
        border-color: #d97706;
        color: #fef3c7;
    }
}