/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 3rem;
}

.language-selector {
    display: flex;
    align-items: center;
}

.language-selector select {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 120px;
}

.language-selector select:focus {
    outline: none;
    border-color: #e53e3e;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: #e53e3e;
    text-decoration: none;
}

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

nav a {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

nav a.active,
nav a:hover {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
}

/* Loan Calculator */
.loan-calculator {
    margin-bottom: 4rem;
}

.calculator-card {
    background: white;
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
}

.calculator-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.repayment-period {
    text-align: right;
}

.period-label {
    font-size: 0.9rem;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

.period-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.period-link {
    font-size: 0.85rem;
    color: #10b981;
    text-decoration: none;
}

.period-link:hover {
    text-decoration: underline;
}

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

.slider-group {
    display: flex;
    flex-direction: column;
}

.slider-group label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-badge {
    background: #10b981;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.slider-container {
    flex: 1;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

#loanAmount, #monthlyPayment {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 1rem;
}

#loanAmount::-webkit-slider-thumb, #monthlyPayment::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

#loanAmount::-moz-range-thumb, #monthlyPayment::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.input-container {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    background: white;
}

.input-container input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.currency {
    color: #666;
    font-weight: 500;
    margin-left: 0.5rem;
}

#calculateBtn {
    background: #f97316;
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 2rem;
}

#calculateBtn:hover {
    background: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.representative-example {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.info-btn {
    background: #333;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loan Categories */
.loan-categories {
    margin-bottom: 2rem;
}

.category-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn.active {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.tab-btn:hover {
    border-color: #10b981;
    color: #10b981;
}

/* Loan Comparison */
.loan-comparison {
    margin-bottom: 4rem;
}

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

.comparison-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-select {
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

.comparison-table {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1fr 1fr 1.2fr 1.5fr;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 1rem;
}

.header-cell {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.info-icon {
    width: 16px;
    height: 16px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #666;
    cursor: help;
}

.table-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loan-card {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1fr 1fr 1.2fr 1.5fr;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.loan-card:hover {
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.loan-card.featured {
    border-color: #10b981;
    background: #f0fdf4;
}

.tip-badge {
    position: absolute;
    top: -8px;
    left: 1rem;
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.provider-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.provider-logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.provider-details h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.25rem 0;
}

.provider-details p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

.quality-score {
    display: flex;
    justify-content: center;
}

.score-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
}

.score-circle.excellent {
    background: #10b981;
}

.score-circle.good {
    background: #3b82f6;
}

.score-circle.average {
    background: #f59e0b;
}

.loan-details {
    display: contents;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.detail-item .value {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.detail-item .value.highlighted {
    color: #10b981;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-primary {
    background: #f97316;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #ea580c;
}

.btn-secondary {
    background: transparent;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #3b82f6;
    color: white;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    nav ul {
        gap: 1rem;
    }
    
    .calculator-card {
        padding: 2rem 1.5rem;
    }
    
    .calculator-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .repayment-period {
        text-align: center;
    }
    
    .dual-sliders {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .category-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .comparison-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .table-header {
        display: none;
    }
    
    .loan-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .provider-info {
        justify-content: center;
    }
    
    .loan-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    .detail-item {
        flex-direction: column;
        padding: 0.75rem;
        background: #f8fafc;
        border-radius: 8px;
    }
    
    .detail-item::before {
        content: attr(data-label);
        font-size: 0.75rem;
        color: #666;
        margin-bottom: 0.25rem;
    }
    
    .action-buttons {
        flex-direction: row;
        gap: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }
    
    #calculateBtn {
        padding: 1.25rem;
    }
    
    .calculator-header h2 {
        font-size: 1.5rem;
    }
    
    .period-value {
        font-size: 1.5rem;
    }
    
    .loan-details {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}