/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --background-secondary: #f9fafb;
    --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);
    --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(--secondary-color) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav 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;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.feature-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Calculator Section */
.calculator-section {
    padding: 4rem 0;
    background-color: var(--background-secondary);
}

.calculator-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.section-description {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.calculator-inputs {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.helper-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.calculate-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculator-results {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.result-card {
    margin-bottom: 1rem;
}

.result-card h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.result-note {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background-color: var(--background-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.result-label {
    font-weight: 600;
    color: var(--text-primary);
}

.result-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.result-highlight {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

.result-highlight h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    opacity: 0.9;
}

.result-highlight .big-number {
    font-size: 2rem;
    font-weight: 700;
}

.result-breakdown {
    margin-top: 1.5rem;
}

.result-breakdown h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.payment-phase {
    background-color: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.payment-phase h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Additional Calculators */
.additional-calculators {
    padding: 4rem 0;
    background-color: white;
}

.additional-calculators h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.tool-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.tool-card > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.mini-calc input,
.mini-calc select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
}

.mini-calc button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.mini-calc button:hover {
    background: var(--secondary-color);
}

.mini-result {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--background-secondary);
    border-radius: 8px;
    min-height: 50px;
}

.mini-result strong {
    color: var(--primary-color);
}

/* Info Section */
.info-section {
    padding: 4rem 0;
    background-color: var(--background-secondary);
}

.info-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.info-section h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
}

.info-content {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.info-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.feature-list {
    list-style: none;
    margin: 1.5rem 0;
}

.feature-list li {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: var(--background-secondary);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.feature-list li strong {
    color: var(--primary-color);
}

.uses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.use-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

/* How It Works */
.how-it-works {
    padding: 4rem 0;
    background-color: white;
}

.how-it-works h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.step {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.step p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.heloc-timeline {
    max-width: 900px;
    margin: 3rem auto;
    padding: 2rem;
    background-color: var(--background-secondary);
    border-radius: 12px;
}

.heloc-timeline h3 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.timeline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.timeline-period {
    padding: 2rem;
    border-radius: 8px;
    color: white;
}

.timeline-period.draw {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.timeline-period.repayment {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.timeline-period h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.timeline-period ul {
    list-style: none;
}

.timeline-period li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.timeline-period li:before {
    content: "✓";
    position: absolute;
    left: 0;
}

/* Comparison Section */
.comparison-section {
    padding: 4rem 0;
    background-color: var(--background-secondary);
}

.comparison-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.comparison-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table tbody tr:hover {
    background-color: var(--background-secondary);
}

.comparison-table td:first-child {
    font-weight: 600;
}

.pros-cons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pros-cons-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.pros-cons-card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.pros-cons-card ul {
    list-style: none;
}

.pros-cons-card li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pros-cons-card li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background-color: white;
}

.faq-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.faq-item {
    background: var(--background-secondary);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.faq-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.faq-item h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Guide Section */
.guide-section {
    padding: 4rem 0;
    background-color: var(--background-secondary);
}

.guide-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.guide-content {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.guide-content h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem;
    color: var(--text-primary);
}

.guide-steps {
    counter-reset: step-counter;
    list-style: none;
}

.guide-steps li {
    counter-increment: step-counter;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--background-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.guide-steps li strong {
    display: block;
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.guide-steps li strong:before {
    content: counter(step-counter) ". ";
}

.guide-steps li p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tip-card {
    background-color: var(--background-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-top: 4px solid var(--success-color);
}

.tip-card h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.tip-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.warning-list {
    list-style: none;
    margin: 2rem 0;
}

.warning-list li {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fef2f2;
    border-left: 4px solid var(--danger-color);
    border-radius: 4px;
    color: var(--text-primary);
}

/* Glossary Section */
.glossary-section {
    padding: 4rem 0;
    background-color: white;
}

.glossary-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.glossary-item {
    padding: 1.5rem;
    background-color: var(--background-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.glossary-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.glossary-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* CTA Section */
.cta-section {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
}

.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.cta-button {
    display: inline-block;
    padding: 1rem 3rem;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Footer */
.footer {
    background-color: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    color: #d1d5db;
    line-height: 1.6;
    font-size: 0.9rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 968px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
    }

    .calculator-results {
        position: static;
        max-height: none;
    }

    .timeline {
        grid-template-columns: 1fr;
    }

    .pros-cons-grid {
        grid-template-columns: 1fr;
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero h2 {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .nav {
        gap: 1rem;
    }

    .section-description {
        font-size: 1rem;
    }

    .info-content {
        padding: 2rem;
    }

    .guide-content {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.5rem;
    }

    .nav {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }

    .calculator-inputs,
    .calculator-results {
        padding: 1.5rem;
    }

    .info-content,
    .guide-content {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .nav,
    .cta-section,
    .footer {
        display: none;
    }

    .calculator-inputs button {
        display: none;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-results .result-item {
    animation: fadeIn 0.5s ease-out;
}

/* Accessibility */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
