/*
|--------------------------------------------------------------------------
| Inicio de sesión — Dr. Pedro Hurtado
|--------------------------------------------------------------------------
| Diseño adaptable con fondo corporativo y fotografía desenfocada.
| Se conserva la presentación y el comportamiento del formulario.
*/

:root {
    color-scheme: light;

    --login-primary: #21618C;
    --login-primary-dark: #17496C;
    --login-text-color: #173F5F;
    --login-muted-color: #58718C;
    --login-border-color: #C9DFED;
    --login-white: #FFFFFF;
    --login-panel-background: rgb(255 255 255 / 90%);
    --login-button-background: #21618C;
    --login-button-hover: #17496C;
    --login-button-text: #FFFFFF;
    --login-shadow: 0 12px 36px rgb(23 63 95 / 15%);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    font-size: 16px;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--login-text-color);
    background:
        radial-gradient(
            ellipse at 15% 5%,
            #FFFFFF 0%,
            #F0F6FA 48%,
            transparent 78%
        ),
        linear-gradient(
            135deg,
            #E7F2F8 0%,
            #DCEEF8 55%,
            #C9E1EF 100%
        );
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

/*
 * Área exterior: ocupa toda la ventana y centra el contenedor.
 */
.login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 5vh 5vw;
}

/*
 * Contenedor principal: 90 % del ancho y 90 % de la altura visible.
 * La fotografía se aplica en una capa independiente para que el
 * desenfoque no afecte al formulario ni al logotipo.
 */
.login__panel {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: flex-start;

    width: 90vw;
    height: 90vh;
    height: 90dvh;
    min-width: 0;
    min-height: 0;
    max-width: 1600px;
    margin: 0;

    overflow: hidden;
    border: 4px solid rgb(201 223 237 / 90%);
    border-radius: 20px;
    background-color: var(--login-primary);
    box-shadow: var(--login-shadow);
}

/*
 * Fondo fotográfico con desenfoque suave y velo azul corporativo.
 * La ruta es relativa a assets/css/login.css.
 */
.login__panel::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -8px;
    pointer-events: none;
    background:
        linear-gradient(
            135deg,
            rgb(33 97 140 / 36%),
            rgb(23 73 108 / 28%)
        ),
        url("../img/imgs/fnd__consultas__ph.webp")
            center / cover no-repeat;
    filter: blur(0.6px);
    transform: scale(1);
}

/*
 * Tarjeta interior para mantener una lectura clara sobre la fotografía.
 */
.login__content {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    max-height: 100%;
    padding: clamp(24px, 3vw, 38px);

    transform: translateX(300px);

    overflow-x: hidden;
    overflow-y: auto;

    border: 1px solid rgb(255 255 255 / 70%);
    border-radius: 8px;
    background: var(--login-panel-background);
    box-shadow: 0 10px 30px rgb(23 63 95 / 16%);

    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.login__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--login-border-color);
}

.login__logo {
    display: block;
    width: 112px;
    height: 112px;
    max-width: 100%;
    object-fit: contain;
}

