/**
 * Acceso: verificación en dos pasos, desafío al ingresar, registro y Google
 * (HW Croster Custom, 10-11-2026).
 *
 * Misma línea que el modal de pago (order-checkout.css, 0.35.0): diálogo de 12 px con sombra
 * azul marino, títulos de peso 600 y colores, bordes y tipografía de Croster (Poppins).
 */

/* ------------------------------------------------------ Código de 6 dígitos */

.hw-2fa-scope input[name="key"],
.hw-2fa-scope input[name="verifykey"],
.hw-2fa-scope input[name="twofabackupcode"],
.fpe-2fa .fpe-2fa-code {
    height: 56px;
    padding: 8px 14px;
    border: 1px solid var(--border-color, #d5dce5);
    border-radius: 10px;
    background: var(--bg-body, #fff);
    box-shadow: none;
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.35em;
    text-align: center;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-scope input[name="twofabackupcode"] {
    font-size: 18px;
    letter-spacing: 0.12em;
}

.hw-2fa-scope input[name="key"]::placeholder,
.hw-2fa-scope input[name="verifykey"]::placeholder,
.hw-2fa-scope input[name="twofabackupcode"]::placeholder,
.fpe-2fa .fpe-2fa-code::placeholder {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--gray-muted, #6c757d);
    opacity: 1;
}

.hw-2fa-scope input[name="key"]:focus,
.hw-2fa-scope input[name="verifykey"]:focus,
.hw-2fa-scope input[name="twofabackupcode"]:focus,
.fpe-2fa .fpe-2fa-code:focus {
    border-color: var(--primary-darker, #005ff7);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 95, 247, 0.12);
}

.hw-2fa-scope .btn-primary.btn-lg,
.hw-2fa-scope .hw-2fa-cta,
.fpe-2fa .btn-primary {
    min-height: 48px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
}

/* ------------------------------------------- Modal de activación (WHMCS) */

#modalAjax.twofa-setup .modal-dialog {
    max-width: 560px;
}

#modalAjax.twofa-setup .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(5, 28, 51, 0.25);
}

#modalAjax.twofa-setup .modal-header {
    position: relative;
    display: block;
    padding: 22px 64px 0 24px;
    border: 0;
    background: var(--bg-body, #fff);
}

#modalAjax.twofa-setup .modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-eyebrow {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-darker, #005ff7);
}

#modalAjax.twofa-setup .modal-header .close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    opacity: 1;
    font-size: 22px;
    font-weight: 400;
    line-height: 36px;
    text-shadow: none;
    color: var(--gray-muted, #6c757d);
}

#modalAjax.twofa-setup .modal-header .close:hover,
#modalAjax.twofa-setup .modal-header .close:focus-visible {
    outline: 0;
    background: rgba(5, 28, 51, 0.06);
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-stepper {
    display: flex;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.hw-2fa-stepper li {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-muted, #6c757d);
}

.hw-2fa-stepper li::before {
    content: "";
    height: 4px;
    border-radius: 2px;
    background: rgba(5, 28, 51, 0.08);
}

.hw-2fa-stepper li.is-done::before,
.hw-2fa-stepper li.is-active::before {
    background: var(--primary-darker, #005ff7);
}

.hw-2fa-stepper li.is-active {
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

#modalAjax.twofa-setup .modal-body {
    padding: 18px 24px 24px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-color, #4b5563);
}

#modalAjax.twofa-setup .modal-body p {
    margin: 0 0 12px;
}

#modalAjax.twofa-setup .modal-body > form > h3,
#modalAjax.twofa-setup .hw-2fa-hidden {
    display: none;
}

#modalAjax.twofa-setup .modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    border-top: 1px solid var(--border-color, #e6ebf1);
    background: #f8fafc;
}

#modalAjax.twofa-setup .modal-footer .loader {
    font-size: 13px;
    color: var(--gray-muted, #6c757d);
}

#modalAjax.twofa-setup .modal-footer .btn-default {
    margin-left: auto;
    padding: 6px 0;
    border: 0;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-muted, #6c757d);
}

#modalAjax.twofa-setup .modal-footer .btn-default:hover {
    color: var(--headings-color, #2a2e36);
}

#modalAjax.twofa-setup .modal-footer .btn-default.hw-2fa-done {
    min-height: 44px;
    padding: 0 22px;
    border-radius: 10px;
    background: var(--primary-darker, #005ff7);
    font-weight: 600;
    color: #fff;
}

