/* Pantallas de acceso: inicio de sesión, recuperación y restablecimiento de contraseña.
   Salió tal cual del <style> de Login.cshtml para que las demás pantallas de cuenta
   compartan el mismo diseño en lugar de copiarlo. Todas usan Layout = null, así que
   este archivo va enlazado después de _branding.css en cada una. */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--if-font-main);
    min-height: 100vh;
    display: flex;
    background:
        radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.3) 0%, transparent 30%),
        linear-gradient(135deg, #72a1a7 0%, #b9d1ce 48%, #f1f7f6 100%);
}

.login-wrapper {
    display: grid;
    grid-template-columns: 62% 38%;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    background-image:
        url('/Images/Login/background.svg'),
        radial-gradient(ellipse at 78% 8%, rgba(255, 255, 255, 0.34) 0%, transparent 50%),
        radial-gradient(ellipse at 8% 92%, rgba(79, 124, 130, 0.18) 0%, transparent 58%),
        linear-gradient(150deg, #72a1a7 0%, #b9d1ce 52%, #f1f7f6 100%);
    background-size: cover, auto, auto, auto;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: clamp(28px, 4vw, 56px);
    overflow: hidden;
}

.left-logo img {
    width: clamp(150px, 15vw, 230px);
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(11, 46, 50, 0.12));
}

.left-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: clamp(44px, 7vh, 82px) 0 0;
    position: relative;
    z-index: 1;
}

.slogan-text {
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.18;
    color: #0b2e32;
    font-weight: 400;
    margin-bottom: 28px;
    max-width: 560px;
}

.slogan-bold {
    font-weight: 900;
}

.cursor {
    display: inline-block;
    width: 3px;
    height: 0.85em;
    background-color: #0b2e32;
    vertical-align: text-bottom;
    animation: blink 0.75s step-end infinite;
}

@keyframes blink {

    from,
    to {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

.badge-erp {
    display: inline-block;
    background-color: rgba(11, 46, 50, 0.1);
    border: 1px solid rgba(11, 46, 50, 0.12);
    color: #0b2e32;
    font-weight: 700;
    font-size: clamp(0.75rem, 1.1vw, 0.9rem);
    padding: 8px 20px;
    border-radius: 50px;
    letter-spacing: 0.04em;
    width: fit-content;
}

.char-img {
    /* Las 5 ilustraciones de Images/Login/Portada_*.svg no comparten proporción
       (alto/ancho entre 1.09 y 1.42). Fijar solo el ancho hacía que unas se
       vieran más altas que otras al azar.

       La caja toma la proporción de la más ancha del login (Portada_Laptop-1, 309x336;
   Portada_Tecnico, 430x486, es más angosta y cabe sin ajustes).
       Así, con object-fit: contain, las otras cuatro quedan acotadas por la
       altura y las cinco se dibujan exactamente al mismo alto; solo cambia el
       ancho. Si se agrega una ilustración más ancha que esta, hay que actualizar
       el aspect-ratio con la suya, o esa volverá a verse más baja. */
    position: absolute;
    bottom: 56px;
    right: clamp(16px, 2.5vw, 32px);
    width: clamp(180px, 26vw, 360px);
    aspect-ratio: 309.29 / 336.03;
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
}

.left-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.left-footer-copy {
    font-size: 0.82rem;
    color: #0b2e32;
    opacity: 0.7;
    font-weight: 500;
}

.left-footer-logo {
    height: 26px;
    width: auto;
}

.login-right {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 251, 0.98) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(28px, 4vw, 54px) clamp(28px, 4.5vw, 56px);
    min-height: 100vh;
}

.mobile-title-logo {
    display: none;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.title-row {
    display: block;
}

.form-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 400px;
    width: 100%;
    padding: 18px 0;
}

.welcome-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.form-title {
    font-size: clamp(1.7rem, 2.8vw, 2.3rem);
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.1;
}

.right-footer {
    display: flex;
    justify-content: flex-end;
    max-width: 400px;
    width: 100%;
    padding-top: 18px;
}

.right-footer-logo {
    height: 24px;
    width: auto;
    opacity: 0.78;
}

.form-subtitle {
    font-size: 0.93rem;
    color: #6b7280;
    margin-bottom: 28px;
    line-height: 1.5;
}

.steps-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 26px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.25s, color 0.25s;
}

