/**
 * =========================================================
 * Estilos CAS - Universidad Nacional de Loja
 * Autor: Equipo DTI / UNL
 * Contexto:
 *  - Overrides Material Design Components (MDC)
 *  - Login CAS institucional
 *  - Responsive optimizado para móvil
 *
 * NOTA:
 *  No eliminar reglas MDC sin validar en CAS
 * =========================================================
 */

/* =========================================================
   1. VARIABLES DE IDENTIDAD INSTITUCIONAL (UNL)
   ========================================================= 
*/
:root {
    --unl-blue: #0c2342;
    --unl-gold: #C9A430;
    --unl-dark: #001F42;
    --unl-gray: #adadad;
    --unl-success-bg: #adf096;
    --unl-info-bg: #9fceff;
    --unl-danger-text: #b00020;
    --bg-light: #F4F7F9;
    --white: #FFFFFF;
    --cas-theme-danger: #58151c;
    --cas-theme-danger-bg: #f8d7da;
    --border-radius: 16px;
    --card-shadow: 0 10px 30px rgba(0, 43, 92, 0.25);
    --mdc-theme-primary: var(--unl-blue);
    --mdc-theme-secondary: var(--unl-gold);
}

/* =========================================================
   2. LAYOUT GENERAL Y FONDO
   ========================================================= */
body {
    background-color: var(--bg-light);
    font-family: Montserrat, Sans-serif !important;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* El contenedor principal que envuelve el login */
.mdc-drawer-app-content.bgimage {
    flex: 1;
    align-items: center;
}

/* =========================================================
   3. HEADER (ENCABEZADO)
   ========================================================= 
*/
header#app-bar {
    position: relative;
    background:
        linear-gradient(rgba(0, 43, 92, 0.85), rgba(0, 43, 92, 0.85)),
        url('/cas/images/campus-bg-61b9ba905343bf662fe2626c303bff57.jpg');

    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    padding-top: 20px;
    padding-bottom: 10px;
    border-bottom: 4px solid var(--unl-gold);
}

.header-flex-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 1. EL LOGO */
header #logo {
    display: block;
    margin-right: 75px;
    width: 300px;
    height: 100px;
    background: url('/cas/images/logo_unl-4bd12b3583ab6755a69f03508486be3d.png') no-repeat center center;
    background-size: contain;
}

/* 2. LA LÍNEA VERTICAL */
.vertical-separator {
    width: 2px;
    height: 80px;
    background-color: var(--unl-gold);
}

/* 3. EL TEXTO */
.header-title h1 {
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 2.1rem;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    text-align: left;
    margin-left: 75px;
}

#serviceui {
    color: #fff;
    background-color: transparent;
    padding: 5px;
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 1em;
}

#servicedesc {
    width: 100%;
    font-size: 1.5em;
}

.banner {
    position: relative;
    padding-left: 10px;
    box-shadow: 1px 1px 3px #888;
    border-radius: .5em;
    padding-top: .5em;
    padding-bottom: .5em;
    margin-bottom: 1.5em;
}

.banner>span {
    vertical-align: top;
}

.banner .banner-message {
    margin: 0.375rem 0;
}

.banner .banner-heading:first-child {
    margin-top: 0;
}

.banner .banner-message:first-child {
    margin-top: 0;
}

.banner .banner-message:last-child {
    margin-bottom: 0;
}

