/*
 * Estilos de autenticación.
 * Invocado por:
 * - app/Views/Auth/login.view.php
 * - app/Views/Auth/change-passwd.view.php
 */

/* Variables y normalización base. */
:root {
    --navy: #102746;
    --navy-deep: #091b33;
    --gold: #c7a45a;
    --light: #f2f2f2;
    --white: #fff;
    --error: #a4161a;
    --focus: #44b3e1;
    font-family: Arial, Helvetica, sans-serif;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background: var(--light);
    font-size: 12px;
}

/* Estructura principal del login público. */
.auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(560px, 42%) 1fr;
    flex: 1;
    min-height: 0;
}

.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding: 110px clamp(40px, 5vw, 92px) 54px;
    color: var(--white);
    background: linear-gradient(145deg, var(--navy-deep), var(--navy));
}

.auth-panel h1 {
    position: absolute;
    top: 42px;
    right: 0;
    left: 0;
    margin: 0;
    text-align: center;
    font-size: clamp(26px, 2.2vw, 36px);
    font-weight: 700;
}

.auth-hero {
    min-height: 580px;
    background: url('/Assets/Images/web/main_image.jpg') center / cover no-repeat;
}

/* Formularios, controles y estados de interacción. */
.auth-form {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 150px minmax(280px, 1fr);
    gap: 18px 22px;
    align-items: center;
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
}

.auth-form label {
    font-size: 16px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    color: inherit;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 2px;
}

.auth-form input:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.password-field {
    position: relative;
    display: flex;
}

.password-field input {
    padding-right: 94px;
}

.password-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    color: var(--navy);
    padding: 0 14px;
    font-size: 14px;
    font-weight: 700;
    background: var(--white);
    border: 0;
    cursor: pointer;
}

.primary-button {
    grid-column: 2;
    min-height: 54px;
    padding: 12px 20px;
    color: #111;
    font-size: 16px;
    font-weight: 700;
    background: var(--gold);
    border: 0;
    cursor: pointer;
}

.primary-button:hover {
    filter: brightness(1.08);
}

.primary-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.disabled-link {
    grid-column: 2;
    text-align: center;
    text-decoration: underline;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.8;
    cursor: not-allowed;
}

.alert {
    padding: 12px;
    margin: 0 0 18px;
    border-radius: 3px;
}

.alert-error {
    color: #720b0b;
    background: #fff0f0;
    border: 1px solid #d66;
}

/* Pie institucional compartido por la página de login. */
.public-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 76px;
    padding: 14px 18px;
    font-size: 10px;
    background: var(--light);
    border-top: 1px solid #333;
}

.public-footer img {
    width: 42px;
    margin-left: 16px;
    vertical-align: middle;
}

/* Tarjeta para el cambio obligatorio de contraseña. */
.compact-auth {
    padding: 30px;
}

.change-card {
    width: min(620px, calc(100% - 32px));
    padding: 32px;
    margin: auto;
    color: var(--white);
    background: var(--navy);
    border-radius: 8px;
    box-shadow: 0 14px 40px #0003;
}

.change-logo {
    display: block;
    width: 180px;
    max-height: 80px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.change-card h1 {
    text-align: center;
}

.change-card .auth-form {
    grid-template-columns: 1fr;
}

.change-card .primary-button,
.change-card .disabled-link {
    grid-column: 1;
}

.password-help {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--gold);
}

.password-help ul {
    padding-left: 20px;
    margin: 6px 0 0;
}

/* Adaptación a tabletas y teléfonos. */
@media (max-width: 800px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        min-height: 620px;
        padding: 90px 24px 34px;
    }

    .auth-hero {
        min-height: 240px;
    }

    .auth-form {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .primary-button,
    .disabled-link {
        grid-column: 1;
    }

    .public-footer {
        flex-direction: column;
        text-align: center;
    }

    .public-footer img {
        width: 32px;
    }

    .change-card {
        padding: 24px;
    }

    .compact-auth {
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