.step-item.active .step-num {
    background-color: #0b2e32;
    color: #ffffff;
}

.step-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: #9ca3af;
    transition: color 0.25s;
}

.step-item.active .step-label {
    color: #111827;
}

.step-line {
    flex: 1;
    height: 1.5px;
    background-color: #e5e7eb;
    margin: 0 14px;
}

.field-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.login-field {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    color: #111827;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #ffffff;
    font-family: var(--if-font-main);
}

.login-field:focus {
    border-color: #72a1a7;
    box-shadow: 0 0 0 3px rgba(114, 161, 167, 0.18);
}

.login-field::placeholder {
    color: #9ca3af;
}

.password-wrap {
    position: relative;
}

.password-wrap .login-field {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #374151;
}

.field-error {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--if-danger);
    margin-top: 5px;
    min-height: 18px;
}

.email-readonly-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background-color: #f9fafb;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    margin-bottom: 18px;
}

.email-readonly-text {
    font-size: 0.93rem;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-change-email {
    background: none;
    border: none;
    color: #4f7c82;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    white-space: nowrap;
    font-family: var(--if-font-main);
}

.btn-change-email:hover {
    text-decoration: underline;
}

.login-secondary-action {
    width: 100%;
    margin-top: 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #0b2e32;
    font-family: var(--if-font-main);
    font-size: .9rem;
    font-weight: 800;
    padding: 12px 16px;
    transition: border-color .2s, color .2s, background-color .2s;
}

.login-secondary-action:hover {
    border-color: #72a1a7;
    background: #f1f7f6;
    color: #0b2e32;
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 14px 0;
}

.remember-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0b2e32;
}

