/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #1565C0;
    --primary-light: #42A5F5;
    --primary-dark: #0D47A1;
    --accent: #F59E0B;
    --accent-dark: #D97706;
    --green: #10B981;
    --green-dark: #059669;
    --orange: #F97316;
    --purple: #8B5CF6;
    --bg: #E8F4FD;
    --card-bg: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --text-white: #FFFFFF;
    --border: #E2E8F0;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 50px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Prompt', sans-serif;
    --gradient-header: linear-gradient(135deg, #0D47A1 0%, #42A5F5 50%, #00BCD4 100%);
    --gradient-price: linear-gradient(135deg, #1565C0 0%, #42A5F5 100%);
    --gradient-green: linear-gradient(135deg, #059669 0%, #34D399 100%);
    --gradient-purple: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
    --gradient-accent: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.header {
    background: var(--gradient-header);
    padding: 32px 20px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    animation: headerGlow 8s ease-in-out infinite;
}
@keyframes headerGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
}
.header-content { position: relative; z-index: 1; }
.header-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.header-icon { font-size: 32px; vertical-align: middle; }
.header-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 300;
    margin-bottom: 12px;
}
.header-badge {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text-white);
    padding: 6px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

/* ===== Main Container ===== */
.main-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 16px 32px;
}

/* ===== Step Indicator ===== */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 0 20px;
}
.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #CBD5E1;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}
.step-dot.active {
    background: var(--gradient-price);
    box-shadow: 0 4px 16px rgba(21,101,192,0.4);
    transform: scale(1.1);
}
.step-dot.completed {
    background: var(--gradient-green);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.step-dot.completed span { display: none; }
.step-dot.completed::after {
    content: '✓';
    font-size: 18px;
    font-weight: 700;
}
.step-line {
    height: 3px;
    width: 40px;
    background: #CBD5E1;
    transition: var(--transition);
    flex-shrink: 0;
}
.step-line.active { background: var(--green); }

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.8);
    animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
}
.card-title .icon { font-size: 20px; margin-right: 4px; }

