* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #4CAF50;
    --danger-color: #FF6B6B;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --background: #f9fafb;
    --card-background: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

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

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

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: opacity 0.2s ease;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-link.active {
    border-bottom-color: white;
}

/* Main Content */
main {
    padding: 2rem 0 4rem;
}

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

/* Input Section */
.input-section,
.results-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.input-section h2,
.results-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.section-subtitle {
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
    color: var(--text-color);
}

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

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

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.input-wrapper input[readonly] {
    background: var(--background);
    cursor: not-allowed;
}

.input-prefix,
.input-suffix {
    position: absolute;
    color: var(--text-light);
    font-weight: 600;
}

.input-prefix {
    left: 1rem;
    padding-right: 0.5rem;
}

.input-suffix {
    right: 1rem;
}

.input-wrapper input {
    padding-left: 2.5rem;
}

.input-wrapper:has(.input-suffix) input {
    padding-right: 3rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.loan-term-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.term-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.term-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.help-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.calculate-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

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

/* Results Section */
.monthly-payment-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.payment-amount {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.payment-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

.payment-breakdown {
    margin-bottom: 2rem;
}

.payment-breakdown h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.breakdown-value {
    font-weight: 600;
    color: var(--text-color);
}

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

.summary-card {
    background: var(--background);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.card-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Chart */
.chart-container {
    margin-top: 2rem;
}

.chart-container h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.pie-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.pie-chart svg {
    max-width: 200px;
    height: auto;
}

.chart-legend {
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Amortization Section */
.amortization-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.amortization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.amortization-header h2 {
    font-size: 1.75rem;
    color: var(--text-color);
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.25rem;
    border-radius: 8px;
}

.toggle-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.toggle-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

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

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
}

.amortization-table thead {
    background: var(--background);
    position: sticky;
    top: 0;
    z-index: 10;
}

.amortization-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.amortization-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.amortization-table tbody tr:hover {
    background: var(--background);
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

footer p {
    opacity: 0.8;
}

/* Content Pages */
.content-page {
    background: var(--card-background);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 2rem auto 4rem;
}

.content-section {
    margin-bottom: 2.5rem;
}

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

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

.content-section ul, .content-section ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content-section li {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.cta-section {
    background: var(--background);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 3rem;
}

.cta-section h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

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

.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group-contact {
    margin-bottom: 1.5rem;
}

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

.form-group-contact input,
.form-group-contact textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group-contact input:focus,
.form-group-contact textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group-contact textarea {
    min-height: 150px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.contact-info {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
    text-align: center;
}

.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.contact-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 968px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .payment-amount {
        font-size: 2.5rem;
    }

    .content-page {
        padding: 2rem;
    }
}

@media (max-width: 640px) {
    .main-nav {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }
    .container {
        padding: 0 1rem;
    }

    .input-section,
    .results-section,
    .amortization-section {
        padding: 1.5rem;
    }

    .amortization-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .payment-amount {
        font-size: 2rem;
    }

    .amortization-table {
        font-size: 0.875rem;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 0.75rem 0.5rem;
    }

    .content-page {
        padding: 1.5rem;
    }

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

    .content-section p,
    .content-section li {
        font-size: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

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