/* ============================================================
   Elabora Resi – Frontend
   ============================================================ */

.er-app {
    --er-primary:      #1a1a2e;
    --er-accent:       #4f6ef7;
    --er-accent-h:     #3a57e0;
    --er-success:      #16a34a;
    --er-error:        #dc2626;
    --er-warn:         #d97706;
    --er-border:       #e2e8f0;
    --er-bg:           #f8fafc;
    --er-card:         #ffffff;
    --er-text:         #1e293b;
    --er-muted:        #64748b;
    --er-radius:       12px;
    --er-shadow:       0 4px 28px rgba(0,0,0,.08);

    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px 64px;
    font-family: inherit;
    color: var(--er-text);
}

/* ── Step transition ──────────────────────────────────────── */
.er-step { animation: erFadeUp .25s ease-out; }

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

/* ── Stepper ─────────────────────────────────────────────── */
.er-stepper {
    margin-bottom: 32px;
}

.er-stepper__track {
    display: flex;
    align-items: center;
    justify-content: center;
}

.er-stepper__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.er-stepper__dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--er-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--er-muted);
    transition: background .2s, color .2s;
}

.er-stepper__step.is-active .er-stepper__dot {
    background: var(--er-accent);
    color: #fff;
}

.er-stepper__step.is-done .er-stepper__dot {
    background: var(--er-success);
    color: #fff;
}

.er-stepper__step.is-done .er-stepper__dot span::before {
    content: '✓';
}

.er-stepper__step.is-done .er-stepper__dot span { font-size: 0; }

.er-stepper__label {
    font-size: 11px;
    color: var(--er-muted);
    font-weight: 500;
    white-space: nowrap;
}

.er-stepper__step.is-active .er-stepper__label { color: var(--er-accent); font-weight: 700; }
.er-stepper__step.is-done  .er-stepper__label  { color: var(--er-success); }

.er-stepper__line {
    flex: 1;
    height: 2px;
    background: var(--er-border);
    margin: 0 6px;
    margin-bottom: 22px;
    transition: background .2s;
}

/* ── Card ─────────────────────────────────────────────────── */
.er-card {
    background: var(--er-card);
    border-radius: var(--er-radius);
    box-shadow: var(--er-shadow);
    padding: 36px 32px;
}

.er-card--success { border-top: 4px solid var(--er-success); }

.er-success-icon { font-size: 44px; margin-bottom: 12px; }

.er-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--er-primary);
    margin: 0 0 8px;
}

.er-card__sub {
    color: var(--er-muted);
    font-size: .92rem;
    margin: 0 0 26px;
    line-height: 1.6;
}

/* ── Fields ───────────────────────────────────────────────── */
.er-field { margin-bottom: 20px; }

.er-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: 7px;
    color: var(--er-text);
}

.er-req  { color: var(--er-error); }
.er-optional { font-weight: 400; color: var(--er-muted); font-size: .82rem; }

.er-field input[type="number"],
.er-field input[type="email"],
.er-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--er-border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--er-text);
    background: var(--er-bg);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.er-field input:focus,
.er-field textarea:focus {
    outline: none;
    border-color: var(--er-accent);
    box-shadow: 0 0 0 3px rgba(79,110,247,.12);
    background: #fff;
}

/* ── Alert ────────────────────────────────────────────────── */
.er-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 18px;
    line-height: 1.5;
}
.er-alert--error {
    background: #fef2f2;
    color: var(--er-error);
    border: 1px solid #fecaca;
}

/* ── Buttons ──────────────────────────────────────────────── */
.er-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: .97rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, opacity .15s;
    min-width: 140px;
}

.er-btn:disabled { opacity: .45; cursor: not-allowed; }

.er-btn--primary {
    background: var(--er-accent);
    color: #fff;
}
.er-btn--primary:hover:not(:disabled) { background: var(--er-accent-h); }

.er-btn--ghost {
    background: transparent;
    color: var(--er-muted);
    border: 1.5px solid var(--er-border);
}
.er-btn--ghost:hover:not(:disabled) { background: var(--er-bg); }

.er-footer {
    margin-top: 24px;
}
.er-footer--split {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}
.er-footer--split .er-btn--primary { flex: 1; }

/* Spinner */
.er-btn__spinner {
    width: 17px; height: 17px;
    border: 2.5px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: erSpin .65s linear infinite;
}
@keyframes erSpin { to { transform: rotate(360deg); } }

