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

:root {
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #dadce0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 0;
}

/* Calculator Section */
.calculator-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(26, 115, 232, 0.05);
}

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

.calculator-form {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.calculator-form.active {
    display: block;
}

.calculator-results {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group input,
.form-group select {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-color);
}

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

.calculate-btn {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.calculate-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results Section */
.results-section {
    margin-bottom: 3rem;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.result-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.result-card:first-child .result-value {
    color: var(--secondary-color);
    font-size: 2.5rem;
}

.chart-container {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow);
    min-height: 400px;
    position: relative;
}

.chart-container canvas {
    max-height: 500px;
}

/* Info Section */
.info-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    line-height: 1.8;
}

.info-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-section h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

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

.info-section strong {
    color: var(--text-primary);
}

/* License Section */
.license-text {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.license-text h3,
.license-text h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.license-text p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.license-text p:last-child {
    margin-bottom: 0;
    margin-top: 1.5rem;
}

.license-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.license-text a:hover {
    text-decoration: underline;
}

/* FAQ Section */
.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Ad Containers */
.ad-container {
    width: 100%;
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
}

.ad-wrapper {
    min-height: 100px;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

.ad-top {
    margin-top: 0;
}

.ad-inline {
    margin: 3rem 0;
}

.ad-bottom {
    margin-bottom: 0;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

footer p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-other-tools {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.footer-other-tools p {
    margin-bottom: 0.5rem;
}

.footer-other-tools strong {
    color: var(--text-primary);
}

.footer-credits {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.footer-credits p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .calculator-section {
        padding: 2rem 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
    }
    
    .result-value {
        font-size: 1.75rem;
    }
    
    .result-card:first-child .result-value {
        font-size: 2rem;
    }
    
    .chart-container {
        padding: 1rem;
        min-height: 350px;
    }
    
    .chart-container canvas {
        max-height: none;
        height: 350px !important;
    }
    
    .info-section {
        padding: 1.5rem;
    }
    
    .info-section h2 {
        font-size: 1.75rem;
    }
    
    .info-section h3 {
        font-size: 1.25rem;
    }
    
    main {
        padding: 2rem 0;
    }
    
    .tab-navigation {
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .calculator-section {
        padding: 1.5rem 1rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .result-card:first-child .result-value {
        font-size: 1.75rem;
    }
    
    .chart-container {
        padding: 1rem;
        min-height: 300px;
    }
    
    .chart-container canvas {
        max-height: none;
        height: 300px !important;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

