:root {
    --primary: #003EB4;
    --primary-hover: #2C5FC0;
    --light-blue-decor: #C8D5ED;
    --ice-bg: #ECF0F9;
    --offwhite: #F5F7FC;
    --white: #FFFFFF;

    --navy: #082040;
    --gray-text: #808898;
    --border-gray: #D0D8E0;
}

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100vh;
    background-color: var(--offwhite);
    color-scheme: light;
}

body {
    overflow: hidden;
}

/* ============ FONDO ============ */

.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 73% 8%, rgba(200, 213, 237, .5), transparent 40%),
        linear-gradient(125deg, var(--offwhite) 0%, var(--white) 56%, var(--offwhite) 100%);
}

.blob {
    position: absolute;
    border-radius: 50%;
    background: var(--light-blue-decor);
    opacity: .45;
    filter: blur(2px);
    transition: transform 1.2s ease-out, opacity 1.2s ease-out;
}

.blob-1 {
    width: 46vw;
    height: 46vw;
    left: -14vw;
    bottom: -18vw;
    opacity: .55;
}

.blob-2 {
    width: 26vw;
    height: 26vw;
    left: 6vw;
    bottom: 8vw;
    opacity: .35;
}

.blob-3 {
    width: 16vw;
    height: 16vw;
    left: -4vw;
    bottom: 30vw;
    opacity: .3;
}

body:not(.is-ready) .blob-1 {
    transform: scale(.85) translateY(4%);
    opacity: 0;
}

body:not(.is-ready) .blob-2 {
    transform: scale(.85) translateY(4%);
    opacity: 0;
}

body:not(.is-ready) .blob-3 {
    transform: scale(.85) translateY(4%);
    opacity: 0;
}

/* ============ LAYOUT ============ */

.split {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
}

/* Linea divisoria curva con gradiente de color, entre el panel de marca
   y la tarjeta. SVG en vez de un pseudo-elemento para poder controlar
   la curva y el degradado con precision (el propio <svg> recorta su
   contenido al viewBox, no hace falta overflow:hidden en .split). */
.divider-svg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.divider-svg .stop-edge {
    stop-color: var(--light-blue-decor);
    stop-opacity: 0;
}

.divider-svg .stop-mid {
    stop-color: var(--primary);
    stop-opacity: .55;
}

.divider-svg .stop-hover {
    stop-color: var(--primary-hover);
    stop-opacity: .5;
}

.brand-panel,
.auth-panel {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ PANEL DE MARCA (izquierda) ============ */

.brand-content {
    text-align: center;
    max-width: 26rem;
    padding: 2rem;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .7s ease-out, transform .7s ease-out;
    transition-delay: .15s;
}

body.is-ready .brand-content {
    opacity: 1;
    transform: translateY(0);
}

.brand-logo {
    display: flex;
    justify-content: center;
    margin-bottom: .5rem;
}

.brand-logo img {
    width: 12rem;
    height: 12rem;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(0, 62, 180, 0.18));
    animation: logo-float 5s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes logo-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.brand-title {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -.02em;
    margin-bottom: .6rem;
}

.brand-title span {
    font-weight: 300;
    color: var(--navy);
}

.brand-subtitle {
    font-size: 1.05rem;
    color: var(--gray-text);
    font-weight: 400;
}

/* ============ TARJETA DE LOGIN (derecha) ============ */

.auth-card {
    width: 100%;
    max-width: 25rem;
    margin: 2rem;
    padding: 2.75rem 2.75rem 2.25rem;
    background-color: rgba(255, 255, 255, .92);
    border: 1px solid rgba(18, 50, 104, .09);
    border-radius: 1.75rem;
    box-shadow: 0 26px 70px rgba(36, 61, 102, .13), 0 3px 12px rgba(36, 61, 102, .05);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(20px) scale(.98);
    transition: opacity .6s ease-out, transform .6s cubic-bezier(.22, 1, .36, 1);
    transition-delay: .35s;
}

body.is-ready .auth-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
}

.auth-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: .3rem;
}

.auth-subtitle {
    text-align: center;
    font-size: .9rem;
    color: var(--gray-text);
    margin-bottom: 1.75rem;
}

/* ============ TARJETA ANCHA (registro, wizard de varios pasos) ============ */

.auth-card--wide {
    max-width: 34rem;
}

.form-alert {
    background: #fdecec;
    border: 1px solid rgba(229, 72, 77, .3);
    color: #b3232a;
    border-radius: .7rem;
    padding: .9rem 1.1rem;
    font-size: .85rem;
    margin-bottom: 1.25rem;
}

.form-alert ul {
    margin: .4rem 0 0;
    padding-left: 1.2rem;
}

.form-alert.shake {
    animation: form-alert-shake .4s ease-in-out;
}

.form-alert--success {
    background: #eaf7ec;
    border: 1px solid rgba(40, 167, 69, .3);
    color: #1e7e34;
}