/* Título del formulario */
.login__title {
    margin: 0 0 5px;
    color: var(--login-primary-dark);
    font-size: clamp(1.4rem, 2vw, 1.65rem);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

/* Nombre del profesional */
.login__doctor-name {
    margin: 0 0 18px;
    color: var(--login-primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.3px;
    text-align: center;
}

.login__description {
    margin: 10px 0 24px;
    color: var(--login-muted-color);
    font-size: 0.8rem;
    text-align: center;
}

.login__error {
    margin: 0 0 20px;
    padding: 13px 14px;
    border: 1px solid #E7A6AC;
    border-radius: 8px;
    background: #FFF5F5;
    color: #842029;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.login__error p {
    margin: 0;
}

.login__error p + p {
    margin-top: 8px;
}

.login__form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

.login__field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.login__label {
    color: var(--login-text-color);
    font-size: 0.92rem;
    font-weight: 700;
}

.login__input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 13px;
    border: 1px solid #B8CBD8;
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--login-text-color);
    font: inherit;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.login__input:hover {
    border-color: #8BAFC5;
}

.login__input:focus {
    border-color: var(--login-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgb(33 97 140 / 16%);
}

.login__input:disabled {
    cursor: not-allowed;
    background: #EDF2F5;
    color: #687B88;
}

.login__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 49px;
    margin-top: 3px;
    padding: 12px 18px;
    border: 0;
    border-radius: 7px;
    background: var(--login-button-background);
    color: var(--login-button-text);
    font: inherit;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition:
        background-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.login__button:hover {
    background: var(--login-button-hover);
}

.login__button:active:not(:disabled) {
    transform: translateY(1px);
}

.login__button:focus-visible,
.login__policies:focus-visible {
    outline: 3px solid #17496C;
    outline-offset: 3px;
}

.login__button:disabled {
    background: #687F8E;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Separación del área legal */
.login__footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--login-border-color);
    text-align: center;
}

/* Enlaces legales */
.login__legal-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 18px;
}

.login__policies {
    color: var(--login-primary-dark);
    font-size: 0.8rem;
    line-height: 1.5;
    text-decoration: none;
    text-underline-offset: 3px;
}

.login__policies:hover {
    color: var(--login-primary);
    text-decoration: underline;
}

.login__policies:focus-visible {
    outline: 2px solid var(--login-primary);
    outline-offset: 4px;
    border-radius: 2px;
}

/*
 * En dispositivos con poca altura, permitir desplazamiento dentro
 * del contenido para evitar que el formulario quede cortado.
 */
@media (max-height: 700px) and (min-width: 601px) {
    .login__content {
        padding: 20px 28px;
        transform: none;
    }

    .login__brand {
        margin-bottom: 10px;
    }

    .login__logo {
        width: 82px;
        height: 82px;
    }

    .login__description {
        margin-bottom: 16px;
    }

    .login__form {
        gap: 13px;
    }

    .login__footer {
        margin-top: 15px;
    }
}

/*
 * Ajustes para móviles: conservar el contenedor amplio sin recortar
 * los campos cuando la pantalla tiene poca altura.
 */
@media (max-width: 600px) {
    .login {
        padding: 5vw;
    }

    .login__panel {
        width: 90vw;
        height: 90vh;
        height: 90dvh;
        padding: 14px;
        border-radius: 14px;
    }

    .login__content {
        width: 100%;
        max-width: 420px;
        padding: 22px 18px;
        border-radius: 12px;
        transform: none;
    }

    .login__logo {
        width: 88px;
        height: 88px;
    }

    .login__description {
        margin-bottom: 19px;
    }
}

@media (max-width: 360px) {
    .login__content {
        padding: 18px 14px;
        transform: none;
    }

    .login__logo {
        width: 76px;
        height: 76px;
    }
}

/*
 * Reducir los efectos de transparencia cuando el sistema lo solicita.
 */
@media (prefers-reduced-transparency: reduce) {
    .login__content {
        background: #FFFFFF;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login__input,
    .login__button {
        transition: none;
    }
}

/* Botón de salida del login */
.login__content {
    position: relative;
}

.login__exit {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;

    color: #B4232F;
    background-color: #FCE8E8;
    border: 1px solid #F5C2C7;
    border-radius: 8px;

    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.login__exit-icon {
    display: block;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.login__exit:hover {
    color: #FFFFFF;
    background-color: #A61B29;
    border-color: #A61B29;
    box-shadow: 0 3px 10px rgb(166 27 41 / 18%);
}

.login__exit:hover .login__exit-icon {
    transform: rotate(90deg);
}

.login__exit:focus-visible {
    outline: 3px solid #21618C;
    outline-offset: 3px;
}

.login__exit:active {
    background-color: #851522;
    border-color: #851522;
}

@media (prefers-reduced-motion: reduce) {
    .login__exit,
    .login__exit-icon {
        transition: none;
    }
}