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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --white: #ffffff;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

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

.header {
    background: var(--white);
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 32px;
}

h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    color: var(--gray);
}

.main-content {
    padding: 40px 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-bottom: 40px;
}

.calculator-card, .results-card, .chart-card, .schedule-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.calculator-card h2, .results-card h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

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

input, select {
    width: 100%;
    height: 48px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-prefix, .input-suffix {
    position: absolute;
    font-weight: 600;
    color: var(--gray);
    pointer-events: none;
}

.input-prefix {
    left: 16px;
}

.input-suffix {
    right: 16px;
}

.input-wrapper input {
    padding-left: 40px;
}

.btn-primary {
    width: 100%;
    height: 56px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.results-section {
    margin-top: 30px;
}

.payment-amount {
    font-size: 56px;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    margin: 20px 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.summary-label {
    color: var(--gray);
    font-size: 14px;
}

.summary-value {
    font-weight: 700;
    font-size: 16px;
}

.summary-value.red {
    color: var(--danger);
}

.chart-card, .schedule-card {
    margin-top: 30px;
}

.chart-card h3, .schedule-card h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.schedule-table th {
    background: var(--light);
    padding: 12px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.schedule-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

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

.sidebar {
    position: relative;
}

.ad-box {
    background: var(--light);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: var(--gray);
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 20px;
}

.affiliate-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    margin: 40px 0;
    text-align: center;
}

.affiliate-section h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.lender-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.lender-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    transition: all 0.2s;
}

.lender-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.lender-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.lender-card p {
    color: var(--gray);
    margin-bottom: 20px;
}

.content-section {
    margin: 40px 0;
}

.content-section article {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.content-section h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.faq-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
}

.faq-section h2 {
    font-size: 28px;
    margin-bottom: 30px;
}

.faq-item {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

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

.faq-item h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.faq-item p {
    color: var(--gray);
    line-height: 1.8;
}

.footer {
    background: var(--dark);
    color: var(--white);
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
}

.footer p {
    margin: 10px 0;
    font-size: 14px;
    opacity: 0.8;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 32px;
    }
    
    .payment-amount {
        font-size: 42px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .lender-cards {
        grid-template-columns: 1fr;
    }
}

/* Ad Spaces */
.top-ad {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

.ad-box-horizontal {
    background: var(--light);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    color: var(--gray);
    font-weight: 600;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-label {
    color: var(--gray);
    font-size: 14px;
}

.content-ad, .mid-content-ad, .footer-ad {
    margin: 40px 0;
}

/* Lender cards grid update */
.lender-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.lender-card .btn-primary {
    margin-top: 15px;
    height: 48px;
    font-size: 16px;
}

/* Content section improvements */
.content-section article {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.content-section ul {
    margin: 15px 0;
    padding-left: 30px;
}

.content-section li {
    margin: 10px 0;
    line-height: 1.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ad-box-horizontal {
        min-height: 50px;
        padding: 20px 10px;
    }
    
    .lender-cards {
        grid-template-columns: 1fr;
    }
    
    .top-ad {
        padding: 10px 0;
    }
}

/* Fix affiliate buttons */
.lender-card .btn-primary {
    display: inline-block;
    width: 100%;
    height: 48px;
    margin-top: 15px;
    font-size: 16px;
    text-decoration: none;
    line-height: 48px;
    padding: 0;
}

.lender-card a.btn-primary:hover {
    transform: translateY(-2px);
}

/* Mobile Results Fix */
@media (max-width: 768px) {
    .payment-amount {
        font-size: 36px;
        word-break: break-all;
    }
    
    .results-card, .chart-card, .schedule-card {
        padding: 20px 15px;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .summary-value {
        font-size: 18px;
        word-break: break-word;
    }
    
    .schedule-table {
        font-size: 11px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 8px 4px;
        min-width: 70px;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .payment-amount {
        font-size: 28px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .summary-item {
        padding: 10px 0;
    }
    
    .schedule-table {
        font-size: 10px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 3px;
        min-width: 60px;
    }
}