@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   CASILLA ELECTRÓNICA · UGEL AMBO - INICIO DE SESIÓN
   Rediseño Institucional:
     - Fachada real de UGEL Ambo como fondo hero del panel izquierdo.
     - Controles de formulario limpios con bordes suaves sin recuadros invasivos.
   Paleta:
     Azul marino:      #06265D / #0A1F4D
     Azul principal:   #0647B8 / #1550D6
     Azul eléctrico:   #0878F9
     Azul cielo:       #DCEAFF / #8FC4FF
     Dorado acento:    #C9A45C
     Fondo secundario: #F4F8FF / #F3F5F9
     Blanco:           #FFFFFF
     Texto secundario: #53627A / #5B6784
     Bordes:           #D6E2F2 / #DDE3EE
   ========================================================================== */

.ugel-stage {
    --navy: #06265d;
    --navy-deep: #0a1f4d;
    --navy-2: #102a63;
    --blue: #0647b8;
    --royal: #1550d6;
    --electric: #0878f9;
    --sky: #dceaff;
    --sky-soft: #8fc4ff;
    --gold: #c9a45c;
    --pearl: #f3f5f9;
    --white: #ffffff;
    --muted: #53627a;
    --line: #d6e2f2;
    --ink: #0f1b36;
    --err: #c62f3e;
    --ok: #14804a;

    color-scheme: light;
    font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    background: var(--pearl);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

.ugel-stage *,
.ugel-stage *::before,
.ugel-stage *::after {
    box-sizing: inherit;
}

/* ==========================================================================
   PANEL INSTITUCIONAL IZQUIERDO (CON FACHADA COMO FONDO)
   ========================================================================== */

.ugel-brand {
    position: relative;
    color: var(--white);
    padding: clamp(32px, 5vw, 64px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    isolation: isolate;
    background-color: var(--navy-deep);
}

/* Fotografía de la fachada de la UGEL Ambo como fondo completo */
.ugel-brand__bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: url('/images/ugel-ambo-fachada.jpg');
    background-size: cover;
    background-position: center 35%;
    transform: scale(1.02);
    pointer-events: none;
}

/* Superposición con degradado institucional azul marino y azul principal */
.ugel-brand__overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        140deg,
        rgba(6, 38, 93, 0.93) 0%,
        rgba(10, 31, 77, 0.88) 45%,
        rgba(6, 71, 184, 0.82) 100%
    );
    pointer-events: none;
}

/* Textura sutil institucional */
.ugel-brand__overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 92px);
    pointer-events: none;
}

/* Identidad institucional superior */
.ugel-brand__id {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ugel-brand__id img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--white);
    object-fit: contain;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 6px 16px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.ugel-brand__id b {
    display: block;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--white);
}

.ugel-brand__id span {
    display: block;
    font-size: 12.5px;
    color: #c7d7f7;
}

/* Títulos y propuesta */
.ugel-brand__copy {
    max-width: 500px;
    padding: 40px 0;
}

.ugel-brand__rule {
    display: block;
    width: 44px;
    height: 3.5px;
    background: var(--gold);
    border-radius: 2px;
    margin-bottom: 22px;
    box-shadow: 0 0 12px rgba(201, 164, 92, 0.5);
}

.ugel-brand__title {
    margin: 0 0 16px;
    font-size: clamp(2.4rem, 4vw, 3.5rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ugel-brand__intro {
    margin: 0;
    color: #dbe6fa;
    font-size: 1.04rem;
    line-height: 1.6;
    max-width: 44ch;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Puntos de valor con tarjetas translúcidas */
.ugel-brand__features {
    list-style: none;
    margin: 34px 0 0;
    padding: 0;
    display: grid;
    gap: 13px;
}

.ugel-brand__features li {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 0.94rem;
    color: #f0f5ff;
    font-weight: 500;
}

.ugel-brand__features i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    color: var(--sky-soft);
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

/* Insignia de confianza inferior */
.ugel-brand__trust {
    padding-top: 20px;
}

.ugel-brand__badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(6, 38, 93, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    padding: 10px 16px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.35);
}

.ugel-brand__badge-icon {
    color: #ffd875;
    flex-shrink: 0;
}

.ugel-brand__badge b {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--white);
}

.ugel-brand__badge span {
    display: block;
    color: #c7d7f7;
    font-size: 11.5px;
}

/* ==========================================================================
   PANEL DE ACCESO DERECHO (CARD)
   ========================================================================== */

.ugel-access {
    display: grid;
    place-items: center;
    padding: clamp(24px, 4vw, 56px);
    background: var(--pearl);
}

.ugel-card {
    width: 100%;
    max-width: 440px;
    background: var(--white);
    border-radius: 22px;
    padding: clamp(26px, 3.2vw, 40px);
    box-shadow:
        0 1px 3px rgba(15, 27, 54, 0.05),
        0 20px 45px -20px rgba(15, 27, 54, 0.18);
    border: 1px solid #e3e8f2;
}

/* Cabecera del formulario */
.ugel-card__kick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--blue);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0 0 10px;
}