@keyframes form-alert-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.form-success {
    background: #e8f7ee;
    border: 1px solid rgba(23, 107, 67, .25);
    color: #176b43;
    border-radius: .7rem;
    padding: .9rem 1.1rem;
    font-size: .85rem;
    margin-bottom: 1.25rem;
}

/* ============ CAMPOS DE FORMULARIO (registro) ============ */

.field-group {
    margin-bottom: 1.1rem;
}

.field-group label {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: .4rem;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.field-grid .field-group--full {
    grid-column: 1 / -1;
}

.field-group>.form-control,
.field-group>.form-control-file {
    width: 100%;
    padding: .75rem 1rem;
    font-size: .95rem;
    color: var(--navy);
    background-color: var(--white);
    border-radius: .65rem;
    border: 1.5px solid var(--border-gray);
    outline: none;
    transition: border-color .2s ease-in-out, box-shadow .2s ease-in-out;
}

.field-group>.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 62, 180, .1);
}

.field-group>.form-control.is-invalid {
    border-color: #e5484d;
}

.select-wrap {
    position: relative;
}

/* El <select> nativo queda invisible pero sigue "presente" (para submit y
   validacion), tapado exactamente por el trigger custom de arriba. */
.select-wrap select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.custom-select-trigger {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .75rem 1rem;
    font-size: .95rem;
    font-family: inherit;
    text-align: left;
    color: var(--navy);
    background-color: var(--white);
    border-radius: .65rem;
    border: 1.5px solid var(--border-gray);
    cursor: pointer;
    transition: border-color .2s ease-in-out, box-shadow .2s ease-in-out;
}

.custom-select-trigger:hover {
    border-color: var(--light-blue-decor);
}

.select-wrap.is-open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 62, 180, .1);
}

.custom-select-value.is-placeholder {
    color: var(--gray-text);
}

.custom-select-chevron {
    flex-shrink: 0;
    margin-left: .5rem;
    color: var(--gray-text);
    transition: transform .2s ease-in-out;
}

.select-wrap.is-open .custom-select-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.custom-select-list {
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 14rem;
    overflow-y: auto;
    margin: 0;
    padding: .4rem;
    list-style: none;
    background: var(--white);
    border: 1px solid rgba(18, 50, 104, .09);
    border-radius: .75rem;
    box-shadow: 0 16px 40px rgba(8, 32, 64, .16);
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    transition: opacity .15s ease-out, transform .15s ease-out, visibility .15s;
}

.select-wrap.is-open .custom-select-list {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.custom-select-list li {
    padding: .6rem .75rem;
    font-size: .9rem;
    color: var(--navy);
    border-radius: .5rem;
    cursor: pointer;
}

.custom-select-list li:hover {
    background: var(--ice-bg);
}

.custom-select-list li.is-selected {
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
}

.custom-select-list li.is-placeholder {
    display: none;
}

.form-control-file {
    font-size: .88rem;
    color: var(--gray-text);
}

.form-control-file::file-selector-button {
    margin-right: .9rem;
    padding: .5rem 1rem;
    border-radius: .5rem;
    border: none;
    background-color: var(--ice-bg);
    color: var(--primary);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: background-color .2s ease-in-out;
}

.form-control-file::file-selector-button:hover {
    background-color: var(--light-blue-decor);
}

.attached-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin: .4rem 0 0;
    background: var(--ice-bg, #f5f7fc);
    border: 1px solid var(--light-blue-decor, #d0d8e0);
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-size: .85rem;
}

.attached-file__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-text);
}

.attached-file__remove {
    background: none;
    border: none;
    color: var(--gray-text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
    flex-shrink: 0;
}

.attached-file__remove:hover {
    color: #b3232a;
}

/* ============ WIZARD DE PASOS (registro) ============ */

.wizard-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 2rem;
}

.wizard-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.wizard-progress-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    border: 1.5px solid var(--border-gray);
    color: var(--gray-text);
    background: var(--white);
    font-size: .85rem;
    font-weight: 600;
    transition: border-color .25s ease-in-out, background-color .25s ease-in-out, color .25s ease-in-out;
}

.wizard-progress-label {
    font-size: .68rem;
    color: var(--gray-text);
    font-weight: 500;
    white-space: nowrap;
}

.wizard-progress-line {
    flex: 1;
    height: 1.5px;
    background: var(--border-gray);
    margin: .95rem .5rem 0;
    min-width: 1rem;
}

