/* Presentación específica del trámite, basada en los componentes compartidos del portal. */
.pago-facturas-main {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    gap: 24px;
}

.pago-facturas-heading {
    width: 100%;
    margin: 0 auto 4px;
    text-align: center;
}

.pago-facturas-eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.pago-facturas-heading h1 {
    margin: 0 0 8px;
    color: var(--color-spse-dark, #002d62);
    font-family: var(--font-heading, 'Sora', sans-serif);
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.pago-facturas-heading > p {
    margin: 0;
    color: var(--color-text-muted, #64748b);
    font-size: 1rem;
    line-height: 1.55;
}

.pago-facturas-heading .hero-line-accent {
    margin: 14px auto 0;
}

.pago-facturas-layout {
    display: grid;
    grid-template-columns: 1.28fr 0.72fr;
    align-items: start;
    gap: 32px;
}

.pago-facturas-layout .workflow-column,
.pago-facturas-layout .workflow-info-sidebar {
    min-width: 0;
    width: 100%;
}

.pago-facturas-layout .workflow-header {
    background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
}

.pago-facturas-brand-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 59, 148, 0.14);
    border-radius: 12px;
    background: #edf4ff;
    color: #003b94;
}

.pago-facturas-brand-icon svg {
    width: 21px;
    height: 21px;
}

.pago-facturas-layout .workflow-title {
    font-size: 1.45rem;
}

.payment-identity-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
}

.payment-input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: #1f2937;
    font: 400 0.92rem/1.4 var(--font-sans, 'Inter', sans-serif);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.payment-input::placeholder {
    color: #94a3b8;
}

.payment-input:hover {
    border-color: #94a3b8;
}

.payment-input:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.11);
}

.payment-action {
    min-height: 46px;
    align-self: flex-start;
    padding: 12px 20px;
}

.payment-action svg {
    width: 18px;
    height: 18px;
}

.payment-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.payment-feedback[hidden],
.payment-invoice-section[hidden] {
    display: none !important;
}

.payment-feedback.is-success {
    border-color: var(--color-success-border, #a7f3d0);
    background: var(--color-success-bg, #ecfdf5);
    color: #047857;
}

.payment-invoice-section {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid #e2e8f0;
    animation: paymentSectionIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.payment-invoice-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.payment-invoice-heading > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.payment-invoice-heading h3 {
    margin: 0;
    color: var(--color-spse-dark, #002d62);
    font: 700 1.18rem/1.35 var(--font-heading, 'Sora', sans-serif);
}

.payment-invoice-heading p {
    margin: 4px 0 0;
    color: var(--color-text-muted, #64748b);
    font-size: 0.86rem;
    line-height: 1.45;
}

.payment-invoice-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap !important;
    flex-shrink: 0;
}

.payment-change-data,
.payment-select-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 10px;
    font: 600 0.83rem/1.3 var(--font-sans, 'Inter', sans-serif);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;
}

.payment-change-data svg,
.payment-select-all svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Botón Cambiar Datos: Aspecto secundario / neutral limpio */
.payment-change-data {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.payment-change-data svg {
    color: #64748b;
}

.payment-change-data:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.payment-change-data:hover svg {
    color: #003b94;
    transform: rotate(-10deg);
}

.payment-change-data:active {
    transform: scale(0.97);
    box-shadow: none;
}

/* Botón Seleccionar Todas: Aspecto interactivo azul SPSE suave pero bien visible */
.payment-select-all {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #003b94;
    box-shadow: 0 1px 2px rgba(0, 59, 148, 0.05);
}

.payment-select-all svg {
    color: #003b94;
}

.payment-select-all:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
    color: #002d62;
    box-shadow: 0 3px 8px rgba(0, 59, 148, 0.14);
    transform: translateY(-1px);
}

.payment-select-all:hover svg {
    transform: scale(1.1);
}

.payment-select-all:active {
    transform: scale(0.97);
    box-shadow: none;
}

.payment-invoice-list {
    display: grid;
    gap: 10px;
}

.payment-invoice-list.has-scroll {
    max-height: 420px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 3px 6px 3px 3px;
    scrollbar-color: #94a3b8 #eff6ff;
    scrollbar-width: thin;
}

.payment-invoice-option {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.payment-invoice-option:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 59, 148, 0.38);
    background: #f8fbff;
    box-shadow: 0 5px 14px rgba(0, 45, 98, 0.06);
}

.payment-invoice-option:has(input:checked) {
    border-color: #2563eb;
    background: #f3f7ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.payment-invoice-option input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: #003b94;
}

.payment-invoice-details {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.4;
}

.payment-invoice-details strong {
    color: #002d62;
    font-size: 0.92rem;
}

.payment-invoice-amount {
    flex: 0 0 auto;
    color: #002d62;
    font-size: 0.98rem;
    white-space: nowrap;
}

.payment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
    padding: 18px 20px;
    border: 1px solid rgba(0, 59, 148, 0.13);
    border-radius: 16px;
    background: #f3f7ff;
}

.payment-summary > div {
    display: grid;
    gap: 4px;
}

.payment-summary-label {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
}

.payment-summary-periods {
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.4;
}

.payment-summary strong {
    color: #002d62;
    font-size: 1.4rem;
    line-height: 1.2;
}

.payment-submit {
    align-self: center;
    flex: 0 0 auto;
}

.payment-security-note {
    margin: 12px 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.5;
}

.payment-steps-card > h4 {
    margin: 0 0 20px;
    color: #002d62;
    font: 700 1rem/1.4 var(--font-heading, 'Sora', sans-serif);
}

/* ==========================================================================
   Payment Result Page (Procesando y Confirmado)
   Estilo visual idéntico a Libre de Deuda (halos luminosos, badges y animaciones)
   ========================================================================== */

.payment-result-main {
    max-width: 720px;
    min-height: calc(100vh - 90px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 135px !important;
    padding-bottom: 60px;
    padding-left: 20px;
    padding-right: 20px;
    margin: 0 auto !important;
    box-sizing: border-box;
    width: 100%;
}

/* Animación sutil de entrada de la tarjeta (matching Libre de Deuda) */
@keyframes resultCardEntrance {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.payment-result-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 42px 45px;
    width: 100%;
    max-width: 660px;
    box-sizing: border-box;
    text-align: center;
    margin: 0 auto;
    color: #0f172a;
    position: relative;
    animation: resultCardEntrance 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.6s ease;
}

/* Halos luminosos por estado (Libre de Deuda style) */
.payment-result-card.is-success {
    box-shadow: 0 20px 45px -10px rgba(34, 197, 94, 0.22), 0 0 35px rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.28);
}

.payment-result-card.is-processing {
    box-shadow: 0 20px 45px -10px rgba(37, 99, 235, 0.22), 0 0 35px rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.28);
}