/* Paso 1: métodos como tarjetas seleccionables */
#modalAjax.twofa-setup .twofa-module {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 22px;
    gap: 14px;
    align-items: center;
    margin: 0 0 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-color, #d5dce5);
    border-radius: 10px;
    background: var(--bg-body, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#modalAjax.twofa-setup .twofa-module:hover {
    border-color: rgba(0, 95, 247, 0.5);
}

#modalAjax.twofa-setup .twofa-module.active {
    border-color: var(--primary-darker, #005ff7);
    background: rgba(0, 95, 247, 0.04);
    box-shadow: 0 0 0 3px rgba(0, 95, 247, 0.1);
}

#modalAjax.twofa-setup .twofa-module > div {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}

#modalAjax.twofa-setup .twofa-module .col-radio {
    position: relative;
    order: 3;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color, #c9d2de);
    border-radius: 50%;
}

#modalAjax.twofa-setup .twofa-module.active .col-radio {
    border-color: var(--primary-darker, #005ff7);
    background: var(--primary-darker, #005ff7);
    box-shadow: inset 0 0 0 4px var(--bg-body, #fff);
}

#modalAjax.twofa-setup .twofa-module .col-radio input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

#modalAjax.twofa-setup .twofa-module .col-logo {
    order: 1;
}

#modalAjax.twofa-setup .twofa-module .col-logo img {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
}

#modalAjax.twofa-setup .twofa-module .col-description {
    order: 2;
    font-size: 13px;
    line-height: 1.45;
    color: var(--gray-muted, #6c757d);
}

#modalAjax.twofa-setup .twofa-module .col-description strong {
    display: inline;
    font-size: 15px;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

#modalAjax.twofa-setup .twofa-module .col-description br {
    display: none;
}

.hw-2fa-desc {
    display: block;
    margin-top: 2px;
}

.hw-2fa-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 95, 247, 0.1);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    vertical-align: 2px;
    color: var(--primary-darker, #005ff7);
}

.hw-2fa-tag.is-easy {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.hw-2fa-cta-row {
    margin: 6px 0 0;
}

/* Paso 2 por aplicación: QR a la izquierda, pasos a la derecha */
.hw-2fa-totp {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 16px;
}

.hw-2fa-qr {
    padding: 10px;
    border: 1px solid var(--border-color, #e6ebf1);
    border-radius: 12px;
    background: #fff;
}

.hw-2fa-qr svg {
    display: block;
    width: 146px;
    height: 146px;
}

.hw-2fa-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: hw2fa;
}

.hw-2fa-steps li {
    position: relative;
    margin: 0 0 12px;
    padding-left: 34px;
    font-size: 13px;
    line-height: 1.5;
}

.hw-2fa-steps li::before {
    counter-increment: hw2fa;
    content: counter(hw2fa);
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 95, 247, 0.1);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-darker, #005ff7);
}

