:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --secondary-color: #3b82f6;
    --danger-color: #f43f5e;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px 0;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* CARDS */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.main-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 30px;
}

/* INPUTS */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.input-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.2s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.currency-unit {
    position: absolute;
    right: 15px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.divider {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.highlight {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

/* RESULTS DASHBOARD */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-card.primary {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    color: white;
}

.result-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.result-value {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 5px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.result-value small {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.7;
}

.result-value.sm {
    font-size: 1.5rem;
}

.max-loan-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    opacity: 0.8;
}

.info-item .val {
    font-size: 1.4rem;
    font-weight: 800;
}

.info-item .val.secondary {
    color: #ffdce0;
}

.advice-box {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 10px;
    background: #e2e8f0;
}

.status-safe { background: #dcfce7; color: #166534; }
.status-warning { background: #fef9c3; color: #854d0e; }
.status-danger { background: #fee2e2; color: #991b1b; }

/* STRESS TEST */
.stress-test {
    border: 2px dashed var(--danger-color);
}

.stress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stress-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.detail-item .lbl { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
.detail-item .val { font-size: 0.9rem; font-weight: 700; }

/* TOOLTIP & HELP */
.help-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 10px;
    justify-content: center;
    align-items: center;
    cursor: help;
    color: var(--text-muted);
}

.help-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    background: var(--text-main);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    width: 200px;
    z-index: 100;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    font-weight: 400;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
}

.welcome-modal {
    background: white;
    padding: 40px;
    border-radius: 30px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.welcome-modal h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    font-weight: 800;
}

.step-list {
    text-align: left;
    margin: 30px 0;
}

.step-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.step-num {
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-start {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

.btn-start:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.3);
}

.currency-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.currency-selector select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    background: white;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}
