/* ============================================================
   Estatus de solicitud de crédito — El Bodegón
   Usa los tokens del design system (eb-theme.css). Prefijo ebc-
   ============================================================ */

.ebc-section {
    background: var(--eb-bg, #f5f5f7);
    padding: 46px 0 64px;
    min-height: 55vh;
}

.ebc-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Tarjeta de búsqueda ────────────────────────────────── */
.ebc-form-card {
    background: var(--eb-surface, #fff);
    border: 1px solid var(--eb-line, #ececec);
    border-radius: var(--eb-radius, 16px);
    box-shadow: 0 6px 22px rgba(20, 20, 30, 0.05);
    overflow: hidden;
    animation: eb-fadeUp 0.5s ease both;
}

.ebc-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--eb-line, #ececec);
}

.ebc-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--eb-red, #db0b14), var(--eb-red-dark, #a8090f));
    box-shadow: 0 4px 12px rgba(219, 11, 20, 0.26);
    color: #fff;
    font-size: 1.2rem;
}

.ebc-card-title {
    margin: 0 0 4px;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--eb-ink, #1d1d1f);
}

.ebc-card-desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--eb-gray, #6b6b6b);
}

.ebc-card-body { padding: 24px 28px 28px; }

/* ── Campo ──────────────────────────────────────────────── */
.ebc-field { display: flex; flex-direction: column; gap: 8px; }

.ebc-label {
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--eb-red-dark, #a8090f);
}

.ebc-label i { margin-right: 4px; }

/* grid, no flex: dentro de un flex-column un basis en px se vuelve altura */
.ebc-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.ebc-input-wrap { position: relative; display: flex; align-items: center; }

.ebc-input-prefix {
    position: absolute;
    left: 16px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #b9b9bd;
    pointer-events: none;
}

