/* =========================================================
   VARIABLES
========================================================= */

:root {
    --escenario-color: #dc3545;
    --background: #f3f5f9;
    --card-background: #ffffff;
    --text-primary: #101828;
    --text-secondary: #65758b;
    --border-color: #dde2ea;
    --input-background: #f9fafc;
    --shadow-card: 0 18px 45px rgba(17, 31, 54, 0.10);
}

/* =========================================================
   RESET
========================================================= */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100%;
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(
            circle at 50% 10%,
            rgba(255, 255, 255, 0.95) 0,
            rgba(244, 246, 250, 0.72) 42%,
            rgba(239, 242, 247, 1) 100%
        );
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    width: 100%;
    min-height: 92px;
    padding:
        max(18px, env(safe-area-inset-top))
        20px
        18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-bottom: 1px solid #e7eaf0;
    box-shadow: 0 3px 12px rgba(16, 24, 40, 0.05);
}

.topbar img {
    display: block;
    width: auto;
    max-width: min(220px, 70vw);
    max-height: 58px;
    object-fit: contain;
}

/* =========================================================
   PÁGINA PRINCIPAL
========================================================= */

.page-container {
    width: 100%;
    min-height: calc(100vh - 92px);

    padding:
        8px
        22px
        30px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.portal-card {
    width: 100%;
    max-width: 540px;
    padding: 48px 38px 34px;
    background: var(--card-background);
    border: 1px solid rgba(221, 226, 234, 0.78);
    border-radius: 26px;
    box-shadow: var(--shadow-card);
}

/* =========================================================
   ETIQUETA DEPARTAMENTO
========================================================= */

.department-badge {
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    margin: 0 auto 24px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--escenario-color);
    background: color-mix(
        in srgb,
        var(--escenario-color) 11%,
        white
    );
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-align: center;
}

/* =========================================================
   ENCABEZADO
========================================================= */

.portal-heading {
    text-align: center;
}

.portal-heading h1 {
    margin: 0;
    color: #090e17;
    font-size: clamp(34px, 7vw, 46px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.portal-heading p {
    max-width: 420px;
    margin: 18px auto 0;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.55;
}

.card-divider {
    width: 100%;
    height: 1px;
    margin: 28px 0;
    background: #e7eaf0;
}

/* =========================================================
   FORMULARIO
========================================================= */

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 11px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 750;
}

.form-group input {
    width: 100%;
    height: 64px;
    margin: 0;
    padding: 0 20px;
    color: #151b26;
    background: var(--input-background);
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    outline: none;
    font-size: 18px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.form-group input::placeholder {
    color: #a5afbf;
}

.form-group input:focus {
    background: #ffffff;
    border-color: var(--escenario-color);
    box-shadow:
        0 0 0 4px color-mix(
            in srgb,
            var(--escenario-color) 14%,
            transparent
        );
}

.form-group input.input-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.12);
}

.input-help {
    display: block;
    margin: 8px 4px 0;
    color: #8a97a9;
    font-size: 12px;
}

/* =========================================================
   BOTÓN DINÁMICO
========================================================= */

.primary-button {
    position: relative;
    width: 100%;
    min-height: 62px;
    margin-top: 28px;
    padding: 15px 24px;
    overflow: hidden;
    color: #ffffff;
    background: var(--escenario-color);
    border: none;
    border-radius: 15px;
    box-shadow:
        0 10px 22px color-mix(
            in srgb,
            var(--escenario-color) 28%,
            transparent
        );
    cursor: pointer;
    font-size: 18px;
    font-weight: 750;
    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.primary-button:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(1px) scale(0.995);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.82;
}

.button-loader {
    display: none;
    width: 22px;
    height: 22px;
    margin: auto;
    border: 3px solid rgba(255, 255, 255, 0.42);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: buttonSpin 0.75s linear infinite;
}

.primary-button.is-loading .button-text {
    display: none;
}

.primary-button.is-loading .button-loader {
    display: block;
}

@keyframes buttonSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   SEGURIDAD
========================================================= */

.security-message {
    margin-top: 30px;
    text-align: center;
}

.security-line {
    display: flex;
    align-items: center;
    gap: 14px;
}

.security-line > span {
    flex: 1;
    height: 1px;
    background: #d9dee7;
}

.lock-circle {
    min-width: 34px;
    font-size: 20px;
    line-height: 1;
}

.security-message p {
    margin: 14px 0 0;
    color: var(--text-secondary);
    font-size: 15px;
}

/* =========================================================
   ERROR
========================================================= */

.form-error {
    margin: 0 0 20px;
    padding: 13px 15px;
    color: #a61b2b;
    background: #fff1f3;
    border: 1px solid #ffc9d0;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
}

/* =========================================================
   FOOTER
========================================================= */

.client-footer {
    width: 100%;
    max-width: 780px;
    margin-top: 38px;
    padding: 0 10px calc(18px + env(safe-area-inset-bottom));
    color: #697a91;
    text-align: center;
}

.client-footer p {
    margin: 7px 0;
    font-size: 14px;
    line-height: 1.65;
}