.remember-row label {
    font-size: 0.88rem;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

.forgot-password-link {
    color: var(--asg-shadow);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.forgot-password-link:hover {
    color: var(--if-primary);
    text-decoration: underline;
}

.btn-asg.login-action {
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    border: 3px solid var(--asg-shadow);
    border-radius: 5px;
    box-shadow: 8px 8px 0 var(--asg-shadow);
    font-size: 1rem;
    font-weight: 900;
    margin-top: 6px;
    letter-spacing: 0;
}

.btn-asg.login-action:hover {
    box-shadow: 5px 5px 0 var(--asg-shadow);
    transform: translate(3px, 3px);
}

.btn-asg.login-action:active {
    box-shadow: 0 0 0 var(--asg-shadow);
    transform: translate(8px, 8px);
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at 12% 16%, rgba(95, 183, 175, 0.16) 0%, transparent 30%),
        linear-gradient(135deg, #0d1416 0%, #111a1d 48%, #162225 100%);
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .login-left {
    background-image:
        url('/Images/Login/background.svg'),
        radial-gradient(ellipse at 78% 8%, rgba(95, 183, 175, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 8% 92%, rgba(13, 20, 22, 0.88) 0%, transparent 58%),
        linear-gradient(150deg, #0d1416 0%, #12373a 52%, #1e5658 100%);
    border-right: 1px solid var(--asg-dark-border, #27383c);
}

:root[data-theme="dark"] .left-logo img {
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.34));
}

:root[data-theme="dark"] .slogan-text,
:root[data-theme="dark"] .left-footer-copy {
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .left-footer-copy {
    opacity: .72;
}

:root[data-theme="dark"] .cursor {
    background: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .badge-erp {
    background: rgba(220, 236, 235, .12);
    border: 1px solid rgba(220, 236, 235, .18);
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .char-img {
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .34));
}

:root[data-theme="dark"] .login-right {
    background: linear-gradient(180deg, #111a1d 0%, #0d1416 100%);
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .mobile-title-logo {
    filter: brightness(0) invert(1) drop-shadow(0 7px 12px rgba(0, 0, 0, 0.26));
    opacity: .92;
}

:root[data-theme="dark"] .welcome-label,
:root[data-theme="dark"] .step-label,
:root[data-theme="dark"] .form-subtitle {
    color: var(--asg-dark-muted, #9aa9ad);
}

:root[data-theme="dark"] .form-title,
:root[data-theme="dark"] .field-label,
:root[data-theme="dark"] .step-item.active .step-label,
:root[data-theme="dark"] .remember-row label {
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .step-num {
    background: var(--asg-dark-surface-3, #1c2a2e);
    border: 1px solid var(--asg-dark-border, #27383c);
    color: var(--asg-dark-muted, #9aa9ad);
}

:root[data-theme="dark"] .step-item.active .step-num {
    background: #5fb7af;
    border-color: #5fb7af;
    color: #061113;
}

:root[data-theme="dark"] .step-line {
    background: var(--asg-dark-border, #27383c);
}

:root[data-theme="dark"] .login-field,
:root[data-theme="dark"] .email-readonly-row {
    background: var(--asg-dark-surface-2, #162225);
    border-color: var(--asg-dark-border, #27383c);
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .login-field:hover,
:root[data-theme="dark"] .email-readonly-row:hover {
    border-color: #3f6368;
}

:root[data-theme="dark"] .login-field:focus {
    border-color: #5fb7af;
    box-shadow: 0 0 0 3px rgba(95, 183, 175, 0.18);
}

:root[data-theme="dark"] .login-field::placeholder {
    color: var(--asg-dark-muted, #9aa9ad);
}

:root[data-theme="dark"] .password-toggle {
    color: var(--asg-dark-muted, #9aa9ad);
}

:root[data-theme="dark"] .password-toggle:hover {
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .login-field:-webkit-autofill,
:root[data-theme="dark"] .login-field:-webkit-autofill:hover,
:root[data-theme="dark"] .login-field:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--asg-dark-text, #dceceb);
    box-shadow: 0 0 0 1000px var(--asg-dark-surface-2, #162225) inset;
    caret-color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .email-readonly-text {
    color: var(--asg-dark-text, #dceceb);
}

:root[data-theme="dark"] .btn-change-email,
:root[data-theme="dark"] .login-secondary-action,
:root[data-theme="dark"] .forgot-password-link {
    color: #85d8d0;
}

:root[data-theme="dark"] .login-secondary-action {
    background: var(--asg-dark-surface-2, #162225);
    border-color: var(--asg-dark-border, #27383c);
}

:root[data-theme="dark"] .login-secondary-action:hover {
    background: var(--asg-dark-surface-3, #1c2a2e);
    border-color: #5fb7af;
    color: #d7fffb;
}

:root[data-theme="dark"] .remember-row input[type="checkbox"] {
    accent-color: #5fb7af;
}

:root[data-theme="dark"] .field-error {
    color: #fca5a5;
}

:root[data-theme="dark"] .btn-asg.login-action {
    background: #127369;
    border-color: #5fb7af;
    box-shadow: 8px 8px 0 rgba(5, 18, 20, .88);
    color: #fff;
}

:root[data-theme="dark"] .btn-asg.login-action:hover {
    box-shadow: 5px 5px 0 rgba(5, 18, 20, .92);
    color: #fff;
}

:root[data-theme="dark"] .btn-asg.login-action:active {
    box-shadow: 0 0 0 rgba(5, 18, 20, .92);
}

:root[data-theme="dark"] .right-footer-logo {
    filter: brightness(0) invert(1);
    opacity: .76;
}

/* Tablet en vertical: el panel izquierdo desaparece, asi que el derecho
   hereda su textura y el logo pasa a encabezar el bloque. */
@media (orientation: portrait) and (max-width: 1180px) {
    body {
        background:
            radial-gradient(circle at 50% 0%, rgba(114, 161, 167, 0.24) 0%, transparent 36%),
            linear-gradient(180deg, #f1f7f6 0%, #ffffff 52%);
    }

    .login-wrapper {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .login-right {
        position: relative;
        min-height: 100svh;
        padding: clamp(44px, 7vw, 78px) clamp(28px, 9vw, 86px) clamp(26px, 4vh, 40px);
        justify-content: flex-start;
        background:
            radial-gradient(ellipse at 50% -8%, rgba(114, 161, 167, 0.18) 0%, transparent 58%),
            linear-gradient(180deg, #f1f7f6 0%, rgba(255, 255, 255, 0.98) 46%);
    }

    /* Misma trama del panel izquierdo, detras del formulario. */
    .login-right::before {
        content: "";
        position: absolute;
        inset: 0;
        background: url('/Images/Login/background.svg') center / cover no-repeat;
        pointer-events: none;
        z-index: 0;
    }

    .form-area,
    .right-footer {
        position: relative;
        z-index: 1;
    }

    .title-row {
        display: block;
        margin-bottom: 8px;
    }

    .mobile-title-logo {
        display: block;
        width: 84px;
        height: 84px;
        margin-bottom: 22px;
        border-radius: 20px;
        filter: drop-shadow(0 10px 20px rgba(11, 46, 50, 0.18));
    }

    .form-area,
    .right-footer {
        max-width: 440px;
    }

    .form-area {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0;
    }

    /* El credito de {if} baja al pie en vez de quedar pegado al formulario. */
    .right-footer {
        margin-top: auto;
        padding-top: clamp(32px, 6vh, 56px);
    }
}

@media (max-width: 768px) {
    body {
        background:
            radial-gradient(circle at 50% 0%, rgba(114, 161, 167, 0.24) 0%, transparent 36%),
            linear-gradient(180deg, #f1f7f6 0%, #ffffff 52%);
    }

    .login-wrapper {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .login-right {
        position: relative;
        min-height: 100svh;
        padding: 40px 26px 28px;
        justify-content: flex-start;
        background:
            radial-gradient(ellipse at 50% -10%, rgba(114, 161, 167, 0.18) 0%, transparent 60%),
            linear-gradient(180deg, #f1f7f6 0%, rgba(255, 255, 255, 0.98) 46%);
    }

    .login-right::before {
        content: "";
        position: absolute;
        inset: 0;
        background: url('/Images/Login/background.svg') center / cover no-repeat;
        pointer-events: none;
        z-index: 0;
    }

    .form-area,
    .right-footer {
        position: relative;
        z-index: 1;
    }

    .title-row {
        display: block;
        margin-bottom: 6px;
    }

    /* En pantallas angostas el encabezado se centra; el formulario
       se mantiene alineado a la izquierda para leerse igual que siempre. */
    .mobile-title-logo {
        display: block;
        width: 68px;
        height: 68px;
        margin: 0 auto 20px;
        border-radius: 16px;
        filter: drop-shadow(0 8px 16px rgba(11, 46, 50, 0.18));
    }

    .welcome-label,
    .title-row,
    .form-subtitle {
        text-align: center;
    }

    .form-area {
        max-width: 100%;
        justify-content: center;
        flex: 1 1 auto;
        padding: 0;
    }

    /* En pantallas angostas el bloque se sentia apretado: los pasos, el
       campo y el boton necesitan mas aire entre si. */
    .welcome-label {
        margin-bottom: 12px;
    }

    .form-title {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }

    .form-subtitle {
        margin-bottom: 28px;
    }

    .steps-indicator {
        margin-bottom: 28px;
    }

    .step-label {
        font-size: 0.78rem;
    }

    .field-label {
        margin-bottom: 10px;
    }

    .login-field {
        padding: 15px 16px;
    }

    /* La sombra dura del boton sobresale 8px y rozaba el borde. */
    .btn-asg.login-action {
        margin-top: 16px;
        box-shadow: 5px 5px 0 var(--asg-shadow);
    }

    .btn-asg.login-action:hover {
        box-shadow: 3px 3px 0 var(--asg-shadow);
        transform: translate(2px, 2px);
    }

    .btn-asg.login-action:active {
        box-shadow: 0 0 0 var(--asg-shadow);
        transform: translate(5px, 5px);
    }

    /* En celular se mantiene la misma fila que en escritorio: casilla a la
       izquierda y enlace a la derecha. Apilados, el enlace quedaba suelto bajo
       la casilla. flex-wrap solo entra en pantallas muy angostas. */
    .remember-row {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .right-footer {
        margin-top: auto;
        padding-top: 40px;
    }
}

@media (orientation: portrait) and (max-width: 1180px) {
    :root[data-theme="dark"] body {
        background:
            radial-gradient(circle at 50% 0%, rgba(95, 183, 175, 0.16) 0%, transparent 34%),
            linear-gradient(180deg, #0d1416 0%, #111a1d 52%);
    }

    /* La trama esta dibujada en negro: sobre el tema oscuro se invierte
       para que siga leyendose igual que en el panel izquierdo. */
    :root[data-theme="dark"] .login-right::before {
        filter: invert(1);
        opacity: .5;
    }
}

@media (max-width: 768px) {
    :root[data-theme="dark"] body {
        background:
            radial-gradient(circle at 50% 0%, rgba(95, 183, 175, 0.16) 0%, transparent 34%),
            linear-gradient(180deg, #0d1416 0%, #111a1d 52%);
    }

    :root[data-theme="dark"] .login-right::before {
        filter: invert(1);
        opacity: .5;
    }
}
