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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #ffffff;
    --bg-alt: #f8fafc;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

/* Header and Navigation */
header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    padding: 1rem 0;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.125rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.95;
    line-height: 1.7;
}

/* Calculator Section */
.calculator-section {
    padding: 4rem 0;
}

.grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.calculator-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.calculator-form h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tooltip {
    cursor: help;
    background: var(--secondary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
    z-index: 10;
    max-width: 250px;
    white-space: normal;
    width: max-content;
}

input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--bg-alt);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.info-card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.info-card ul {
    list-style: none;
}

.info-card li {
    padding: 0.5rem 0;
    color: var(--text-light);
}

/* Results Section */
.results {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results h2 {
    margin-bottom: 2rem;
    color: var(--text-color);
}

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

.result-card {
    background: var(--bg-alt);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.result-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.result-card h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.result-card.highlight h3 {
    opacity: 0.95;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.result-description {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Chart */
.chart-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-alt);
    border-radius: 12px;
}

.chart-container h3 {
    margin-bottom: 1rem;
}

#breakEvenChart {
    max-width: 100%;
    height: 300px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Content Sections */
.content-section {
    padding: 4rem 0;
}

.alt-bg {
    background: var(--bg-alt);
}

.content-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.content-section p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.metric-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.metric-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.metric-card p {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0;
}

/* FAQ Section */
.faq-container {
    max-width: 800px;
    margin: 2rem auto;
}

.faq-item {
    background: white;
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 1.5rem;
    background: white;
    border: none;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--bg-alt);
}

.faq-icon {
    font-size: 1.5rem;
    transition: var(--transition);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.5rem 1.5rem;
    margin: 0;
    color: var(--text-light);
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.cta-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

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

.cta-section .btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    padding: 3rem 0 1rem;
}

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

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.footer-section p {
    opacity: 0.8;
    line-height: 1.6;
}

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

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

.footer-section a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--transition);
}

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

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

/* Ad Spaces (hidden by default, ready for implementation) */
.ad-space {
    background: var(--bg-alt);
    border: 2px dashed var(--border-color);
    display: none; /* Hidden until ads are implemented */
    margin: 1rem auto;
    border-radius: 8px;
}

.ad-header {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-sidebar {
    width: 300px;
    height: 250px;
}

.ad-results {
    width: 100%;
    min-height: 250px;
    margin: 2rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .grid-layout {
        grid-template-columns: 1fr;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.875rem;
    }

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

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
    }

    .content-section h2 {
        font-size: 1.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .calculator-form,
    .results {
        padding: 1.5rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .hero {
        padding: 2rem 0;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    .sidebar,
    .action-buttons,
    .cta-section,
    #how-to,
    #metrics,
    #faq,
    .calculator-form {
        display: none !important;
    }

    .results {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .result-card {
        page-break-inside: avoid;
    }

    .chart-container {
        page-break-inside: avoid;
    }

    body {
        background: white;
    }

    .results h2 {
        margin-top: 0;
    }

    @page {
        margin: 2cm;
    }
}

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

/* Focus Styles */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

/* Success/Error States */
.success {
    color: var(--success-color);
}

.warning {
    color: var(--warning-color);
}

.danger {
    color: var(--danger-color);
}