.client-footer strong {
    color: var(--escenario-color);
    font-weight: 750;
}

.footer-separator {
    margin: 0 5px;
}

/* =========================================================
   COMPATIBILIDAD CON TUS OTROS ESCENARIOS
========================================================= */

.wrapper {
    width: 100%;
    min-height: calc(100vh - 92px);

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding:
        22px
        20px
        32px;
}

.card {
    width: 100%;
    max-width: 460px;
    padding: 34px 28px;
    background: #ffffff;
    border: 1px solid rgba(221, 226, 234, 0.78);
    border-radius: 22px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.card h1,
.card h2 {
    margin: 10px 0 16px;
    color: #101828;
    font-size: 28px;
}

.card p {
    margin-bottom: 25px;
    color: #5f6f84;
    font-size: 15px;
    line-height: 1.55;
}

.card input {
    width: 100%;
    min-height: 54px;
    margin-bottom: 16px;
    padding: 14px 16px;
    color: #182230;
    background: #f9fafc;
    border: 1.5px solid #dce2ea;
    border-radius: 13px;
    outline: none;
    font-size: 16px;
    transition: 0.2s ease;
}

.card input:focus {
    background: #ffffff;
    border-color: var(--escenario-color);
    box-shadow:
        0 0 0 4px color-mix(
            in srgb,
            var(--escenario-color) 14%,
            transparent
        );
}

.card button {
    width: 100%;
    min-height: 54px;
    padding: 14px 18px;
    color: #ffffff;
    background: var(--escenario-color);
    border: none;
    border-radius: 13px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: 0.2s ease;
}

.card button:hover {
    filter: brightness(0.92);
}

.row {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.row input {
    margin-bottom: 0;
}

.info-box {
    margin-bottom: 25px;
    text-align: left;
}

.info-box label {
    display: block;
    margin-top: 15px;
    color: #7b8798;
    font-size: 12px;
    font-weight: 650;
}

.field {
    margin-top: 6px;
    padding: 14px;
    color: #202938;
    background: #f7f8fb;
    border: 1px solid #e0e4eb;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 650;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 22px auto;
    border: 5px solid #e3e7ee;
    border-top-color: var(--escenario-color);
    border-radius: 50%;
    animation: girar 0.85s linear infinite;
}

@keyframes girar {
    to {
        transform: rotate(360deg);
    }
}

.error {
    margin-bottom: 15px;
    color: #dc3545;
    font-size: 13px;
}

.opciones {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.opcion {
    width: 145px;
    padding: 14px;
    color: #233044;
    background: #fafbfd;
    border: 1.5px solid #dce2ea;
    border-radius: 13px;
    cursor: pointer;
    text-align: center;
    transition: 0.22s ease;
}

.opcion:hover {
    border-color: var(--escenario-color);
    transform: translateY(-2px);
}

.opcion.activa {
    color: #ffffff;
    background: var(--escenario-color);
    border-color: var(--escenario-color);
}

.opcion.activa p,
.opcion.activa h3 {
    color: #ffffff;
}

.procesando-box {
    padding: 20px;
    text-align: center;
}

#form1,
#form2,
#progressBox {
    display: none;
}

#progressBox {
    margin-top: 20px;
}

#progressBar {
    width: 0;
    height: 12px;
    background: var(--escenario-color);
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 600px) {

    .wrapper {
        min-height: calc(100vh - 82px);

        padding:
            16px
            14px
            28px;
    }

    .topbar {
        min-height: 82px;
        padding-bottom: 15px;
    }

    .topbar img {
        max-width: 190px;
        max-height: 50px;
    }

    .page-container {
    min-height: calc(100vh - 82px);
    padding:
        20px
        26px
        28px;
}

    .portal-card {
        padding: 36px 26px 29px;
        border-radius: 24px;
    }

    .department-badge {
        padding: 9px 18px;
        font-size: 14px;
    }

    .portal-heading h1 {
        font-size: 36px;
    }

    .portal-heading p {
        font-size: 16px;
    }

    .form-group input {
        height: 59px;
        font-size: 17px;
    }

    .primary-button {
        min-height: 58px;
    }

    .client-footer {
        margin-top: 31px;
    }

    .client-footer p {
        font-size: 13px;
    }

}

@media (max-width: 380px) {

    .page-container {
        padding:
            12px
            12px
            24px;
    }

    .portal-card {
        padding: 28px 18px 24px;
    }

    .department-badge {
        font-size: 12px;
    }

    .portal-heading h1 {
        font-size: 30px;
    }

    .opciones {
        flex-direction: column;
    }

    .opcion {
        width: 100%;
    }
}

.form-spacing {
    margin-top: 20px;
}

