/* Cashmatic Simulator — gamified multi-step form */

.cm-sim {
    --cm-primary: #324b96;
    --cm-primary-dark: #233673;
    --cm-accent: #f7a800;
    --cm-success: #1f9d55;
    --cm-danger: #d92d20;
    --cm-bg: #f7f9fc;
    --cm-card: #ffffff;
    --cm-text: #1a2238;
    --cm-muted: #6b7280;
    --cm-border: #e5e7eb;
    --cm-shadow: 0 10px 40px -10px rgba(50, 75, 150, 0.18);
    --cm-radius: 18px;

    max-width: 640px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--cm-text);
    line-height: 1.5;
}
.cm-sim *, .cm-sim *::before, .cm-sim *::after { box-sizing: border-box; }

.cm-sim__card {
    background: var(--cm-card);
    border-radius: var(--cm-radius);
    box-shadow: var(--cm-shadow);
    padding: 36px 32px;
    position: relative;
    overflow: hidden;
}

.cm-sim__loading {
    text-align: center;
    color: var(--cm-muted);
    padding: 40px 0;
}

/* Progress */
.cm-sim__progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--cm-muted);
    font-weight: 500;
}
.cm-sim__bar {
    height: 6px;
    background: var(--cm-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 28px;
}
.cm-sim__bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cm-primary), var(--cm-accent));
    border-radius: 999px;
    transition: width 500ms cubic-bezier(.4, 0, .2, 1);
}

/* Step */
.cm-sim__step { display: none; animation: cmFade 400ms ease both; }
.cm-sim__step.is-active { display: block; }
@keyframes cmFade {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cm-sim__icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(50,75,150,.1), rgba(247,168,0,.12));
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px;
    color: var(--cm-primary);
}
.cm-sim__icon svg { width: 30px; height: 30px; }

.cm-sim__title { font-size: 22px; line-height: 1.35; margin: 0 0 8px; font-weight: 600; }
.cm-sim__title strong { color: var(--cm-primary); font-weight: 700; }
.cm-sim__help { color: var(--cm-muted); font-size: 14px; margin: 0 0 24px; }

/* Number + slider input */
.cm-sim__input-wrap {
    display: flex; align-items: baseline; gap: 12px;
    background: var(--cm-bg);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    transition: border-color 200ms;
}
.cm-sim__input-wrap:focus-within { border-color: var(--cm-primary); }
.cm-sim__value {
    background: transparent; border: 0; outline: 0;
    font-size: 32px; font-weight: 700; color: var(--cm-text);
    width: 100%; min-width: 0; padding: 0;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}
.cm-sim__value::-webkit-outer-spin-button,
.cm-sim__value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cm-sim__unit { color: var(--cm-muted); font-size: 14px; white-space: nowrap; }

.cm-sim__slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; border-radius: 999px;
    background: var(--cm-border);
    outline: 0; margin: 18px 0 28px;
}
.cm-sim__slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--cm-primary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(50,75,150,.4);
    transition: transform 150ms;
}
.cm-sim__slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.cm-sim__slider::-moz-range-thumb {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--cm-primary); border: 0; cursor: pointer;
    box-shadow: 0 4px 12px rgba(50,75,150,.4);
}

/* Text fields (contact step) */
.cm-sim__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.cm-sim__fields .cm-sim__field--full { grid-column: 1 / -1; }
.cm-sim__field { display: flex; flex-direction: column; gap: 6px; }
.cm-sim__field label { font-size: 13px; color: var(--cm-muted); font-weight: 500; }
.cm-sim__field label .req { color: var(--cm-danger); }
.cm-sim__field input[type="text"],
.cm-sim__field input[type="email"],
.cm-sim__field input[type="tel"] {
    border: 1.5px solid var(--cm-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    background: var(--cm-card);
    color: var(--cm-text);
    transition: border-color 150ms, box-shadow 150ms;
    font-family: inherit;
}
.cm-sim__field input:focus {
    outline: 0;
    border-color: var(--cm-primary);
    box-shadow: 0 0 0 3px rgba(50,75,150,.12);
}
.cm-sim__field.has-error input { border-color: var(--cm-danger); }
.cm-sim__field-error { display: none; font-size: 12px; color: var(--cm-danger); }
.cm-sim__field.has-error .cm-sim__field-error { display: block; }

.cm-sim__consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--cm-muted); margin: 6px 0 18px; }
.cm-sim__consent input { margin-top: 3px; }
.cm-sim__consent.has-error { color: var(--cm-danger); }

/* Honeypot — keep accessible to screen readers but visually hidden */
.cm-sim__hp {
    position: absolute !important; left: -9999px !important;
    width: 1px !important; height: 1px !important; overflow: hidden !important;
}