.payment-result-card.is-error {
    box-shadow: 0 20px 45px -10px rgba(239, 68, 68, 0.22), 0 0 35px rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.28);
}

/* Status Badges superiores tipo píldora */
.status-badge-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 0 22px 0;
}

.status-badge-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 7px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.status-badge-success svg {
    margin-right: 8px;
    flex-shrink: 0;
}

.status-badge-pending {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 7px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.14);
}

.status-badge-pending svg {
    margin-right: 8px;
    flex-shrink: 0;
}

.status-badge-error {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 7px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.15);
}

.status-badge-error svg {
    margin-right: 8px;
    flex-shrink: 0;
}

/* Ícono Hero Circular de Estado */
.payment-status-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.35s ease;
}

.payment-status-icon.is-success {
    background: #ecfdf5;
    border: 2px solid #a7f3d0;
    color: #059669;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.12), 0 8px 18px -2px rgba(16, 185, 129, 0.22);
}

.payment-status-icon.is-processing {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    color: #1d4ed8;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.1), 0 8px 18px -2px rgba(37, 99, 235, 0.2);
}

.payment-status-icon.is-error {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #dc2626;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.1), 0 8px 18px -2px rgba(239, 68, 68, 0.2);
}

/* Radar pulse sutil para el estado procesando */
.payment-status-icon.is-processing::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.35);
    animation: pulseRing 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
    pointer-events: none;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.96);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.22);
        opacity: 0;
    }
    100% {
        transform: scale(1.22);
        opacity: 0;
    }
}

/* Rotación suave para el ícono spinner */
.payment-status-icon .payment-spinner-icon {
    animation: paymentRotate 1.1s linear infinite;
}

@keyframes paymentRotate {
    100% {
        transform: rotate(360deg);
    }
}