.hw-2fa-steps strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-secret {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 4px 4px 10px;
    border: 1px dashed var(--border-color, #c9d2de);
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-copy {
    padding: 3px 8px;
    border: 0;
    border-radius: 6px;
    background: rgba(0, 95, 247, 0.08);
    font-family: var(--font-family-base, Poppins, Arial, sans-serif);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: normal;
    color: var(--primary-darker, #005ff7);
    cursor: pointer;
}

.hw-2fa-copy:hover,
.hw-2fa-copy:focus-visible {
    outline: 0;
    background: rgba(0, 95, 247, 0.16);
}

.hw-2fa-codebox {
    display: grid;
    gap: 10px;
}

.hw-2fa-alt {
    margin: 14px 0 0;
    font-size: 13px;
    text-align: center;
    color: var(--gray-muted, #6c757d);
}

.hw-2fa-alt a,
.hwp-2fa-meta a {
    font-weight: 600;
    color: var(--primary-darker, #005ff7);
}

/* Paso 2 por correo (módulo hwperuemail) y desafío por correo */
.hwp-2fa-mail {
    text-align: center;
}

.hwp-2fa-mail__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 2px auto 12px;
    border-radius: 50%;
    background: rgba(0, 95, 247, 0.1);
    font-size: 22px;
    color: var(--primary-darker, #005ff7);
}

.hwp-2fa-mail h4 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

.hwp-2fa-mail p {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.5;
}

.hwp-2fa-mail .hwp-2fa-fields {
    display: grid;
    gap: 10px;
    text-align: left;
}

.hwp-2fa-meta {
    margin: 12px 0 0 !important;
    font-size: 13px !important;
    color: var(--gray-muted, #6c757d);
}

.hwp-2fa-meta a {
    font-weight: 600;
}

.hwp-2fa-meta a[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.6;
}

.hwp-2fa-notice {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: left;
}

.hwp-2fa-notice.is-ok {
    background: rgba(22, 163, 74, 0.08);
    color: #166534;
}

.hwp-2fa-notice.is-warn {
    background: rgba(255, 170, 0, 0.12);
    color: #92400e;
}

.hwp-2fa-notice.is-error {
    background: rgba(220, 38, 38, 0.08);
    color: #b42318;
}

/* Paso 3: activada y código de respaldo */
#modalAjax.twofa-setup .modal-body > .alert-success {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
    background: rgba(22, 163, 74, 0.08);
    font-size: 14px;
    font-weight: 500;
    text-align: left !important;
    color: #166534;
}

#modalAjax.twofa-setup .modal-body > .alert-success .fa-check {
    display: flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #16a34a;
    font-size: 13px;
    color: #fff;
}

#modalAjax.twofa-setup .modal-body > h3 {
    margin: 0 0 6px !important;
    font-size: 16px;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

#modalAjax.twofa-setup .backup-code {
    margin: 12px 0;
    padding: 16px;
    border: 1px dashed var(--border-color, #c9d2de);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    color: var(--gray-muted, #6c757d);
}

#modalAjax.twofa-setup .backup-code > span {
    margin: 6px 0 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    font-size: 22px !important;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: none;
    color: var(--headings-color, #2a2e36);
}

#modalAjax.twofa-setup .modal-body > br {
    display: none;
}

.hw-twofa-note {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 95, 247, 0.06);
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

@media (max-width: 575px) {
    #modalAjax.twofa-setup .modal-dialog {
        margin: 0;
        min-height: 100%;
    }

    #modalAjax.twofa-setup .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    .hw-2fa-totp {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        gap: 14px;
    }

    .hw-2fa-steps {
        justify-self: stretch;
    }
}

/* ------------------------------------- Ajustes de seguridad: tarjeta del 2FA */

.hw-2fa-card.alert {
    display: grid !important;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 20px 24px;
    border: 1px solid var(--border-color, #e6ebf1) !important;
    border-radius: 12px !important;
    background: var(--bg-body, #fff);
    box-shadow: 0 6px 24px rgba(5, 28, 51, 0.06);
}

.hw-2fa-card.is-required {
    border-color: rgba(220, 38, 38, 0.35) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.06), 0 6px 24px rgba(5, 28, 51, 0.06);
}

.hw-2fa-card .alert-icon,
.hw-2fa-card .alert-content,
.hw-2fa-card .twofa-actions {
    margin: 0 !important;
}

.hw-2fa-card .alert-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 24px !important;
}

.hw-2fa-card.is-on .alert-icon span {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a !important;
}

.hw-2fa-card.is-required .alert-icon span {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626 !important;
}

.hw-2fa-card.is-off .alert-icon span {
    background: rgba(255, 170, 0, 0.14);
    color: #b45309 !important;
}

.hw-2fa-card .alert-content {
    text-align: left !important;
}

.hw-2fa-card .alert-content .h5 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px !important;
    font-size: 17px;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-chip {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.hw-2fa-card.is-on .hw-2fa-chip {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.hw-2fa-card.is-required .hw-2fa-chip {
    background: rgba(220, 38, 38, 0.1);
    color: #b42318;
}

.hw-2fa-card.is-off .hw-2fa-chip {
    background: rgba(255, 170, 0, 0.14);
    color: #92400e;
}

.hw-2fa-card .alert-content .text-muted {
    font-size: 14px;
    line-height: 1.5;
}

.hw-2fa-how {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--text-color, #4b5563);
}

.hw-2fa-how i {
    margin-right: 6px;
    color: var(--primary-darker, #005ff7);
}

.hw-2fa-card .twofa-actions .btn {
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.hw-2fa-card .twofa-actions .btn-danger {
    border-color: rgba(220, 38, 38, 0.4);
    background: transparent;
    color: #b42318;
}

.hw-2fa-card .twofa-actions .btn-danger:hover {
    background: rgba(220, 38, 38, 0.06);
}

@media (max-width: 767px) {
    .hw-2fa-card.alert {
        grid-template-columns: 48px minmax(0, 1fr);
        padding: 18px;
    }

    .hw-2fa-card .alert-icon span {
        width: 48px;
        height: 48px;
        font-size: 20px !important;
    }

    .hw-2fa-card .twofa-actions {
        grid-column: 1 / -1;
    }

    .hw-2fa-card .twofa-actions .btn {
        width: 100%;
    }
}

/* ------------------------------------------- Desafío al ingresar (/login/challenge) */

.hw-2fa-login .hw-2fa-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 0 0 18px;
    text-align: left;
}

.hw-2fa-head__icon {
    display: flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(0, 95, 247, 0.1);
    font-size: 20px;
    color: var(--primary-darker, #005ff7);
}

.hw-2fa-login .hw-2fa-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    text-transform: none;
    color: var(--headings-color, #2a2e36);
}

.hw-2fa-sub {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--gray-muted, #6c757d);
}

.hw-2fa-login .alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    text-align: left !important;
}

.hw-2fa-login .alert-danger {
    background: rgba(220, 38, 38, 0.08);
    color: #b42318;
}

.hw-2fa-login .alert-success {
    background: rgba(22, 163, 74, 0.08);
    color: #166534;
}

.hw-2fa-login .margin-bottom > div[align="center"] {
    text-align: left;
}

.hw-2fa-login .margin-bottom br {
    display: none;
}

.hw-2fa-login #btnLogin {
    margin-top: 12px;
}

.hw-2fa-backup-link {
    margin: 18px 0 0;
    padding: 12px 14px !important;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
    color: var(--gray-muted, #6c757d);
}

.hw-2fa-backup-link a {
    display: inline-block;
    font-weight: 600;
}

/* Alternativa por correo de FacturaPE (11.67.0) con los colores de Croster */
.fpe-2fa {
    border-top-color: var(--border-color, #e6ebf1) !important;
}

.fpe-2fa .fpe-2fa-toggle {
    padding: 12px 14px;
    border-color: var(--border-color, #d5dce5);
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    color: var(--headings-color, #2a2e36);
}

.fpe-2fa .fpe-2fa-toggle i {
    color: var(--primary-darker, #005ff7);
}

.fpe-2fa .fpe-2fa-panel {
    color: var(--text-color, #4b5563);
}

.fpe-2fa .fpe-2fa-panel strong {
    color: var(--headings-color, #2a2e36);
}

.fpe-2fa .btn-default {
    min-height: 44px;
    border-radius: 10px;
    font-weight: 600;
}

/* --------------------------------------------------- Registro: una contraseña */

.hw-pw-group {
    position: relative;
}

.hw-pw-group .form-control {
    padding-right: 42px;
}

.hw-pw-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    max-height: 46px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--gray-muted, #6c757d);
    cursor: pointer;
}

.hw-pw-toggle:focus {
    outline: 0;
}

.hw-pw-toggle:focus-visible {
    outline: 2px solid var(--primary-darker, #005ff7);
    outline-offset: -2px;
}

.hw-pw-confirm,
.hw-register .generate-password {
    display: none !important;
}

.hw-pw-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin: -6px 0 10px;
    font-size: 13px;
    color: var(--gray-muted, #6c757d);
}

.hw-pw-suggest {
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-darker, #005ff7);
    cursor: pointer;
}

.hw-pw-suggest:focus {
    outline: 0;
}

.hw-pw-suggest:hover,
.hw-pw-suggest:focus-visible {
    text-decoration: underline;
}

.hw-pw-saved {
    flex-basis: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0, 95, 247, 0.06);
    color: var(--headings-color, #2a2e36);
}

/* ------------------------------------------- Google: aviso de cuenta sin vincular */

.providerLinkingFeedback .alert {
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}

.providerLinkingFeedback .alert a {
    font-weight: 600;
}

.hw-login-focus {
    border-radius: 10px;
    animation: hw-login-pulse 1.6s ease-out 1;
}

@keyframes hw-login-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 95, 247, 0.35);
    }

    100% {
        box-shadow: 0 0 0 14px rgba(0, 95, 247, 0);
    }
}