/* ===== System Grid (Step 1) ===== */
.system-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.system-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background: var(--card-bg);
}
.system-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(21,101,192,0.15);
}
.system-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(21,101,192,0.04), rgba(66,165,245,0.08));
    box-shadow: 0 4px 16px rgba(21,101,192,0.2);
}
.system-card.selected::after {
    content: '✔';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.system-card .system-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.system-card .system-price {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 400;
}

/* ===== Optimizer Toggle ===== */
.optimizer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.optimizer-info strong { display: block; font-size: 15px; color: var(--text); }
.optimizer-info small { color: var(--text-light); font-size: 13px; }
.toggle-switch {
    position: relative;
    width: 56px;
    height: 30px;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #CBD5E1;
    border-radius: 30px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(26px); }

/* ===== Price Display ===== */
.price-display {
    background: var(--gradient-price);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(21,101,192,0.3);
    animation: fadeInUp 0.5s ease-out;
}
.price-label { color: rgba(255,255,255,0.85); font-size: 14px; font-weight: 400; margin-bottom: 4px; }
.price-amount {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 4px;
}
.price-desc { color: rgba(255,255,255,0.8); font-size: 13px; }

/* ===== Buttons ===== */
.btn {
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary {
    background: var(--gradient-price);
    color: white;
    box-shadow: 0 4px 12px rgba(21,101,192,0.3);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(21,101,192,0.4); transform: translateY(-1px); }
.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: #F8FAFC; }
.btn-accent {
    background: var(--gradient-accent);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}
.btn-accent:hover { box-shadow: 0 6px 20px rgba(245,158,11,0.4); transform: translateY(-1px); }
.btn-download {
    background: var(--gradient-accent);
    color: var(--text);
    font-size: 18px;
    padding: 16px 32px;
    box-shadow: 0 4px 16px rgba(245,158,11,0.35);
}
.btn-download:hover { box-shadow: 0 6px 24px rgba(245,158,11,0.5); transform: translateY(-2px); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary-light);
}
.btn-outline:hover { background: rgba(21,101,192,0.06); }
.btn-full { width: 100%; }
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.btn-group .btn { flex: 1; }

/* ===== Step 2: Options ===== */
.system-badge {
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 15px;
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.option-group {
    display: flex;
    gap: 8px;
}
.option-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    cursor: pointer;
    text-align: center;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    transition: var(--transition);
}
.option-btn small { display: block; font-size: 11px; font-weight: 400; color: var(--text-light); margin-top: 2px; }
.option-btn:hover { border-color: var(--primary-light); }
.option-btn.active {
    background: var(--gradient-price);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(21,101,192,0.25);
}
.option-btn.active small { color: rgba(255,255,255,0.85); }
.option-btn.payment-type { padding: 12px 8px; }

/* ===== Interest Rate Display ===== */
.interest-display {
    background: linear-gradient(135deg, #1E293B, #334155);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
}
.interest-label { color: rgba(255,255,255,0.7); font-size: 13px; }
.interest-rate { font-size: 40px; font-weight: 800; color: #34D399; line-height: 1.2; }
.interest-type { color: rgba(255,255,255,0.6); font-size: 12px; }

/* ===== Loan Summary ===== */
.loan-summary { padding: 20px 24px; }
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}
.summary-value { font-weight: 700; font-size: 16px; }
.summary-divider { border: none; border-top: 1px dashed var(--border); margin: 8px 0; }
.highlight-orange .summary-value { color: var(--orange); }
.monthly-highlight {
    padding: 12px 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.monthly-highlight .summary-value { font-size: 22px; color: var(--primary); }

/* ===== Step 3: Results ===== */
.savings-card {
    background: var(--gradient-green);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    color: white;
    box-shadow: 0 8px 24px rgba(16,185,129,0.3);
}
.savings-grid { display: flex; gap: 16px; margin-bottom: 12px; }
.savings-item { flex: 1; }
.savings-item small, .savings-annual small { font-size: 12px; opacity: 0.85; display: block; }
.savings-item strong, .savings-annual strong { font-size: 22px; font-weight: 700; }
.savings-icon { font-size: 16px; }
.savings-annual {
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 8px;
}
.savings-annual strong { font-size: 26px; }
.savings-note { font-size: 11px; opacity: 0.75; }

.payback-grid { display: flex; gap: 12px; margin-bottom: 16px; }
.payback-card {
    flex: 1;
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow);
}
.payback-card.cash { background: linear-gradient(135deg, #E0F2FE, #BAE6FD); color: var(--primary-dark); }
.payback-card.installment { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #92400E; }
.payback-icon { font-size: 20px; display: block; margin-bottom: 4px; }
.payback-card small { font-size: 12px; opacity: 0.8; display: block; }
.payback-card strong { font-size: 28px; font-weight: 800; display: block; margin: 4px 0; }

.profit-card {
    background: var(--gradient-purple);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(139,92,246,0.3);
}
.profit-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.profit-grid { display: flex; gap: 16px; margin-bottom: 8px; }
.profit-item { flex: 1; }
.profit-item small { font-size: 12px; opacity: 0.8; display: block; }
.profit-item strong { font-size: 24px; font-weight: 800; }
.profit-note { font-size: 11px; opacity: 0.7; }

/* ===== Comparison Table ===== */
.comparison-table { overflow-x: auto; }
.comparison-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.comparison-table th {
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 13px;
}
.comparison-table td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--border); }
.comparison-table tr.current-row { background: rgba(21,101,192,0.06); font-weight: 600; }
.comparison-table .profit-col { color: var(--green-dark); font-weight: 700; }

/* ===== Chart ===== */
.chart-card { padding: 20px; }
.chart-container { position: relative; height: 280px; margin-top: 8px; }

/* ===== Step 4 ===== */
.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    transition: var(--transition);
    outline: none;
}
.form-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(66,165,245,0.15); }
.form-input::placeholder { color: #94A3B8; }

.proposal-summary .summary-row { padding: 10px 0; border-bottom: 1px solid #F1F5F9; }
.proposal-summary .summary-row:last-child { border-bottom: none; }
.profit-highlight { background: linear-gradient(90deg, #ECFDF5, #D1FAE5); margin: 8px -24px -24px; padding: 16px 24px !important; border-radius: 0 0 var(--radius) var(--radius); }
.text-blue { color: var(--primary) !important; }
.text-green { color: var(--green) !important; }

.pdf-guide {
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    border: 1px solid #FDE68A;
}
.pdf-guide h4 { font-size: 15px; margin-bottom: 10px; color: #92400E; }
.pdf-guide ol { padding-left: 20px; font-size: 13px; color: #78350F; }
.pdf-guide li { margin-bottom: 4px; }

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 13px;
    color: var(--text-light);
}
.footer strong { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; }

/* ===== Utilities ===== */
.hidden { display: none !important; }
.step-section { animation: fadeInUp 0.4s ease-out; }

/* ===== Print Styles ===== */
.print-proposal { display: none; }

@media print {
    body > *:not(.print-proposal) { display: none !important; }
    .print-proposal {
        display: block !important;
        padding: 40px;
        font-family: var(--font);
        color: #1E293B;
    }
    .print-header {
        text-align: center;
        padding-bottom: 20px;
        border-bottom: 3px solid #1565C0;
        margin-bottom: 24px;
    }
    .print-header h1 { font-size: 28px; color: #1565C0; }
    .print-header p { font-size: 14px; color: #64748B; }
    .print-customer { margin-bottom: 20px; font-size: 14px; }
    .print-body table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }
    .print-body th, .print-body td {
        padding: 10px 12px;
        border: 1px solid #E2E8F0;
        font-size: 14px;
        text-align: left;
    }
    .print-body th { background: #EFF6FF; font-weight: 600; }
    .print-footer {
        text-align: center;
        padding-top: 20px;
        border-top: 1px solid #E2E8F0;
        font-size: 12px;
        color: #64748B;
    }
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
    .header-title { font-size: 24px; }
    .price-amount { font-size: 36px; }
    .option-btn { font-size: 13px; padding: 8px 4px; }
    .savings-item strong { font-size: 18px; }
}