/* Actions */
.cm-sim__actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cm-sim__btn {
    font-family: inherit;
    font-size: 15px; font-weight: 600;
    padding: 14px 26px;
    border-radius: 12px;
    border: 0; cursor: pointer;
    transition: transform 150ms, box-shadow 150ms, background 150ms, opacity 150ms;
    display: inline-flex; align-items: center; gap: 8px;
}
.cm-sim__btn--primary {
    background: var(--cm-primary); color: #fff;
    box-shadow: 0 6px 18px -4px rgba(50,75,150,.5);
}
.cm-sim__btn--primary:hover { background: var(--cm-primary-dark); transform: translateY(-1px); }
.cm-sim__btn--ghost { background: transparent; color: var(--cm-muted); }
.cm-sim__btn--ghost:hover { color: var(--cm-text); }
.cm-sim__btn[disabled] { opacity: .5; cursor: not-allowed; }
.cm-sim__btn svg { width: 16px; height: 16px; }

/* Intro */
.cm-sim__intro { text-align: center; padding: 12px 0; }
.cm-sim__intro-icon {
    width: 72px; height: 72px; margin: 0 auto 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--cm-primary), var(--cm-accent));
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.cm-sim__intro-icon svg { width: 38px; height: 38px; }
.cm-sim__intro h2 { font-size: 26px; margin: 0 0 10px; font-weight: 700; }
.cm-sim__intro p { color: var(--cm-muted); margin: 0 0 28px; font-size: 15px; }

/* Result */
.cm-sim__result { animation: cmFade 500ms ease both; }
.cm-sim__result h2 {
    font-size: 18px; color: var(--cm-muted); font-weight: 500;
    margin: 0 0 6px; text-align: center;
}
.cm-sim__hero {
    text-align: center; padding: 18px 0 28px;
    border-bottom: 1px dashed var(--cm-border); margin-bottom: 20px;
    position: relative;
}
.cm-sim__hero-value {
    font-size: 56px; font-weight: 800; color: var(--cm-text);
    font-variant-numeric: tabular-nums; letter-spacing: -1.5px;
    line-height: 1;
}
.cm-sim__hero-value sup { font-size: 32px; font-weight: 700; }
.cm-sim__hero-suffix { color: var(--cm-muted); font-size: 15px; margin-top: 6px; }

.cm-sim__line {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0;
    font-size: 15px;
}
.cm-sim__line + .cm-sim__line { border-top: 1px solid var(--cm-border); }
.cm-sim__line-label { color: var(--cm-muted); }
.cm-sim__line-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.cm-sim__savings {
    background: linear-gradient(135deg, rgba(31,157,85,.08), rgba(31,157,85,.02));
    border: 1px solid rgba(31,157,85,.2);
    border-radius: 14px;
    padding: 20px 22px; margin: 18px 0 24px;
}
.cm-sim__savings-row {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 6px;
}
.cm-sim__savings-label { color: var(--cm-success); font-weight: 700; font-size: 16px; }
.cm-sim__savings-value {
    color: var(--cm-success); font-weight: 800;
    font-size: 26px; font-variant-numeric: tabular-nums;
}
.cm-sim__savings-meta { color: var(--cm-muted); font-size: 13px; }
.cm-sim__savings-meta span { font-weight: 600; color: var(--cm-text); }

.cm-sim__thanks {
    background: linear-gradient(135deg, rgba(31,157,85,.08), rgba(31,157,85,.02));
    border: 1px solid rgba(31,157,85,.2);
    border-radius: 14px;
    padding: 18px 20px;
    color: var(--cm-success);
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
}

.cm-sim__cta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cm-sim__cta .cm-sim__btn--primary { flex: 1; justify-content: center; padding: 16px; font-size: 16px; }

/* Sparkles */
.cm-sim__sparkle {
    position: absolute; pointer-events: none;
    width: 10px; height: 10px; border-radius: 50%;
    opacity: 0; animation: cmSpark 1.2s ease forwards;
}
@keyframes cmSpark {
    0%   { opacity: 0; transform: translate(0, 0) scale(.4); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1); }
}

/* Error banner */
.cm-sim__error {
    background: rgba(217,45,32,.08);
    border: 1px solid rgba(217,45,32,.25);
    color: var(--cm-danger);
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}

/* Mobile */
@media (max-width: 600px) {
    .cm-sim__card { padding: 26px 20px; }
    .cm-sim__title { font-size: 19px; }
    .cm-sim__value { font-size: 26px; }
    .cm-sim__hero-value { font-size: 44px; }
    .cm-sim__hero-value sup { font-size: 26px; }
    .cm-sim__fields { grid-template-columns: 1fr; }
}
