:root {
    --primary: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --background: #f8fafc;
    --foreground: #0f172a;
    --card: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --foreground: #f8fafc;
        --card: #1e293b;
        --border: #334155;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    padding: 2rem 1rem;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--secondary);
}

.card {
    background-color: var(--card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    transition: all 0.2s;
}

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

.unit {
    color: var(--secondary);
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 3rem;
    text-align: left;
    flex-shrink: 0;
}

/* Comparison Table Styles */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

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

th,
td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--background);
    font-weight: 600;
}

tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.highlight {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.25rem;
}

/* Income/Ratio Section */
.ratio-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    background-color: rgba(37, 99, 235, 0.05);
    margin-top: 1.5rem;
    border: 1px solid var(--border);
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ratio-divider {
    height: 1px;
    background-color: var(--border);
    width: 100%;
}

.ratio-label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.875rem;
}

.ratio-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

/* Button Styles */
.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    width: 100%;
}

.btn-reset:hover {
    background-color: var(--border);
    color: var(--foreground);
}

.btn-reset svg {
    margin-right: 0.5rem;
}

.footer {
    text-align: center;
    margin-top: 4rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .card {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .grid {
        gap: 1rem;
    }
    
    #afford-max-loan {
        font-size: 2.5rem !important;
    }
    
    #afford-max-loan span {
        font-size: 1.25rem !important;
    }
    
    .ratio-container {
        padding: 1rem;
    }
    
    .ratio-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .ratio-value {
        align-self: flex-end;
        font-size: 1.125rem;
    }
}