/* ============================================================
   stepper.css — CimaStepper, componente vanilla reutilizable.
   Prefijo .cstep- para no colisionar con otros módulos. Autónomo:
   cero dependencias de otros estilos CIMA (SIMA/portal/CimaUI).
   Mobile-first (botones ≥44px, un solo panel visible por vez).
   ============================================================ */

.cstep-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    color: var(--text-main, #fff);
    font-family: inherit;
}

/* ── Cabecera de progreso ── */
.cstep-progress {
    display: flex;
    align-items: center;
    padding: 4px 2px 18px;
}

.cstep-dot-wrap {
    display: flex;
    align-items: center;
    flex: 1;
}
.cstep-dot-wrap:last-child { flex: 0 0 auto; }

.cstep-dot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.22));
    background: var(--glass-bg, rgba(255,255,255,0.06));
    color: var(--text-muted, rgba(255,255,255,0.55));
    font-size: 0.8rem;
    font-weight: 700;
    cursor: default;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    outline: none;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
    flex-shrink: 0;
}

.cstep-dot-btn .bi { font-size: 0.85rem; line-height: 1; }

.cstep-dot-wrap.is-done .cstep-dot-btn {
    cursor: pointer;
    background: color-mix(in srgb, var(--primary, #6366f1) 22%, transparent);
    border-color: var(--primary, #6366f1);
    color: var(--primary, #6366f1);
}
.cstep-dot-wrap.is-done .cstep-dot-btn:active { transform: scale(.92); }

.cstep-dot-wrap.is-active .cstep-dot-btn {
    background: var(--primary, #6366f1);
    border-color: var(--primary, #6366f1);
    color: var(--btn-on-primary, #fff);
}

.cstep-dot-line {
    flex: 1;
    height: 2px;
    margin: 0 6px;
    background: var(--glass-border, rgba(255,255,255,0.16));
    transition: background .2s;
}
.cstep-dot-wrap.is-done .cstep-dot-line { background: var(--primary, #6366f1); }

.cstep-dot-label {
    display: none;
    font-size: 0.68rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Barra simple (progress = 'bar') */
.cstep-progress-bar-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--glass-bg, rgba(255,255,255,0.1));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
    overflow: hidden;
    margin-bottom: 18px;
}
.cstep-progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary, #6366f1);
    transition: width .25s ease;
}

/* ── Cuerpo ── */
.cstep-body {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.cstep-panel {
    display: none;
    width: 100%;
}
.cstep-panel.is-current {
    display: block;
}

/* Transición slide sutil */
.cstep-panel.is-anim-in-next  { animation: cstep-slide-in-next .2s ease both; }
.cstep-panel.is-anim-in-prev  { animation: cstep-slide-in-prev .2s ease both; }

@keyframes cstep-slide-in-next {
    from { transform: translateX(16px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes cstep-slide-in-prev {
    from { transform: translateX(-16px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cstep-panel.is-anim-in-next,
    .cstep-panel.is-anim-in-prev { animation: none; }
    .cstep-dot-btn, .cstep-dot-line, .cstep-progress-bar-fill { transition: none; }
}

/* ── Banner de error ── */
.cstep-error {
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    background: color-mix(in srgb, var(--pp-danger, #ef4444) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--pp-danger, #ef4444) 45%, transparent);
    color: var(--pp-danger, #ef4444);
}
.cstep-error.is-visible { display: flex; }
.cstep-error .bi { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }

/* ── Botonera ── */
.cstep-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.cstep-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 12px 20px;
    border-radius: 11px;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.22));
    background: var(--btn-ghost-bg, rgba(255,255,255,0.10));
    color: var(--text-main, #fff);
    font-size: 0.94rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: opacity .15s, transform .1s, background .15s;
}
.cstep-btn:active { opacity: .85; transform: scale(.98); }
.cstep-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.cstep-btn-back {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted, rgba(255,255,255,0.6));
    flex: 0 0 auto;
}
.cstep-btn-back:active { background: var(--glass-bg, rgba(255,255,255,0.08)); }

.cstep-btn-next {
    flex: 1;
    background: var(--primary, #6366f1);
    border-color: var(--primary, #6366f1);
    color: var(--btn-on-primary, #fff);
}
.cstep-btn-next:active { background: color-mix(in srgb, var(--primary, #6366f1) 85%, black); }

.cstep-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--btn-on-primary, #fff) 35%, transparent);
    border-top-color: var(--btn-on-primary, #fff);
    animation: cstep-spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .cstep-spinner { animation-duration: 1.4s; }
}
@keyframes cstep-spin { to { transform: rotate(360deg); } }

/* ── Desktop: labels bajo los puntos ── */
@media (min-width: 560px) {
    .cstep-dot-label { display: block; }
    .cstep-dot-wrap { flex-direction: column; }
    .cstep-dot-wrap .cstep-dot-line { position: relative; top: -12px; }
}

/* Sin bloque prefers-color-scheme: el tema lo dictan las VARIABLES del host
   (regla CIMA: colores siempre por tema activo). El portal define su paleta
   glass y los fallbacks de los var() cubren el resto. */