/* ── Order banner (step 2) ────────────────────────────────── */
.er-order-banner {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--er-bg);
    border: 1px solid var(--er-border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.er-order-banner__col { display: flex; flex-direction: column; gap: 2px; }
.er-order-banner__label { font-size: .78rem; color: var(--er-muted); }

/* ── Badges ───────────────────────────────────────────────── */
.er-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.4;
}
.er-badge--ok   { background: #dcfce7; color: #15803d; }
.er-badge--warn { background: #fef9c3; color: #a16207; }

/* ── Item list (step 2) ───────────────────────────────────── */
.er-items-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }

.er-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--er-border);
    border-radius: 10px;
    background: var(--er-bg);
    transition: border-color .15s, background .15s;
}
.er-item--selected { border-color: var(--er-accent); background: #eff3ff; }

/* Custom checkbox */
.er-item__check-wrap { flex-shrink: 0; margin-top: 2px; cursor: pointer; }

.er-item__cb {
    position: absolute; opacity: 0; width: 0; height: 0;
}

.er-item__checkmark {
    display: block;
    width: 22px; height: 22px;
    border: 2px solid var(--er-border);
    border-radius: 6px;
    background: #fff;
    transition: background .15s, border-color .15s;
    position: relative;
}
.er-item__cb:checked + .er-item__checkmark {
    background: var(--er-accent);
    border-color: var(--er-accent);
}
.er-item__cb:checked + .er-item__checkmark::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 6px; height: 11px;
    border: 2px solid #fff;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}

.er-item__body { flex: 1; }
.er-item__name { font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.er-item__meta { font-size: .82rem; color: var(--er-muted); }
.er-sku        { color: var(--er-muted); font-size: .8rem; }

.er-item__controls { margin-top: 10px; }

.er-qty-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--er-muted);
}

.er-item__qty {
    width: 90px;
    padding: 7px 10px;
    border: 1.5px solid var(--er-border);
    border-radius: 6px;
    font-size: .9rem;
}

/* ── Confirm checkbox (step 4) ────────────────────────────── */
.er-confirm-box {
    background: var(--er-bg);
    border: 1.5px solid var(--er-border);
    border-radius: 10px;
    padding: 16px;
    margin-top: 20px;
}

.er-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: .92rem;
    line-height: 1.5;
}

.er-checkbox-label input[type="checkbox"] {
    position: absolute; opacity: 0; width: 0; height: 0;
}

.er-checkmark {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 2px solid var(--er-border);
    border-radius: 6px;
    background: #fff;
    margin-top: 1px;
    transition: background .15s, border-color .15s;
    position: relative;
}
.er-checkbox-label input:checked ~ .er-checkmark {
    background: var(--er-accent);
    border-color: var(--er-accent);
}
.er-checkbox-label input:checked ~ .er-checkmark::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 6px; height: 11px;
    border: 2px solid #fff;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}

/* ── Recap tables (step 4) ────────────────────────────────── */
.er-recap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    margin-bottom: 4px;
}
.er-recap-table th,
.er-recap-table td {
    padding: 8px 10px;
    border: 1px solid var(--er-border);
    text-align: left;
}
.er-recap-table--info th { background: var(--er-bg); width: 38%; font-weight: 600; }
.er-recap-table--items thead { background: var(--er-bg); }
.er-recap-table h4 { margin: 16px 0 6px; font-size: .95rem; }

/* ── Receipt (step 5) ─────────────────────────────────────── */
.er-receipt {
    background: var(--er-bg);
    border: 1px solid var(--er-border);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}
.er-receipt__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--er-border);
    font-size: .9rem;
    color: var(--er-muted);
}
.er-receipt__row:last-of-type { border-bottom: none; }
.er-receipt__row strong { color: var(--er-text); }
.er-protocol {
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-family: monospace;
    letter-spacing: .5px;
}
.er-receipt__note {
    margin-top: 14px;
    font-size: .8rem;
    color: var(--er-muted);
    line-height: 1.6;
    padding-top: 14px;
    border-top: 1px solid var(--er-border);
}

/* ── Shortcode CTA ────────────────────────────────────────── */
.er-cta-link { text-decoration: underline; }

.er-cta-button {
    display: inline-block;
    padding: 11px 22px;
    background: var(--er-accent, #4f6ef7);
    color: #fff !important;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.er-cta-button:hover { background: var(--er-accent-h, #3a57e0); }

/* ── Responsive ───────────────────────────────────────────── */
@media ( max-width: 520px ) {
    .er-card { padding: 24px 18px; }
    .er-footer--split { flex-direction: column-reverse; }
    .er-footer--split .er-btn { width: 100%; }
    .er-order-banner { flex-direction: column; gap: 10px; }
    .er-stepper__label { font-size: 10px; }
}
