/**
 * PGM - Plataforma de Gestión de Mantenimiento
 * Estilos específicos para la vista de Login (pgm-login.css)
 * Réplica de diseño de alta fidelidad 16:9 con soporte responsivo
 */

/* ==========================================================================
   1. VARIABLES Y RESET LOCAL
   ========================================================================== */
:root {
    --pgm-orange: #ff7a00;
    --pgm-orange-hover: #ff8c1a;
    --pgm-blue-card: rgba(14, 27, 49, 0.72);
    --pgm-blue-input: rgba(10, 22, 40, 0.65);
    --pgm-border-card: rgba(255, 255, 255, 0.16);
    --pgm-border-input: rgba(255, 255, 255, 0.22);
    --pgm-btn-reload: #0070e0;
    --pgm-btn-reload-hover: #005bb8;
}

/* Evitar scroll horizontal global en la página de login */
html, body.pgm-login-body-tag {
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Poppins', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: #ffffff;
    background-color: #081427;
}

/* ==========================================================================
   2. CONTENEDOR Y FONDO PRINCIPAL (16:9 / COVER)
   ========================================================================== */
.pgm-login-wrapper {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background-color: #081427;
    background-image: 
        radial-gradient(circle at 75% 50%, rgba(255, 122, 0, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 25% 70%, rgba(242, 120, 27, 0.15) 0%, transparent 50%),
        url('/assets/img/login/pgm-refineria_v1.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.2rem 4rem 1.8rem 4rem;
    box-sizing: border-box;
}

/* Overlay sutil para realzar contraste de textos y desenfoque */
.pgm-login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(5, 15, 30, 0.40) 0%,
        rgba(10, 22, 40, 0.20) 50%,
        rgba(30, 15, 5, 0.30) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.pgm-login-content-layer {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

/* ==========================================================================
   3. CABECERA SUPERIOR IZQUIERDA (LOGO CONFIPETROL)
   ========================================================================== */
.pgm-login-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0.8rem;
}

.pgm-login-top-logo {
    height: 42px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transition: transform 0.25s ease;
}

.pgm-login-top-logo:hover {
    transform: scale(1.02);
}

/* ==========================================================================
   4. SECCIÓN PRINCIPAL: IZQUIERDA (TITULAR ARRIBA, INDICADORES ABAJO) Y DERECHA
   ========================================================================== */
.pgm-login-main-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    flex: 1;
    gap: 3rem;
    margin: 0;
}

/* --- COLUMNA IZQUIERDA (ALINEADA TOTALMENTE A LA IZQUIERDA) --- */
.pgm-login-left-col {
    flex: 1;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 0.8rem;
    padding-bottom: 0.4rem;
}

.pgm-login-hero-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

/* Título PGM más negrita y alineado */
.pgm-login-hero-title {
    font-size: clamp(3.4rem, 5.2vw, 5.2rem);
    font-weight: 900;
    line-height: 1.0;
    letter-spacing: -1.5px;
    color: #ffffff;
    margin: 0 0 0.75rem 0;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* Subtítulo más negrita */
.pgm-login-hero-subtitle {
    font-size: clamp(1.4rem, 2.1vw, 2.2rem);
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    margin: 0 0 1.6rem 0;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

.pgm-login-hero-divider {
    width: 70px;
    height: 4px;
    background-color: var(--pgm-orange);
    border-radius: 2px;
    margin-bottom: 1.35rem;
    box-shadow: 0 0 12px rgba(255, 122, 0, 0.7);
}

/* Eslogan con peso semibold/bold y espaciado */
.pgm-login-hero-slogan {
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    font-weight: 700;
    line-height: 1.55;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.96);
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Tres indicadores inferiores alineados abajo a la izquierda */
.pgm-login-left-indicators {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3.2rem;
    margin-top: 2rem;
}

.pgm-login-indicator-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pgm-login-indicator-icon {
    font-size: 1.85rem;
    color: #ffffff;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.pgm-login-indicator-text {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.35;
    margin: 0;
}

/* --- COLUMNA DERECHA (TARJETA FLOTANTE CASI CENTRADA) --- */
.pgm-login-right-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-right: 18vw;
}

.pgm-login-card {
    width: 440px;
    max-width: 440px;
    background: var(--pgm-blue-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--pgm-border-card);
    border-radius: 22px;
    padding: 2.2rem 2.2rem 1.6rem 2.2rem;
    box-shadow: 
        0 20px 45px -10px rgba(0, 0, 0, 0.65),
        0 0 30px rgba(0, 112, 224, 0.15);
    box-sizing: border-box;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Cabecera de la tarjeta */
.pgm-login-card-header {
    text-align: center;
    margin-bottom: 1.4rem;
}

.pgm-login-card-logo {
    height: 32px;
    width: auto;
    max-width: 190px;
    object-fit: contain;
    margin: 0 auto 0.6rem auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.pgm-login-card-divider {
    width: 38px;
    height: 2px;
    background-color: var(--pgm-orange);
    border-radius: 1px;
    margin: 0.55rem auto 0.9rem auto;
}

.pgm-login-card-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.3rem 0;
    letter-spacing: -0.3px;
}

.pgm-login-card-subtitle {
    font-size: 0.82rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
    line-height: 1.4;
}

/* ==========================================================================
   5. FORMULARIO E INPUTS
   ========================================================================== */
.pgm-login-form {
    width: 100%;
}

.pgm-login-input-wrap {
    position: relative;
    width: 100%;
    height: 48px;
    background: var(--pgm-blue-input);
    border: 1px solid var(--pgm-border-input);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 0 0.95rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pgm-login-input-wrap:focus-within {
    border-color: var(--pgm-orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.22);
    background: rgba(14, 28, 52, 0.85);
}

.pgm-login-input-icon {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    margin-right: 0.75rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.pgm-login-control {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #ffffff !important;
    font-size: 0.92rem !important;
    font-family: inherit;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    box-shadow: none !important;
}

.pgm-login-control::placeholder {
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 0.88rem;
}

/* Eliminar fondo amarillo por autofill del navegador */
.pgm-login-control:-webkit-autofill,
.pgm-login-control:-webkit-autofill:hover, 
.pgm-login-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #0c1a30 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Botón mostrar/ocultar contraseña */
.pgm-login-toggle-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.pgm-login-toggle-btn:hover {
    color: #ffffff;
}

/* ==========================================================================
   6. COMPONENTE CAPTCHA (FONDO TRANSPARENTE / SIN BLANCO)
   ========================================================================== */
.pgm-login-captcha-grid {
    display: grid;
    grid-template-columns: 1fr 108px 48px;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 0.75rem;
    width: 100%;
}

.pgm-login-captcha-input-box {
    margin-bottom: 0 !important;
}

/* Caja de imagen CAPTCHA: Fondo azul oscuro translúcido exacto, nunca blanco */
.pgm-login-captcha-box,
.captcha-box,
div.captcha-box {
    height: 48px !important;
    background: var(--pgm-blue-input) !important;
    background-color: var(--pgm-blue-input) !important;
    border: 1px solid var(--pgm-border-input) !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 2px 6px !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease;
}

/* Imagen del CAPTCHA con fondo transparente nativo */
.pgm-login-captcha-box img,
.captcha-box img,
#captcha {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    background: transparent !important;
    background-color: transparent !important;
    /*filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));*/
    transition: opacity 0.2s ease;
}

/* Botón de recarga azul */
.pgm-login-reload-btn,
.captcha-reload,
button.captcha-reload {
    height: 48px !important;
    width: 48px !important;
    background: var(--pgm-btn-reload) !important;
    background-color: var(--pgm-btn-reload) !important;
    border: none !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    font-size: 1.35rem !important;
    cursor: pointer;
    padding: 0 !important;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 112, 224, 0.3);
}

.pgm-login-reload-btn:hover,
.captcha-reload:hover {
    background: var(--pgm-btn-reload-hover) !important;
    background-color: var(--pgm-btn-reload-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 112, 224, 0.45);
}

.pgm-login-reload-btn:active,
.captcha-reload:active {
    transform: translateY(1px);
}

/* Estado de carga durante rotación */
.captcha-group.is-loading #captcha {
    opacity: 0.35;
}

.captcha-group.is-loading .captcha-reload .mdi {
    animation: pgmCaptchaSpin 0.7s linear infinite;
}

@keyframes pgmCaptchaSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. ENLACE RECUPERACIÓN Y BOTÓN INGRESAR
   ========================================================================== */
.pgm-login-forgot-wrap {
    text-align: right;
    margin-bottom: 1.25rem;
}

.pgm-login-forgot-link {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.2s ease;
}

.pgm-login-forgot-link:hover {
    color: var(--pgm-orange);
    text-decoration: underline;
}

.pgm-login-submit-btn {
    width: 100%;
    height: 48px;
    background: linear-gradient(90deg, #ff7a00 0%, #ff8c1a 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 122, 0, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pgm-login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(255, 122, 0, 0.52);
    background: linear-gradient(90deg, #ff850a 0%, #ff9528 100%);
}

.pgm-login-submit-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   7.1 BOTONES DE ACCIÓN DE AUTENTICACIÓN (INICIO, ENVIAR, GRABAR)
   ========================================================================== */
.btn-auth-action,
a.btn-auth-action,
button.btn-auth-action {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    padding: 0 1.2rem !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

/* Forzar apariencia idéntica en botón de retorno Inicio */
.btn-auth-secondary,
a.btn-auth-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease !important;
}

.btn-auth-secondary:hover,
a.btn-auth-secondary:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
}

.btn-auth-secondary:active,
a.btn-auth-secondary:active {
    transform: translateY(0);
}

/* ==========================================================================
   8. TRES INDICADORES INFERIORES DE LA TARJETA
   ========================================================================== */
.pgm-login-card-features {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 1.4rem;
    padding-top: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.pgm-login-card-feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.pgm-login-card-feature-icon {
    font-size: 1.35rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.35rem;
}

.pgm-login-card-feature-text {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    line-height: 1.25;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* ==========================================================================
   9. MENSAJES DE ERROR Y ALERTA
   ========================================================================== */
#msj-error .alert {
    background: rgba(220, 53, 69, 0.25) !important;
    border: 1px solid rgba(220, 53, 69, 0.6) !important;
    color: #ffc2c7 !important;
    border-radius: 10px;
    font-size: 0.88rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.2rem;
    backdrop-filter: blur(8px);
}

#msj-error .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

.pgm-login-timeout-alert {
    background: rgba(220, 53, 69, 0.3);
    border: 1px solid rgba(220, 53, 69, 0.65);
    color: #ffffff;
    border-radius: 10px;
    font-size: 0.88rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.2rem;
    text-align: center;
    backdrop-filter: blur(8px);
}

/* ==========================================================================
   10. FOOTER INSTITUCIONAL
   ========================================================================== */
.pgm-login-footer {
    text-align: center;
    margin-top: 1.1rem;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.3px;
    line-height: 1.4;
}

/* ==========================================================================
   11. RESPONSIVIDAD (TABLETS Y MÓVILES)
   ========================================================================== */
@media (max-width: 1199.98px) {
    .pgm-login-wrapper {
        padding: 1.8rem 2.5rem 1.2rem 2.5rem;
    }

    .pgm-login-main-row {
        gap: 2rem;
    }

    .pgm-login-right-col {
        margin-right: 0;
    }

    .pgm-login-left-indicators {
        gap: 2rem;
    }
}

@media (max-width: 991.98px) {
    .pgm-login-wrapper {
        padding: 1.8rem 1.5rem 1.4rem 1.5rem;
        background-attachment: scroll;
        min-height: 100vh;
        height: auto;
    }

    .pgm-login-content-layer {
        min-height: auto;
    }

    .pgm-login-topbar {
        justify-content: center;
        margin-bottom: 1.2rem;
    }

    .pgm-login-top-logo {
        height: 36px;
    }

    .pgm-login-main-row {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 1.8rem;
        width: 100%;
        margin: 0;
    }

    .pgm-login-left-col {
        max-width: 100%;
        width: 100%;
        text-align: center;
        align-items: center;
        padding-top: 0;
        padding-bottom: 0;
    }

    .pgm-login-hero-block {
        align-items: center;
        text-align: center;
        width: 100%;
    }

    .pgm-login-hero-title {
        font-size: 2.8rem;
        margin-bottom: 0.4rem;
    }

    .pgm-login-hero-subtitle {
        font-size: 1.35rem;
        margin-bottom: 0;
        line-height: 1.2;
    }

    /* Ocultar en móvil: separador naranja, eslogan e indicadores inferiores */
    .pgm-login-hero-divider,
    .pgm-login-hero-slogan,
    .pgm-login-left-indicators {
        display: none !important;
    }

    .pgm-login-right-col {
        width: 100%;
        max-width: 440px;
        margin: 0 auto;
    }

    .pgm-login-card {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .pgm-login-wrapper {
        padding: 1.5rem 1.1rem;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        min-height: 100vh;
    }

    .pgm-login-content-layer {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100%;
        min-height: auto !important;
        flex: 1;
        margin: auto 0;
    }

    /* Ocultar logo blanco de la cabecera superior en celulares */
    .pgm-login-topbar {
        display: none !important;
    }

    .pgm-login-main-row {
        gap: 1.25rem;
        justify-content: center !important;
        align-items: center !important;
        flex: 0 1 auto !important;
        margin: auto 0 !important;
    }

    .pgm-login-left-col {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
    }

    .pgm-login-hero-title {
        font-size: 2.6rem;
        margin-bottom: 0.2rem;
    }

    .pgm-login-hero-subtitle {
        font-size: 1.15rem;
        line-height: 1.25;
    }

    .pgm-login-card {
        width: 100%;
        max-width: 100%;
        padding: 1.6rem 1.25rem 1.3rem 1.25rem;
        border-radius: 18px;
        box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.7);
    }

    .pgm-login-card-header {
        margin-bottom: 1.1rem;
    }

    .pgm-login-card-logo {
        height: 28px;
        margin-bottom: 0.4rem;
    }

    .pgm-login-card-title {
        font-size: 1.4rem;
    }

    .pgm-login-card-subtitle {
        font-size: 0.78rem;
    }

    .pgm-login-input-wrap {
        height: 46px;
        margin-bottom: 0.85rem;
        padding: 0 0.85rem;
    }

    .pgm-login-captcha-grid {
        grid-template-columns: 1fr 95px 46px;
        gap: 6px;
    }

    .pgm-login-captcha-box,
    .captcha-box,
    div.captcha-box {
        height: 46px !important;
    }

    .pgm-login-reload-btn,
    .captcha-reload,
    button.captcha-reload {
        height: 46px !important;
        width: 46px !important;
        font-size: 1.25rem !important;
    }

    .pgm-login-submit-btn {
        height: 46px;
        font-size: 0.98rem;
    }

    .pgm-login-card-features {
        margin-top: 1.1rem;
        padding-top: 0.9rem;
        gap: 0.25rem;
    }

    .pgm-login-card-feature-icon {
        font-size: 1.2rem;
    }

    .pgm-login-card-feature-text {
        font-size: 0.58rem;
        line-height: 1.2;
    }

    .pgm-login-footer {
        margin-top: 0.9rem;
        font-size: 0.7rem;
    }
}
