/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav-menu a:hover {
    opacity: 0.8;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero .subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Calculator Section */
.calculator-section {
    padding: 4rem 0;
    background-color: var(--surface);
}

.calculator-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calculator-content {
    display: none;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 0 auto;
}

.calculator-content.active {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-content h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.calc-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.calc-mode-switcher {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
}

.calc-mode-switcher label {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.calc-mode-switcher select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.calc-mode-switcher select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.calculator-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calc-btn, .reset-btn {
    padding: 0.875rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 1rem;
    margin-top: 0.5rem;
}

.calc-btn {
    background: var(--primary-color);
    color: white;
}

.calc-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reset-btn {
    background: var(--text-secondary);
    color: white;
}

.reset-btn:hover {
    background: var(--text-primary);
}

.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.result-box h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.result-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.result-content p {
    margin-bottom: 0.5rem;
}

.result-content strong {
    font-weight: 700;
    font-size: 1.15rem;
}

.example-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #fff7ed;
    border-left: 4px solid var(--warning);
    border-radius: 8px;
}

.example-box h4 {
    color: var(--warning);
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.example-box p {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* About Section */
.about-section {
    padding: 4rem 0;
    background: white;
}

.about-section h2 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.content-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.content-card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.content-card p {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.content-card ul {
    padding-left: 1.5rem;
    color: var(--text-primary);
}

.content-card li {
    margin-bottom: 0.5rem;
}

.formula {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    margin: 1rem 0;
}

/* Guide Section */
.guide-section {
    padding: 4rem 0;
    background: var(--surface);
}

.guide-section h2 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.guide-content {
    max-width: 900px;
    margin: 0 auto;
}

.guide-article {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.guide-article h3 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.guide-article p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.guide-article ul, .guide-article ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.guide-article li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background: white;
}

.faq-section h2 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
}

.faq-question {
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-question h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    flex: 1;
}

.faq-toggle {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    transition: transform 0.3s;
    min-width: 30px;
    text-align: center;
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 1.5rem;
}

.faq-item.active .faq-answer {
    max-height: 1000px;
    padding: 0 1.5rem 1.5rem 1.5rem;
    transition: max-height 0.5s ease-in;
}

.faq-answer p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.faq-answer ul {
    padding-left: 2rem;
    margin-bottom: 0.75rem;
}

.faq-answer li {
    margin-bottom: 0.5rem;
}

/* Benefits Section */
.benefits-section {
    padding: 4rem 0;
    background: var(--surface);
}

.benefits-section h2 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.benefit-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: all 0.3s;
}

.benefit-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.benefit-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.benefit-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.benefit-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
footer {
    background: var(--text-primary);
    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 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    font-size: 0.95rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: white;
}

.keywords {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        display: none;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .calculator-content {
        padding: 1.5rem;
    }

    .calculator-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .calc-btn, .reset-btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .guide-article {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 0;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .calculator-section,
    .about-section,
    .guide-section,
    .faq-section,
    .benefits-section {
        padding: 2rem 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    header, footer, .calculator-tabs, .calc-btn, .reset-btn {
        display: none;
    }

    body {
        color: black;
    }

    .calculator-content {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