.form-group textarea {
    width: 100%;
    min-height: 125px;
    padding: 16px 18px;
    color: #182230;
    background: #f9fafc;
    border: 1.5px solid #dce2ea;
    border-radius: 16px;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.form-group textarea:focus {
    background: #ffffff;
    border-color: var(--escenario-color);
    box-shadow:
        0 0 0 4px color-mix(
            in srgb,
            var(--escenario-color) 14%,
            transparent
        );
}

.form-group textarea::placeholder {
    color: #a5afbf;
}

.form-spacing {
    margin-top: 22px;
}

/*----------------------------------------------------------
    INPUTS CON ICONO
----------------------------------------------------------*/

.input-icon{
    display:flex;
    align-items:center;

    width:100%;

    background:#f8fafc;

    border:1px solid #dfe5ec;
    border-radius:10px;

    transition:
        border-color .2s,
        box-shadow .2s,
        background .2s;
}

.input-icon:hover{
    background:#ffffff;
}

.input-icon:focus-within{

    background:#ffffff;

    border-color:var(--escenario-color);

    box-shadow:
        0 0 0 4px
        color-mix(
            in srgb,
            var(--escenario-color) 12%,
            transparent
        );
}

.input-icon i{

    width:46px;

    text-align:center;

    color:#6b7280;

    font-size:15px;

    border-right:1px solid #dfe5ec;

    flex-shrink:0;

    transition:.2s;
}

.input-icon:focus-within i{

    color:var(--escenario-color);

}

.input-icon .compact-input{

    border:none !important;

    background:transparent !important;

    box-shadow:none !important;

    padding:11px 14px !important;

    width:100%;

    min-width:0;
}

.primary-button {
    background-color: var(--escenario-color);
    border-color: var(--escenario-color);
}

.primary-button:hover {
    background-color: var(--escenario-color);
    border-color: var(--escenario-color);
    filter: brightness(0.92);
}

.primary-button:focus {
    outline-color: var(--escenario-color);
}

.opcion.activa {
    border-color: var(--escenario-color);
    color: var(--escenario-color);
}

.opcion.activa h3 {
    color: var(--escenario-color);
}

#progressBar {
    background-color: var(--escenario-color);
}


#progressBox{

display:none;
margin-top:25px;

}

.progress-track{

width:100%;
height:8px;
background:#ececec;
border-radius:999px;
overflow:hidden;

}

#progressBar{

height:100%;
width:0;
background:var(--escenario-color);
transition:.3s;

}

input[type="file"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.primary-button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* =========================================================
   ACTIVACIÓN - DISTRIBUCIÓN DE OPCIONES Y FORMULARIOS
   ========================================================= */


/* Contenedor general */

.opciones {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}


/* =========================================================
   LAS DOS OPCIONES SIEMPRE EN HORIZONTAL
   ========================================================= */

.selector-opciones {
    display: flex !important;
    flex-direction: row !important;

    width: 100% !important;
    max-width: 100% !important;

    gap: 20px;

    align-items: stretch;
    justify-content: center;

    box-sizing: border-box;
}


/* Cada tarjeta ocupa la mitad */

.selector-opciones .opcion {
    flex: 1 1 0 !important;

    width: auto !important;
    max-width: none !important;

    min-width: 0 !important;

    box-sizing: border-box;
}


/* =========================================================
   FORMULARIOS SIEMPRE DEBAJO DE LAS OPCIONES
   ========================================================= */

.formulario-activacion {
    display: block;

    width: 100% !important;
    max-width: 100% !important;

    min-width: 0 !important;

    margin-top: 25px;

    box-sizing: border-box;
}


/* =========================================================
   INPUTS DE ARCHIVOS
   ========================================================= */

.formulario-activacion input[type="file"] {
    display: block;

    width: 100% !important;
    max-width: 100% !important;

    min-width: 0 !important;

    box-sizing: border-box;
}


/* =========================================================
   BOTÓN ENVIAR
   ========================================================= */

.formulario-activacion .primary-button {
    display: block;

    width: 100% !important;
    max-width: 100% !important;

    min-width: 0 !important;

    box-sizing: border-box;
}


/* =========================================================
   EVITAR DESBORDAMIENTO
   ========================================================= */

.opciones,
.selector-opciones,
.formulario-activacion,
.formulario-activacion input,
.formulario-activacion button {
    min-width: 0;
    box-sizing: border-box;
}


html,
body {
    max-width: 100%;
    overflow-x: hidden;
}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 600px) {

    .selector-opciones {
        display: flex !important;
        flex-direction: row !important;

        gap: 10px;

        width: 100% !important;
    }


    .selector-opciones .opcion {
        flex: 1 1 0 !important;

        width: 50% !important;
        min-width: 0 !important;
    }


    .formulario-activacion {
        width: 100% !important;
        margin-top: 20px;
    }


    .formulario-activacion input[type="file"] {
        width: 100% !important;
        max-width: 100% !important;

        font-size: 13px;
    }


    .formulario-activacion .primary-button {
        width: 100% !important;
        max-width: 100% !important;
    }

}


/* =========================================================
   PANTALLA DE VALIDACIÓN DESPUÉS DE ENVIAR
   ========================================================= */

#procesando {
    display: none;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    float: none !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
}

#procesando .procesando-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

.mensaje-procesando {
    font-weight: 600;
    color: #6b7280;
    margin-top: 15px;
    text-align: center;
}
