/* ── Credit Simulator Component ────────────────────────────── */

:root {
    --cs-brand:          #051d6b;
    --cs-brand-dark:     #03124a;
    --cs-brand-rgb:      5, 29, 107;
    --cs-brand-gradient: linear-gradient(135deg, #051d6b 0%, #0a3399 100%);
}

/* ── Modal z-index: header drops below backdrop when modal opens ── */
body.modal-open .header-overlay,
body.modal-open .navbar-card,
body.modal-open .navbar,
body.modal-open header {
    z-index: 1040;
}

.cs-field { margin-bottom: 1.25rem; }

.cs-field-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .4rem;
}
.cs-field-label {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--secondary));
}
.cs-field-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cs-brand);
}

/* ── Range slider ── */
.cs-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: hsl(var(--border));
    accent-color: var(--cs-brand);
    cursor: pointer;
    margin-bottom: .6rem;
}
.cs-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cs-brand);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    cursor: pointer;
}
.cs-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cs-brand);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    cursor: pointer;
}

/* ── Text input ── */
.cs-input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.cs-input-prefix {
    position: absolute;
    left: .9rem;
    font-size: .9rem;
    font-weight: 700;
    color: hsl(var(--body));
    pointer-events: none;
    user-select: none;
}
.cs-input.cs-input--prefixed {
    padding: .6rem .9rem .6rem 2.2rem;
}
.cs-input {
    width: 100%;
    padding: .6rem .9rem;
    border-radius: 8px;
    border: 1.5px solid hsl(var(--border));
    font-size: .9rem;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    color: hsl(var(--heading));
}
.cs-input:focus {
    outline: none;
    border-color: var(--cs-brand);
    box-shadow: 0 0 0 3px rgba(var(--cs-brand-rgb), .12);
}
.cs-input.is-invalid { border-color: hsl(var(--danger)); }
.cs-error {
    font-size: .78rem;
    color: hsl(var(--danger));
    margin-top: .25rem;
}

/* ── Divider ── */
.cs-divider {
    border: none;
    border-top: 1px solid hsl(var(--border));
    margin: 1rem 0;
}

/* ── Buttons ── */
.cs-btn {
    display: block;
    width: 100%;
    padding: .85rem 1rem;
    background: var(--cs-brand);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .2s, transform .1s;
    margin-top: .5rem;
}
.cs-btn:hover:not(:disabled) { background: var(--cs-brand-dark); }
.cs-btn:active:not(:disabled) { transform: scale(.99); }
.cs-btn:disabled { opacity: .6; cursor: not-allowed; }

.cs-btn-ghost {
    display: block;
    width: 100%;
    padding: .75rem 1rem;
    background: transparent;
    color: var(--cs-brand);
    border: 1.5px solid var(--cs-brand);
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, color .2s;
    margin-top: .75rem;
}
.cs-btn-ghost:hover { background: rgba(var(--cs-brand-rgb), .08); }

/* ── Loading overlay ── */
.cs-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.8);
    backdrop-filter: blur(2px);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    z-index: 10;
}
.cs-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid hsl(var(--border));
    border-top-color: var(--cs-brand);
    border-radius: 50%;
    animation: cs-spin 1.2s linear infinite;
}
@keyframes cs-spin {
    to { transform: rotate(360deg); }
}
.cs-loading-label {
    font-size: .82rem;
    font-weight: 700;
    color: var(--cs-brand);
    letter-spacing: .04em;
}

/* ── Screens ── */
.cs-screen {
    position: relative;
    animation: cs-in .25s ease;
}
@keyframes cs-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal header ── */
#simulatorModal .modal-simulator {
    background: var(--cs-brand-gradient);
    padding: 1.4rem 1.6rem;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}
#simulatorModal .modal-simulator::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    pointer-events: none;
}
#simulatorModal .modal-simulator::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 10px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
    pointer-events: none;
}
#simulatorModal .modal-simulator .modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .55rem;
}
#simulatorModal .modal-simulator .modal-title::before {
    content: '◈';
    font-size: 1rem;
    opacity: .75;
}

/* ── Result: hero ── */
.cs-hero {
    background: var(--cs-brand-gradient);
    border-radius: 14px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
}
.cs-hero-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255,255,255,.75);
    margin-bottom: .35rem;
}
.cs-hero-val {
    font-size: 2.1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: -.02em;
}
.cs-hero-currency {
    font-size: 1rem;
    font-weight: 600;
    opacity: .8;
    margin-left: .2rem;
}

/* ── Result: detail list ── */
.cs-detail-list {
    list-style: none;
    margin: 0 0 .5rem;
    padding: 0;
    border: 1.5px solid hsl(var(--border));
    border-radius: 12px;
    overflow: hidden;
}
.cs-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    gap: 1rem;
}
.cs-detail-row + .cs-detail-row {
    border-top: 1px solid hsl(var(--border));
}
.cs-detail-row:nth-child(even) {
    background: hsl(var(--border) / .18);
}
.cs-detail-label {
    font-size: .82rem;
    color: hsl(var(--body));
    font-weight: 500;
}
.cs-detail-label small {
    font-size: .74rem;
    opacity: .7;
    margin-left: .2rem;
}
.cs-detail-val {
    font-size: .88rem;
    font-weight: 700;
    color: hsl(var(--heading));
    white-space: nowrap;
}

/* ── Result screen heading ── */
.cs-result-heading {
    font-size: 1.35rem;
    font-weight: 800;
    color: hsl(var(--heading));
    margin-bottom: 1.25rem;
    text-align: center;
    letter-spacing: -.01em;
    line-height: 1.2;
    position: relative;
    padding-bottom: .75rem;
}
.cs-result-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5rem;
    height: 3px;
    border-radius: 999px;
    background: var(--cs-brand);
}
