/**
 * Energy Renovation Simulator - CSS (100% Kelvin Match)
 * Reference: https://app.go-kelvin.com
 */

/* ===== VARIABLES ===== */
:root {
    --primary-green: #10b981;
    --primary-green-hover: #059669;
    --light-blue-bg: #eff6ff;
    --text-dark: #1f2937;
    --text-medium: #6b7280;
    --text-light: #9ca3af;
    --border-light: #e5e7eb;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --radius-sm: 8px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== CONTAINER ===== */
.ers-simulator-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: var(--font-main);
}

/* ===== STEP 1: LIGHT BLUE BACKGROUND (NO CARD) ===== */
.ers-step-1-wrapper {
    background: var(--light-blue-bg);
    padding: 60px 24px;
    min-height: 100vh;
}

.ers-step-1-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.ers-step-1-title {
    font-size: 40px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.ers-step-1-subtitle {
    font-size: 18px;
    color: var(--text-medium);
    margin: 0 0 40px 0;
    line-height: 1.6;
}

.ers-address-input-wrapper {
    position: relative;
    margin-bottom: 32px;
}

.ers-address-input-step1 {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 16px;
    color: var(--text-dark);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.ers-address-input-step1:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.ers-address-input-step1::placeholder {
    color: var(--text-light);
}

.ers-btn-large {
    padding: 16px 40px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* Map wrapper below main content */
#ers-map-wrapper {
    max-width: 900px;
    margin: 40px auto 0;
    padding: 0 24px;
}

#ers-map {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

/* ===== STEPS 2+: WHITE CARD STYLE ===== */
.ers-step {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 48px;
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 40px auto;
}

.ers-step h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 32px 0;
    text-align: left;
}

/* ===== INFO BOX ===== */
.ers-info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: var(--radius-sm);
    color: #1e40af;
    font-size: 14px;
}

/* ===== FORM ELEMENTS ===== */
.ers-form-group {
    margin-bottom: 24px;
}

.ers-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.ers-form-group.full-width {
    grid-column: span 2;
}

.ers-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 15px;
}

/* Bottom-bordered inputs (Steps 2+) */
.ers-input {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 2px solid var(--border-light);
    background: transparent;
    font-size: 16px;
    color: var(--text-dark);
    transition: border-color 0.2s ease;
}

.ers-input:focus {
    outline: none;
    border-bottom-color: var(--primary-green);
}

.ers-input::placeholder {
    color: var(--text-light);
}

/* Select dropdowns */
.ers-input select,
select.ers-input {
    cursor: pointer;
}

/* Full-bordered inputs (for modal) */
#first-name,
#last-name,
#email,
#phone {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    background: var(--bg-white);
}

#first-name:focus,
#last-name:focus,
#email:focus,
#phone:focus {
    border-color: var(--primary-green);
    border-bottom-width: 1px;
}

/* ===== ADDRESS SUGGESTIONS ===== */
.ers-suggestions {
    position: absolute;
    margin-top: 4px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    z-index: 10;
    width: 100%;
}

.ers-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
    font-size: 15px;
    color: var(--text-dark);
}

.ers-suggestion-item:last-child {
    border-bottom: none;
}

.ers-suggestion-item:hover {
    background: #f0fdf4;
}

/* ===== MAP INSTRUCTION ===== */
.map-instruction {
    text-align: center;
    font-size: 14px;
    color: var(--text-medium);
    margin-top: 12px;
    font-style: normal;
}

/* ===== BUTTONS ===== */
.ers-btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.ers-btn-primary {
    background: var(--primary-green);
    color: white;
}

.ers-btn-primary:hover {
    background: var(--primary-green-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.ers-btn-primary:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ers-btn-secondary {
    background: transparent;
    color: var(--text-medium);
    border: 1px solid var(--border-light);
}

.ers-btn-secondary:hover {
    background: var(--bg-light);
    border-color: #d1d5db;
}

.ers-btn-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

/* ===== SCENARIOS ===== */
.ers-scenarios {
    display: grid;
    gap: 20px;
}

.ers-scenario-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.2s ease;
}

.ers-scenario-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-green);
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.scenario-header h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.scenario-priority {
    background: #ecfdf5;
    color: var(--primary-green);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.scenario-description {
    color: var(--text-medium);
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 15px;
}

/* ===== DPE BADGES ===== */
.scenario-dpe {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.dpe-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dpe-item span:first-child {
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 500;
}

.dpe-badge {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.dpe-badge.dpe-A {
    background: #319834;
}

.dpe-badge.dpe-B {
    background: #4ba045;
}

.dpe-badge.dpe-C {
    background: #b9d734;
}

.dpe-badge.dpe-D {
    background: #fff12c;
    color: #333;
}

.dpe-badge.dpe-E {
    background: #fcb731;
}

.dpe-badge.dpe-F {
    background: #f47920;
}

.dpe-badge.dpe-G {
    background: #ed1c24;
}

.dpe-arrow {
    font-size: 24px;
    color: var(--text-light);
}

/* ===== COSTS ===== */
.scenario-costs {
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 15px;
}

.cost-row span {
    color: var(--text-medium);
}

.cost-row strong {
    color: var(--text-dark);
    font-weight: 600;
}

.cost-row.aids strong {
    color: var(--primary-green);
}

.cost-row.total {
    border-top: 2px solid var(--border-light);
    margin-top: 8px;
    padding-top: 16px;
    font-size: 16px;
}

.cost-row.total strong {
    color: var(--primary-green);
    font-size: 20px;
}

.positive {
    color: var(--primary-green) !important;
}

/* ===== LOADING ===== */
.ers-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-medium);
    font-size: 16px;
}

.ers-loading::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 20px auto 0;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== SUCCESS MESSAGE ===== */
.ers-success-message {
    text-align: center;
    padding: 48px 24px;
    background: #ecfdf5;
    border-radius: var(--radius-md);
    margin-top: 20px;
    border: 1px solid #d1fae5;
}

.ers-success-message h4 {
    color: var(--primary-green);
    font-size: 24px;
    margin-bottom: 12px;
    font-weight: 700;
}

.ers-success-message p {
    color: var(--text-dark);
    font-size: 16px;
    margin: 0;
}

/* ===== MODAL ===== */
.ers-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ers-modal {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.ers-modal h3 {
    margin: 0 0 24px 0;
    font-size: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .ers-step-1-wrapper {
        padding: 40px 20px;
    }

    .ers-step-1-title {
        font-size: 28px;
    }

    .ers-step-1-subtitle {
        font-size: 16px;
    }

    .ers-step {
        padding: 24px;
        margin: 20px;
    }

    .ers-form-grid {
        grid-template-columns: 1fr;
    }

    .ers-form-group.full-width {
        grid-column: span 1;
    }

    .ers-btn-group {
        flex-direction: column-reverse;
    }

    .ers-btn {
        width: 100%;
    }

    .scenario-dpe {
        flex-direction: column;
        gap: 12px;
    }

    .dpe-arrow {
        transform: rotate(90deg);
    }

    .ers-modal {
        padding: 24px;
    }
}