.ebc-input {
    width: 100%;
    height: 54px;
    padding: 0 16px 0 38px;
    border: 1.5px solid #d9d9de;
    border-radius: var(--eb-radius-sm, 10px);
    background: #fafafb;
    font-family: var(--eb-font-body, 'Inter', sans-serif);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--eb-ink, #1d1d1f);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.ebc-input::placeholder { font-weight: 400; letter-spacing: normal; color: #b9b9bd; }

.ebc-input:focus {
    border-color: var(--eb-red, #db0b14);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(219, 11, 20, 0.12);
}

.ebc-field.has-error .ebc-input { border-color: var(--eb-red, #db0b14); }
.ebc-field.has-error .ebc-field-error { display: block; }

.ebc-field-error {
    display: none;
    font-size: 0.78rem;
    color: var(--eb-red-dark, #a8090f);
}

/* ── Botón ──────────────────────────────────────────────── */
.ebc-btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 54px;
    padding: 0 30px;
    border: none;
    border-radius: var(--eb-radius-sm, 10px);
    background: linear-gradient(135deg, var(--eb-red, #db0b14), var(--eb-red-dark, #a8090f));
    box-shadow: 0 4px 16px rgba(219, 11, 20, 0.28);
    color: #fff;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.2s var(--eb-ease, ease), box-shadow 0.2s var(--eb-ease, ease), opacity 0.2s;
}

.ebc-btn-search:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(219, 11, 20, 0.36);
}

.ebc-btn-search:active:not(:disabled) { transform: translateY(0); }
.ebc-btn-search:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Mientras consulta NO se atenúa (si no, el aviso se pierde) y conserva el ancho
   para que el botón no brinque al cambiar "Consultar" por "Consultando..." */
.ebc-btn-search { min-width: 196px; }
.ebc-btn-search.is-loading:disabled { opacity: 1; cursor: progress; }

.ebc-btn-text, .ebc-btn-loader { display: inline-flex; align-items: center; gap: 8px; }
.ebc-btn-loader { display: none; }
.ebc-btn-search.is-loading .ebc-btn-text { display: none; }
.ebc-btn-search.is-loading .ebc-btn-loader { display: inline-flex; }
.ebc-btn-search.is-loading .ebc-btn-loader i { font-size: 1.05rem; }

/* ── Aviso de carga en la zona de resultados ────────────── */
.ebc-loading {
    padding: 32px 28px 30px;
    border: 1px solid var(--eb-line, #ececec);
    border-radius: var(--eb-radius, 16px);
    background: var(--eb-surface, #fff);
    box-shadow: 0 6px 22px rgba(20, 20, 30, 0.05);
    text-align: center;
    animation: eb-fadeUp 0.3s ease both;
}

.ebc-loading-spin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--eb-red-soft, #fdeaeb);
    color: var(--eb-red, #db0b14);
    font-size: 1.5rem;
}

.ebc-loading-title {
    margin: 0 0 6px;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--eb-ink, #1d1d1f);
}

.ebc-loading-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--eb-gray, #6b6b6b);
}

.ebc-loading-bar {
    position: relative;
    height: 4px;
    max-width: 260px;
    margin: 20px auto 0;
    border-radius: 4px;
    background: var(--eb-red-soft, #fdeaeb);
    overflow: hidden;
}

.ebc-loading-bar span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--eb-red, #db0b14), var(--eb-red-dark, #a8090f));
    animation: ebc-barra 1.1s ease-in-out infinite;
}

@keyframes ebc-barra {
    from { left: -40%; }
    to   { left: 100%; }
}

/* ── Resultado ──────────────────────────────────────────── */
.ebc-results { margin-top: 26px; }

.ebc-result-card {
    /* Estructura (franja + stepper): SIEMPRE la marca El Bodegón, para que la
       tarjeta no se despegue del resto del portal. */
    --ebc-brand:       var(--eb-red, #db0b14);
    --ebc-brand-dark:  var(--eb-red-dark, #a8090f);
    --ebc-brand-pale:  var(--eb-red-soft, #fdeaeb);

    /* Estado (badge + ilustración): semántico, lo redefine cada .ebc-state-* */
    --ebc-accent:      var(--eb-red, #db0b14);
    --ebc-accent-dark: var(--eb-red-dark, #a8090f);
    --ebc-accent-pale: var(--eb-red-soft, #fdeaeb);

    overflow: hidden;
    border: 1px solid var(--eb-line, #ececec);
    border-radius: var(--eb-radius, 16px);
    background: var(--eb-surface, #fff);
    box-shadow: 0 8px 28px rgba(20, 20, 30, 0.07);
    animation: eb-fadeUp 0.4s ease both;
}

/* Paleta semántica por resolución */
.ebc-result-card.ebc-state-analisis,
.ebc-result-card.ebc-state-revision {
    --ebc-accent: #c07c00;
    --ebc-accent-dark: #8f5c00;
    --ebc-accent-pale: #fff4e0;
}

.ebc-result-card.ebc-state-aprobada {
    --ebc-accent: #0b8a5b;
    --ebc-accent-dark: #046244;
    --ebc-accent-pale: #e2f7ec;
}

.ebc-result-card.ebc-state-noaprobada {
    --ebc-accent: #c1121f;
    --ebc-accent-dark: #8c0d17;
    --ebc-accent-pale: #fdeaeb;
}

.ebc-result-card.ebc-state-cerrada {
    --ebc-accent: #6b6b6b;
    --ebc-accent-dark: #4e4e4e;
    --ebc-accent-pale: #f0f0f2;
}

/* Encabezado */
.ebc-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 22px 28px;
    background: linear-gradient(135deg, var(--ebc-brand-dark) 0%, var(--ebc-brand) 100%);
    color: #fff;
}

.ebc-result-folio-label {
    display: block;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.85;
}

.ebc-result-folio-num {
    display: block;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ebc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 50px;
    background: #fff;
    color: var(--ebc-accent-dark);
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Stepper ────────────────────────────────────────────── */
.ebc-stepper {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 34px 28px 26px;
    background: linear-gradient(to bottom, var(--ebc-brand-pale), var(--eb-surface, #fff));
}

.ebc-stepper-track {
    position: absolute;
    top: 52px;
    left: calc(16.66% + 14px);
    right: calc(16.66% + 14px);
    height: 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.09);
}

.ebc-stepper-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--ebc-brand);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.9s var(--eb-ease, cubic-bezier(0.16, 1, 0.3, 1)) 0.25s;
}

.ebc-stepper[data-paso="2"] .ebc-stepper-fill { transform: scaleX(0.5); }
.ebc-stepper[data-paso="3"] .ebc-stepper-fill { transform: scaleX(1); }

.ebc-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.ebc-step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(0, 0, 0, 0.10);
    border-radius: 50%;
    background: var(--eb-surface, #fff);
    color: #bdbdc2;
    font-size: 1rem;
    transition: border-color 0.3s, color 0.3s, background 0.3s, box-shadow 0.3s;
}

.ebc-step.is-done .ebc-step-dot {
    border-color: var(--ebc-brand);
    background: var(--ebc-brand);
    color: #fff;
}

.ebc-step.is-current .ebc-step-dot {
    border-color: var(--ebc-brand);
    background: var(--eb-surface, #fff);
    color: var(--ebc-brand);
    box-shadow: 0 0 0 6px rgba(219, 11, 20, 0.14); /* fallback si no hay color-mix */
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ebc-brand) 16%, transparent);
    animation: ebc-pulse 2s ease-in-out infinite;
}

.ebc-step-label {
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--eb-gray, #6b6b6b);
}

.ebc-step.is-done .ebc-step-label,
.ebc-step.is-current .ebc-step-label { color: var(--eb-ink, #1d1d1f); }

/* ── Ilustración del estado ─────────────────────────────────
   El SVG va inline y pinta con var(--ebc-accent), así que se
   recolorea solo según el estado de la solicitud.             */
.ebc-illus {
    display: flex;
    justify-content: center;
    padding: 4px 28px 6px;
    background: var(--eb-surface, #fff);
    animation: eb-fadeUp 0.45s ease both 0.1s;
}

.ebc-illus-svg {
    display: block;
    width: 190px;
    max-width: 58%;
    height: auto;
}

.ebc-illus + .ebc-result-msg { padding-top: 14px; }

/* ── Mensaje ────────────────────────────────────────────── */
.ebc-result-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 28px 22px;
    border-bottom: 1px solid var(--eb-line, #ececec);
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--eb-gray, #6b6b6b);
}

.ebc-result-msg i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--ebc-accent);
    font-size: 1.1rem;
}

/* ── Datos ──────────────────────────────────────────────── */
.ebc-result-grid { display: grid; grid-template-columns: repeat(2, 1fr); }

.ebc-result-item {
    padding: 18px 28px;
    border-right: 1px solid var(--eb-line, #ececec);
    border-bottom: 1px solid var(--eb-line, #ececec);
    animation: eb-fadeUp 0.4s ease both;
}

.ebc-result-item:nth-child(2n) { border-right: none; }
.ebc-result-item:nth-child(2) { animation-delay: 0.06s; }
.ebc-result-item:nth-child(3) { animation-delay: 0.12s; }
.ebc-result-item:nth-child(4) { animation-delay: 0.18s; }

.ebc-result-item-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eb-gray-2, #8a8a8a);
}

.ebc-result-item-value {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--eb-ink, #1d1d1f);
}

/* ── Nota de contacto ───────────────────────────────────── */
.ebc-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 28px 20px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--eb-gray, #6b6b6b);
}

.ebc-info-banner i { flex-shrink: 0; margin-top: 2px; color: var(--eb-red, #db0b14); }
.ebc-info-banner a { color: var(--eb-red-dark, #a8090f); font-weight: 600; text-decoration: underline; }

/* ── Vacío / error ──────────────────────────────────────── */
.ebc-empty {
    padding: 38px 28px;
    border: 1px dashed rgba(219, 11, 20, 0.22);
    border-radius: var(--eb-radius, 16px);
    background: var(--eb-surface, #fff);
    text-align: center;
    animation: eb-fadeUp 0.35s ease both;
}

.ebc-empty i { font-size: 2rem; color: #bdbdc2; }

.ebc-empty-title {
    margin: 14px 0 6px;
    font-family: var(--eb-font-head, 'Montserrat', sans-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--eb-ink, #1d1d1f);
}

.ebc-empty-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--eb-gray, #6b6b6b);
}

/* ── Keyframes ──────────────────────────────────────────── */
@keyframes ebc-pulse {
    0%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ebc-brand) 16%, transparent); }
    50%      { box-shadow: 0 0 0 11px color-mix(in srgb, var(--ebc-brand) 6%, transparent); }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .ebc-section { padding: 34px 0 48px; }
    .ebc-card-header { padding: 20px 18px 16px; gap: 12px; }
    .ebc-card-body { padding: 20px 18px 22px; }
    .ebc-input-row { grid-template-columns: 1fr; }
    .ebc-btn-search { width: 100%; }
    .ebc-result-header { padding: 18px; }
    .ebc-result-folio-num { font-size: 1.3rem; }
    .ebc-stepper { padding: 26px 12px 20px; }
    .ebc-stepper-track { top: 46px; left: calc(16.66% + 10px); right: calc(16.66% + 10px); }
    .ebc-step-dot { width: 38px; height: 38px; font-size: 0.9rem; }
    .ebc-step-label { font-size: 0.7rem; }
    .ebc-illus { padding: 4px 18px 2px; }
    .ebc-illus-svg { width: 148px; }
    .ebc-result-msg { padding: 18px; }
    .ebc-illus + .ebc-result-msg { padding-top: 12px; }
    .ebc-result-grid { grid-template-columns: 1fr; }
    .ebc-result-item { padding: 14px 18px; border-right: none; }
    .ebc-info-banner { padding: 14px 18px 18px; }
}

/* ── Movimiento reducido ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ebc-form-card,
    .ebc-result-card,
    .ebc-result-item,
    .ebc-illus,
    .ebc-empty { animation: none; }

    .ebc-stepper-fill { transition: none; }
    .ebc-step.is-current .ebc-step-dot { animation: none; }
    .ebc-btn-search:hover { transform: none; }
}