/* Animación de pop para la confirmación de pago */
.payment-status-icon.animate-pop,
.payment-status-icon.is-success {
    animation: iconPopSuccess 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes iconPopSuccess {
    0% {
        transform: scale(0.65) rotate(-12deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

/* Título y textos */
.payment-result-card h1,
.payment-result-title {
    margin: 0 0 8px 0;
    color: #002d62;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -0.3px;
    font-family: var(--font-heading, 'Sora', sans-serif);
}

.payment-result-card p.payment-result-description {
    margin: 0 0 20px 0;
    color: #64748b;
    font-size: 14.5px;
    line-height: 1.55;
    max-width: 530px;
    margin-left: auto;
    margin-right: auto;
}

.payment-return-notice {
    margin: 0 auto 20px;
    max-width: 530px;
    padding: 13px 16px;
    border: 1px solid #fde68a;
    border-radius: 14px;
    background: #fffbeb;
    color: #92400e;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.payment-return-notice[hidden] {
    display: none;
}

/* Detalle de pago acreditado estilo Libre de Deuda (data-grid) */
.payment-confirmed-details {
    margin-top: 24px;
    text-align: left;
    animation: detailsSlideIn 0.35s ease-out both;
}

@keyframes detailsSlideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.payment-receipt-grid {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 22px 26px;
    width: 100%;
    box-sizing: border-box;
}

.payment-receipt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.payment-receipt-title {
    font-size: 15px;
    font-weight: 700;
    color: #002d62;
    margin: 0;
    font-family: var(--font-heading, 'Sora', sans-serif);
}

.code-pill {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    display: inline-block;
    font-weight: 600;
}

.payment-receipt-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.payment-receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13.5px;
    line-height: 1.5;
}

.payment-receipt-row-label {
    color: #475569;
}

.payment-receipt-row-label strong {
    color: #1e293b;
}

.payment-receipt-row-value {
    color: #002d62;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.payment-receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #002d62;
}

.payment-receipt-total-value {
    font-size: 17px;
    color: #059669;
}

.payment-email-notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    padding: 15px 20px;
    text-align: center;
    font-size: 13.5px;
    color: #065f46;
    margin: 20px 0 0;
    line-height: 1.5;
    font-weight: 500;
}

.payment-legal-note {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin: 10px 0 0;
}

/* Resumen del pago pendiente */
.payment-pending-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 18px;
    border-radius: 100px;
    font-size: 13.5px;
    color: #475569;
    margin: 16px auto 0;
    font-weight: 500;
}

.payment-pending-summary strong {
    color: #002d62;
}

/* Botón de acción principal (azul estándar SPSE #003b94, sin degrade) */
.payment-result-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #003b94 !important;
    background-image: none !important;
    color: #ffffff !important;
    padding: 13px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(0, 45, 98, 0.2);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
    margin: 24px auto 0;
}

.payment-result-action:hover:not(.is-disabled):not([aria-disabled="true"]) {
    background-color: #002d62 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 45, 98, 0.28);
}

.payment-result-action:active:not(.is-disabled):not([aria-disabled="true"]) {
    transform: translateY(1px);
}

/* Deshabilitado durante el procesamiento para evitar que el usuario salga antes de acreditar */
.payment-result-action.is-disabled,
.payment-result-action[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

@media (max-width: 845px) {
    .pago-facturas-main {
        padding-top: 112px;
        padding-right: 16px;
        padding-left: 16px;
        gap: 24px;
    }

    .pago-facturas-layout {
        display: flex;
        flex-direction: column;
        gap: 22px;
    }

    .pago-facturas-layout .workflow-column,
    .pago-facturas-layout .workflow-info-sidebar {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 640px) {
    .pago-facturas-main {
        padding-top: 94px;
        padding-right: 12px;
        padding-left: 12px;
        gap: 20px;
    }

    .payment-result-main {
        padding-top: 130px !important;
        padding-bottom: 40px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .payment-result-card {
        padding: 28px 18px;
        border-radius: 20px;
    }

    .payment-receipt-grid {
        padding: 18px 16px;
    }

    .payment-receipt-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .payment-receipt-row-value {
        align-self: flex-end;
    }

    .payment-result-action {
        width: 100%;
        box-sizing: border-box;
    }

    .pago-facturas-heading > p {
        font-size: 0.9rem;
    }

    .payment-identity-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 15px;
    }

    .payment-action {
        width: 100%;
    }

    .payment-invoice-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .payment-invoice-actions {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap !important;
        gap: 8px;
    }

    .payment-change-data,
    .payment-select-all {
        flex: 1 1 50%;
        justify-content: center;
        padding: 8px 8px;
        font-size: 0.78rem;
    }

    .payment-invoice-option {
        align-items: flex-start;
        gap: 11px;
        padding: 13px 12px;
    }

    .payment-invoice-list.has-scroll {
        max-height: 500px;
    }

    .payment-invoice-details {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .payment-invoice-amount {
        align-self: center;
        font-size: 0.9rem;
    }

    .payment-summary {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }

    .payment-summary strong {
        font-size: 1.3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .payment-invoice-section,
    .payment-invoice-option,
    .payment-result-card,
    .payment-status-icon,
    .payment-status-icon .payment-spinner-icon,
    .payment-status-icon::after,
    .payment-confirmed-details,
    .status-badge-success,
    .status-badge-pending,
    .status-badge-error {
        animation: none !important;
        transition: none !important;
    }
}