.wizard-progress-step.is-active .wizard-progress-dot {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

.wizard-progress-step.is-active .wizard-progress-label {
    color: var(--navy);
}

.wizard-progress-step.is-done .wizard-progress-dot {
    border-color: var(--primary);
    background: var(--ice-bg);
    color: var(--primary);
}

.wizard-step {
    display: none;
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
    animation: wizard-step-in .35s ease-out;
}

.wizard-step.is-active {
    display: block;
}

@keyframes wizard-step-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-final-note {
    font-size: .82rem;
    color: var(--gray-text);
    margin-top: .5rem;
}

.wizard-nav {
    display: flex;
    gap: .75rem;
    margin-top: .5rem;
}

.wizard-nav .btn-outline {
    flex: 0 0 auto;
    width: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.wizard-nav .btn-solid {
    flex: 1;
    margin-bottom: 0;
}

.wizard-login-link {
    text-align: center;
    font-size: .85rem;
    color: var(--gray-text);
    margin-top: 1.5rem;
}

.wizard-login-link a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.wizard-login-link a:hover {
    text-decoration: underline;
}

/* ============ INPUTS ============ */

.input-group {
    position: relative;
    width: 100%;
    margin: 0 0 1rem;
}

.input-group .icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    display: flex;
    color: var(--gray-text);
    transition: color .2s ease-in-out;
    pointer-events: none;
}

.input-group .icon svg {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
}

.input-group .icon.toggle-password {
    left: auto;
    right: 1rem;
    pointer-events: auto;
    cursor: pointer;
}

.input-group .icon.toggle-password::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 1.4px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(-45deg);
    transition: width .18s ease-in-out;
}

.input-group .icon.toggle-password.is-active::after {
    width: 1.15rem;
}

.input-group .icon.toggle-password:hover {
    color: var(--primary);
}

.input-group input {
    width: 100%;
    padding: .85rem 2.75rem;
    font-size: .95rem;
    color: var(--navy);
    background-color: var(--white);
    border-radius: .7rem;
    border: 1.5px solid var(--border-gray);
    outline: none;
    transition: border-color .2s ease-in-out, box-shadow .2s ease-in-out;
}

.input-group input::placeholder {
    color: var(--gray-text);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 62, 180, .1);
}

.input-group:focus-within .icon:not(.toggle-password) {
    color: var(--primary);
}

.input-group input.is-invalid {
    border-color: #e5484d;
}

.invalid-feedback {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
    color: #e5484d;
}

.field-hint {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
    color: var(--gray-text);
}

/* Ocultar iconos nativos del navegador (autofill/credenciales de Edge/Chrome)
   que se superponen con nuestro icono de usuario */
.input-group input::-webkit-contacts-auto-fill-button,
.input-group input::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
    position: absolute;
    right: 0;
}

.input-group input::-ms-reveal,
.input-group input::-ms-clear {
    display: none;
}

/* ============ LINKS Y BOTONES ============ */

.form-links {
    text-align: right;
    margin: 0 0 1.5rem;
}

.form-links a {
    font-size: .85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color .2s ease-in-out;
}

.form-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.cf-turnstile-wrap {
    margin: 0 0 1.25rem;
    display: flex;
    justify-content: center;
}

.cf-turnstile-wrap .invalid-feedback {
    text-align: center;
    margin-top: .5rem;
}

.btn-solid,
.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    position: relative;
    width: 100%;
    text-align: center;
    cursor: pointer;
    padding: .85rem 0;
    border-radius: .7rem;
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
    outline: none;
    transition: background-color .2s ease-in-out, border-color .2s ease-in-out, color .2s ease-in-out, transform .12s ease-in-out, box-shadow .2s ease-in-out;
}

.btn-solid {
    border: 1px solid #0037a8;
    background-image: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    color: var(--white);
    box-shadow: 0 12px 25px -6px rgba(0, 62, 180, .4);
    margin-bottom: .9rem;
}

.btn-solid .btn-arrow {
    display: flex;
    transition: transform .2s ease-in-out;
}

.btn-solid:hover .btn-arrow {
    transform: translateX(3px);
}

.btn-solid:hover {
    box-shadow: 0 14px 28px -6px rgba(0, 62, 180, .5);
}

.btn-outline {
    background-color: var(--white);
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--ice-bg);
}

.btn-solid:active,
.btn-outline:active {
    transform: scale(.98);
}

.btn-solid.is-loading .btn-text,
.btn-solid.is-loading .btn-arrow {
    visibility: hidden;
}

.btn-solid.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.1rem;
    height: 1.1rem;
    margin: -.55rem 0 0 -.55rem;
    border: .15rem solid rgba(255, 255, 255, .4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: btn-spin .6s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ RESPONSIVE ============ */

@media only screen and (max-width: 900px) {
    .split {
        flex-direction: column;
    }

    .divider-svg {
        display: none;
    }

    .brand-panel,
    .auth-panel {
        width: 100%;
    }

    .brand-panel {
        padding: 3rem 1rem 1rem;
        min-height: auto;
    }

    .brand-content {
        max-width: 100%;
    }

    .brand-logo img {
        width: 6rem;
        height: 6rem;
    }

    .brand-title {
        font-size: 2rem;
    }

    .auth-panel {
        padding-bottom: 3rem;
    }

    .auth-card {
        margin: 1.5rem;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    body,
    html {
        overflow-y: auto;
        height: auto;
    }
}

@media only screen and (max-width: 425px) {
    .auth-card {
        margin: 1rem;
        padding: 2rem 1.5rem 1.5rem;
    }

    .brand-title {
        font-size: 1.6rem;
    }

    .brand-subtitle {
        font-size: .9rem;
    }
}