.ugel-card__title {
    margin: 0;
    font-size: clamp(1.65rem, 2.2vw, 1.95rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 800;
    color: var(--navy);
}

.ugel-card__sub {
    margin: 8px 0 24px;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.45;
}

/* Avisos */
.ugel-notice {
    margin-bottom: 18px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.ugel-notice--info {
    background: #eef8f3;
    color: #156145;
    border: 1px solid #c2e5d5;
}

.ugel-notice--warning {
    background: #fff8e8;
    color: #73480b;
    border: 1px solid #f6deb2;
}

/* Formulario */
.ugel-form {
    display: grid;
    gap: 16px;
}

.ugel-field {
    margin-bottom: 2px;
}

.ugel-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 7px;
    color: var(--navy);
}

.ugel-cnt {
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   CONTROLES DE ENTRADA (CORREGIDOS PARA EVITAR RECUADROS EXAGERADOS)
   ========================================================================== */

.ugel-ctl {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    height: 50px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.ugel-ctl:hover {
    border-color: #b9cadf;
}

/* Borde suave institucional al enfocar (sin recuadro tosco) */
.ugel-ctl:focus-within {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(6, 71, 184, 0.12) !important;
}

.ugel-ctl__icon {
    margin-left: 14px;
    color: #6d7d9b;
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.ugel-ctl:focus-within .ugel-ctl__icon {
    color: var(--blue);
}

/* RESET COMPLETO DEL INPUT INTERNO PARA ELIMINAR EL RECUADRO TOLEDO */
.ugel-ctl input,
.ugel-ctl input:focus,
.ugel-ctl input:focus-visible,
.ugel-ctl input:active,
.ugel-sec input,
.ugel-sec input:focus,
.ugel-sec input:focus-visible,
.ugel-sec input:active {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ugel-ctl input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    font: inherit;
    font-size: 14.5px;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.ugel-ctl input::placeholder {
    color: #9aa5bf;
    font-weight: 400;
}

/* Deshabilitar el fondo y contorno automático que genera el navegador en autocompletar */
.ugel-ctl input:-webkit-autofill,
.ugel-ctl input:-webkit-autofill:hover, 
.ugel-ctl input:-webkit-autofill:focus,
.ugel-ctl input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: var(--ink) !important;
    outline: none !important;
    border: none !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Estados de validación */
.ugel-ctl.ok {
    border-color: #7cc9a0;
}

.ugel-ctl.bad {
    border-color: var(--err);
    box-shadow: 0 0 0 3px rgba(198, 47, 62, 0.1);
}

.ugel-ctl__state {
    margin-right: 14px;
    flex-shrink: 0;
}

.ugel-ctl__state.s-ok {
    color: var(--ok);
}

.ugel-ctl__state.s-bad {
    color: var(--err);
}

/* Botón mostrar / ocultar contraseña */
.ugel-ctl__eye {
    border: 0;
    background: none;
    width: 44px;
    height: 100%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #6b7896;
    border-radius: 0 12px 12px 0;
    transition: color 0.18s ease;
}

.ugel-ctl__eye:hover {
    color: var(--blue);
}

.ugel-ctl__eye:focus-visible,
.ugel-btn:focus-visible,
.ugel-link:focus-visible,
.ugel-demo__btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Mensajes de error */
.ugel-login__error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 5px 2px 0;
    font-size: 12.5px;
    color: var(--err);
    font-weight: 600;
}

/* ==========================================================================
   VERIFICACIÓN DE SEGURIDAD (CAPTCHA MATEMÁTICO)
   ========================================================================== */

.ugel-sec {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(180deg, #f4f7fd 0%, #edf3fc 100%);
    border: 1px solid #dbe5f6;
    border-radius: 12px;
    padding: 10px 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ugel-sec.bad {
    border-color: var(--err);
    background: #fdf5f5;
}

.ugel-sec__shield {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--navy);
    color: var(--sky-soft);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.ugel-sec__question {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.35;
    cursor: pointer;
}

.ugel-sec__question b {
    display: block;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

.ugel-sec__question em {
    font-style: normal;
    font-weight: 800;
    color: var(--ink);
    font-size: 14px;
    letter-spacing: 0.04em;
}

.ugel-sec__control {
    width: 90px;
    height: 42px;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.ugel-sec__control:focus-within {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(6, 71, 184, 0.12) !important;
}

.ugel-sec__control input {
    width: 100%;
    height: 100%;
    text-align: center;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

/* ==========================================================================
   BOTÓN DE INGRESO
   ========================================================================== */

.ugel-btn {
    width: 100%;
    height: 50px;
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--blue) 0%, #053b9e 100%);
    color: var(--white);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px -8px rgba(6, 71, 184, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.ugel-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 14px 24px -10px rgba(6, 71, 184, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.ugel-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ugel-btn:disabled {
    cursor: progress;
    filter: saturate(0.8) brightness(0.95);
    opacity: 0.85;
}

.ugel-btn__spinner {
    animation: ugel-spin 0.7s linear infinite;
}

@keyframes ugel-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Recuperación de contraseña */
.ugel-card__recovery {
    text-align: center;
    margin: 18px 0 0;
}

.ugel-link {
    color: var(--blue);
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.ugel-link:hover {
    color: var(--royal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Cuentas de demostración */
.ugel-demo {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
}

.ugel-demo h3 {
    margin: 0 0 10px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.ugel-demo__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.ugel-demo__btn {
    border: 1px solid var(--line);
    background: #f4f8ff;
    color: var(--navy);
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ugel-demo__btn:hover:not(:disabled) {
    background: var(--sky);
    border-color: var(--blue);
    color: var(--blue);
}

.ugel-demo__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pie de soporte / ayuda */
.ugel-card__help {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.ugel-card__help-icon {
    width: 30px;
    height: 30px;
    padding: 5px;
    border-radius: 8px;
    background: #eef3fc;
    color: var(--blue);
    flex-shrink: 0;
}

.ugel-card__help b {
    display: block;
    color: var(--navy);
    font-size: 12.5px;
}

.ugel-card__help p {
    margin: 2px 0 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 960px) {
    .ugel-stage {
        grid-template-columns: 1fr;
    }

    .ugel-brand {
        padding: 32px 24px 48px;
        min-height: 320px;
    }

    .ugel-brand__copy {
        padding: 20px 0 10px;
        max-width: none;
    }

    .ugel-brand__title {
        font-size: 2.2rem;
    }

    .ugel-brand__features {
        display: none;
    }

    .ugel-access {
        padding: 0 16px 36px;
        margin-top: -32px;
        position: relative;
    }

    .ugel-card {
        padding: 26px 20px;
        max-width: 500px;
    }
}

/* ==========================================================================
   VENTANA FLOTANTE: RECUPERAR / RESTABLECER CONTRASEÑA (MODAL)
   ========================================================================== */

.ugel-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(6, 38, 93, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ugel-modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: clamp(24px, 4vw, 36px);
    box-shadow:
        0 1px 3px rgba(15, 27, 54, 0.08),
        0 24px 60px -15px rgba(6, 38, 93, 0.45);
    color: var(--ink);
    font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    outline: none;
}

.ugel-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #f1f5f9;
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.16s ease;
}

.ugel-modal-close:hover {
    background: #e2e8f0;
    color: var(--navy);
}

.ugel-modal-close:focus-visible {
    outline: 2px solid var(--electric);
    outline-offset: 2px;
}

.ugel-modal-icon-wrap {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    color: var(--white);
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px -4px rgba(6, 71, 184, 0.5);
}

.ugel-modal-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--navy);
}

.ugel-modal-desc {
    margin: 8px 0 20px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--muted);
}

.ugel-link--button {
    background: transparent;
    border: 0;
    padding: 4px 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--blue);
}

.ugel-link--button:hover {
    color: var(--royal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 420px) {
    .ugel-sec {
        flex-wrap: wrap;
    }

    .ugel-sec__control {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