.banner-primary {
    border-color: #153e50;
    border-color: var(--cas-theme-primary, #153e50);
}

.banner-primary .mdi {
    color: #153e50;
    color: var(--cas-theme-primary, #153e50);
}

.banner-danger {
    border: 0px;
    color: var(--cas-theme-danger, #58151c);
    background-color: var(--cas-theme-danger-bg, #f8d7da);
}

.banner-danger .mdi {
    color: var(--unl-danger-text);
    color: var(--cas-theme-danger, #b00020);
}

.banner-warning {
    border-color: #e6a210;
    border-color: var(--cas-theme-warning, #e6a210);
    color: #664d03;
    color: var(--cas-theme-warning, #664d03);
    background-color: var(--cas-theme-warning-bg, #fff3cd);
}

.banner-warning .mdi {
    color: #664d03;
    color: var(--cas-theme-warning, #664d03);
}


.banner-success h1:before,
.banner-success h2:before,
.banner-success h3:before,
.banner-success h4:before,
.banner-success h5:before {
    content: "\F012D";
    font-size: 24px;
    font: normal normal normal 24px/1 "Material Design Icons";
}

.banner-success {
    border-color: var(--cas-theme-success);
    color: var(--cas-theme-primary, #153e50);
    background-color: var(--unl-success-bg);
}

.banner-info h1:before,
.banner-info h2:before,
.banner-info h3:before,
.banner-info h4:before,
.banner-info h5:before {
    content: "\F1C67";
    font-size: 24px;
    font: normal normal normal 24px/1 "Material Design Icons";
}

.banner-info {
    border-color: var(--cas-theme-primary);
    color: black;
    background-color: var(--unl-info-bg);
}

.banner-dismissible {
    padding-right: 0rem;
}

.banner-dismissible .close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.05rem 0.05rem;
    color: inherit;
}

/* =========================================================
   4. TARJETA DE LOGIN (CARD)
   ========================================================= 
*/
/* Apunta al contenedor del formulario definido en casLoginView.html */
#login-form-controls>h2 {
    color: var(--unl-blue);
    text-transform: uppercase;
    text-align: center;
    border-bottom: 2px solid var(--unl-gold);
    padding-bottom: 15px;
    margin: 0px;
    margin-bottom: 1.25em;
    font-size: 1.4rem;
    font-weight: 700;
    font-size: 1.5rem;
}

#loginForm,
.login-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem 1.25rem;
    max-width: 450px;
    margin: 40px auto;
    box-shadow: var(--card-shadow);
    position: relative;
}

/* =========================================================
   5. FORMULARIO E INPUTS (Material Design Overrides)
   ========================================================= 
*/

.cas-field {
    margin-bottom: 1.5rem;
}

.word-break-all {
    word-break: break-all;
}

.mdc-text-field {
    width: 100%;
    align-items: center;
}

/* Estilo de los Inputs (Cajas de texto) */
.mdc-text-field--outlined {
    background-color: #fff;
    border-radius: 16px;
    width: 100%;
    overflow: visible;
}

/* Color del borde cuando NO está enfocado */
.mdc-text-field--outlined:not(.mdc-text-field--focused) .mdc-notched-outline__leading,
.mdc-text-field--outlined:not(.mdc-text-field--focused) .mdc-notched-outline__notch,
.mdc-text-field--outlined:not(.mdc-text-field--focused) .mdc-notched-outline__trailing {
    border-color: #ccc;
}

/* Color del borde cuando ESTÁ enfocado (Azul UNL) */
.mdc-text-field--focused .mdc-notched-outline__leading,
.mdc-text-field--focused .mdc-notched-outline__notch,
.mdc-text-field--focused .mdc-notched-outline__trailing {
    border-color: var(--unl-blue) !important;
    border-width: 2px;
}

/* Color de la etiqueta flotante (Label) */
.mdc-text-field:not(.mdc-text-field--disabled) .mdc-floating-label {
    color: #666;
}

.mdc-text-field--focused:not(.mdc-text-field--disabled) .mdc-floating-label {
    color: var(--unl-blue) !important;
}

/* Botón de "ver contraseña" (ojo) */
.reveal-password-icon {
    color: var(--unl-blue);
}

#password {
    border-right: 1px solid #9e9e9e !important;
    padding-right: 16px;
}

/* =========================================================
   6. BOTONES Y ENLACES
   ========================================================= */

/* Botón Principal (INICIAR SESIÓN) */
.btn-primary,
button[name="submit"] {
    background-color: var(--unl-blue) !important;
    border-color: var(--unl-blue) !important;
    color: #fff !important;
    width: 100%;
    padding: 12px;
    font-weight: bold;
    font-size: 1rem;
    border-radius: 8px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}

.btn-primary:hover,
button[name="submit"]:hover {
    background-color: var(--unl-gray) !important;
}

/* Enlace "¿Olvidó su contraseña?" */
.login-form a,
div[th\:fragment="pmlinks"] a {
    color: var(--unl-blue);
    text-decoration: underline;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    border-bottom: 2px solid transparent;
}

.login-form a:hover {
    border-bottom: 2px solid var(--unl-blue);
}

/* =========================================================
   7. FOOTER
   ========================================================= */
footer {
    background-color: transparent;
    color: var(--unl-dark);
    text-align: center;
    font-size: 0.8rem;
    padding: 1rem;
    z-index: 5;
}

/* Si el footer cae sobre la imagen de fondo oscura, usa texto blanco */
.mdc-drawer-app-content+footer span {
    color: #333;
}

.reveal-password {
    position: inherit;
    width: 32px;
    padding: 0;
    margin: 0;
    background-color: #fff !important;
    border: none !important;
    border-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
}

/* 
 * Elimina ripple y pseudo-elementos MDC
 * Necesario para evitar doble icono en botón "ver contraseña"
 */
.reveal-password::before,
.reveal-password::after {
    display: none !important;
}

.mdc-text-field--with-trailing-icon {
    position: relative;
}

.btn-submit {
    outline: none;
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    border: 0;
    padding: 12px;
    width: 100%;
    cursor: pointer;
    background-color: var(--unl-blue) !important;
    border-color: var(--unl-blue) !important;
    color: #fff !important;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

button[name="submit"]:hover {
    background-color: var(--unl-dark) !important;
}

.text-danger {
    color: var(--unl-danger-text);
    color: var(--cas-theme-danger, #b00020);
}

.caps-warn {
    margin-left: 0.5em;
    margin-top: 0.5em;
}

.alert>h2 {
    font-size: 1em;
    margin: 0 !important;
    padding: 0 !important;
}

.alert>p {
    font-size: 0.75em !important;
    margin: 0 !important;
    padding: 0 !important;
}



.mdc-icon-button {
    height: 56px;
}

section.cas-field.form-check.mb-2 label.ml-2 {
    padding-left: 0.5em;
}

/* Enlace de "Olvidaste contraseña" */
.link-restore-pass {
    color: var(--unl-blue);
    text-decoration: underline;
    border: none !important;
}

/* =========================================================
   MEDIA QUERIES DEL HEADER (Ajuste para móviles)
   ========================================================= */

@media only screen and (max-width: 850px) {
    header #logo {
        height: 100px;
        margin-right: 50px;
    }

    .header-title h1 {
        font-size: 1.5rem;
        margin-left: 50px;
    }
}

@media only screen and (max-width: 768px) {
    .vertical-separator {
        height: 50px;
    }

    header#app-bar {
        padding-top: 15px;
    }

    #serviceui {
        font-size: 0.8rem;
    }

    header #logo {
        width: 200px;
        height: 60px;
        background-position: center center;
        margin-right: 25px;
    }

    .header-title h1 {
        font-size: 1rem;
        margin-left: 25px;
    }

    .mdc-icon-button {
        height: 38px;
    }
    .reveal-password{
        min-width: 38px;
    }

    /* 1. Reducir altura del contenedor del input */
    .mdc-text-field {
        height: 38px !important;
        border-radius: 6px !important;
    }

    /* 2. Reducir tamaño de letra al escribir */
    .mdc-text-field__input {
        font-size: 12px !important;
        padding-bottom: 0 !important;
    }

    .mdc-text-field-helper-text {
        font-size: 0.7rem;
    }

    .mdc-text-field+.mdc-text-field-helper-line {
        padding: 0px;
    }

    .mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,
    .mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above {
        font-size: 0.75rem;
    }

    .mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,
    .mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above {
        transform: translateY(-26px) scale(0.75);
    }

    #fm1 h2 {
        font-size: 1.25rem;
        margin-bottom: 15px;
    }

    #servicedesc {
        font-size: 1.25em;
    }

    .btn-submit {
        height: 38px;
        padding: 0px;
        font-size: 0.9rem;
    }

    section.cas-field {
        font-size: 0.9rem;
    }

    .caps-warn {
        margin-left: 0em;
        margin-top: 0em;
    }

    #loginForm,
    .login-section {
        margin: 10px auto;
    }
}

@media only screen and (max-width: 428px) {
    header #logo {
        height: 40px;
        margin-right: 10px;
        width: 120px;
    }

    .vertical-separator {
        height: 40px;
    }

    .header-title h1 {
        font-size: 0.8rem;
        margin-left: 10px;
    }
}