/* ============================================================
   LOGIN ALTEL — Rediseño glassmorphism
   Solo estilos: el HTML de index.php no requiere cambios
   ============================================================ */

:root {
    --azul-marca: #004d99;
    --azul-claro: #008cff;
    --azul-neon: #38bdf8;
    --tinta: #0b1e3a;
    --texto-suave: #64748b;
}

/* ---------- Fondo: gradiente animado (como el original) ---------- */
body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif !important;
    background: linear-gradient(-45deg, #004d99, #005fb8, #008cff, #ffffff);
    background-size: 400% 400%;
    animation: gradientMove 20s ease infinite;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientMove {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---------- Insignias de seguridad flotando en el fondo ---------- */
html::before,
html::after,
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.14);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 45%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(2px);
    z-index: 0;
    pointer-events: none;
}

/* Escudo con palomita */
html::before {
    width: 200px;
    height: 200px;
    top: 8%;
    left: 6%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='0.75' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l7 3v5c0 4.5-3 8.5-7 10-4-1.5-7-5.5-7-10V6z'/><path d='M9 12l2 2 4-4'/></svg>");
    animation: burbuja1 14s ease-in-out infinite;
}

/* Candado */
html::after {
    width: 130px;
    height: 130px;
    top: 65%;
    left: 12%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='0.75' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='5' y='11' width='14' height='9' rx='2'/><path d='M8 11V8a4 4 0 0 1 8 0v3'/><circle cx='12' cy='15.5' r='1.3' fill='white' fill-opacity='0.75' stroke='none'/></svg>");
    animation: burbuja2 11s ease-in-out infinite;
}

/* Cámara de videovigilancia */
body::before {
    width: 260px;
    height: 260px;
    top: 55%;
    right: 4%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='0.75' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='7' width='12' height='9' rx='2'/><path d='M15 10.5l6-2.5v8l-6-2.5'/><circle cx='9' cy='11.5' r='2'/></svg>");
    animation: burbuja3 18s ease-in-out infinite;
}

/* Señal de monitoreo */
body::after {
    width: 110px;
    height: 110px;
    top: 12%;
    right: 18%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='0.75' stroke-width='1.3' stroke-linecap='round'><circle cx='12' cy='12' r='2' fill='white' fill-opacity='0.75' stroke='none'/><path d='M16.5 7.5a6.5 6.5 0 0 1 0 9'/><path d='M7.5 16.5a6.5 6.5 0 0 1 0-9'/><path d='M19.5 4.5a10.5 10.5 0 0 1 0 15'/><path d='M4.5 19.5a10.5 10.5 0 0 1 0-15'/></svg>");
    animation: burbuja2 9s ease-in-out infinite reverse;
}

@keyframes burbuja1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -50px) scale(1.08); }
    66%      { transform: translate(-25px, 30px) scale(0.94); }
}

@keyframes burbuja2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50%      { transform: translate(-35px, -60px) rotate(12deg); }
}

@keyframes burbuja3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-60px, -40px) scale(1.12); }
}

/* ---------- Tarjeta de login: vidrio esmerilado ---------- */
.login-container {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 45px 40px 60px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 25px 60px rgba(2, 12, 32, 0.55),
        0 0 0 1px rgba(0, 140, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 10;
    animation: entrada 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Filo luminoso superior de la tarjeta */
.login-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(90deg, transparent, var(--azul-claro), transparent);
    opacity: 0.9;
}

/* ---------- Indicador "Sistema en línea" ---------- */
.estado-sistema {
    position: absolute;
    top: 16px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #15803d;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 20px;
    padding: 4px 11px;
    z-index: 12;
}

.punto-verde {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: latido 1.8s ease-in-out infinite;
}

@keyframes latido {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ---------- Frase rotativa ---------- */
.frase-rotativa {
    min-height: 1.3em;
    margin: 8px 0 0;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--azul-marca);
    letter-spacing: 0.5px;
}

.cursor-frase {
    font-style: normal;
    color: var(--azul-claro);
    animation: parpadeo 0.9s step-end infinite;
}

@keyframes parpadeo {
    50% { opacity: 0; }
}

/* ---------- Aviso de Bloq Mayús ---------- */
.caps-warning {
    margin-top: 7px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #92600a;
    background: #fef6e0;
    border: 1px solid #f5d888;
    border-radius: 10px;
    padding: 5px 12px;
    animation: entrada 0.25s ease both;
}

@keyframes entrada {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Transición de salida al enviar el login: la tarjeta se atenúa
   suavemente mientras se procesa (el botón con spinner sigue visible) */
.login-container.saliendo {
    animation: salida 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes salida {
    to {
        opacity: 0.55;
        transform: translateY(-8px) scale(0.97);
        filter: saturate(0.7);
    }
}

/* ---------- Logo flotante dentro de la tarjeta ---------- */
.login-container img {
    position: relative;
    display: block;
    margin: 0 auto 4px;
    width: 118px;
    z-index: 11;
    filter: drop-shadow(0 10px 18px rgba(0, 77, 153, 0.35));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* ---------- Encabezado ---------- */
.header-container {
    text-align: center;
    margin-bottom: 8px;
}

.header-container h1 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tinta);
    letter-spacing: 5px;
    margin: 0 0 6px;
    line-height: 1.4;
}

.sistema-titulo {
    display: block;
    font-family: 'Times New Roman', Times, serif;
    font-size: 52px;
    letter-spacing: 8px;
    background: linear-gradient(120deg, var(--azul-marca), var(--azul-claro), var(--azul-marca));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: brillo-texto 5s linear infinite;
}

@keyframes brillo-texto {
    to { background-position: 200% center; }
}

.sistema-subtitulo {
    color: var(--texto-suave);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0;
}

.login-container h2 {
    color: var(--tinta);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 18px 0 24px;
    position: relative;
}

/* Línea decorativa bajo "Iniciar Sesión" */
.login-container h2::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--azul-marca), var(--azul-claro));
}

/* ---------- Campos de texto ---------- */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--tinta);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.input-group {
    border-radius: 14px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(0, 140, 255, 0.18), 0 8px 20px rgba(0, 77, 153, 0.15);
    transform: translateY(-1px);
    border-radius: 14px;
}

/* Ícono al inicio del campo (sobrescribe bg-dark de Bootstrap) */
.input-group-text.bg-dark {
    background: linear-gradient(135deg, var(--azul-marca), #0066cc) !important;
    border: none;
    border-radius: 14px 0 0 14px;
    padding: 0 16px;
}

.input-group-text i {
    font-size: 1.15rem;
}

.form-control {
    border: 1.5px solid #dbe4f0;
    border-left: none;
    background-color: #f8fafd;
    padding: 13px 16px;
    font-size: 0.98rem;
    color: var(--tinta);
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.form-control::placeholder {
    color: #9aa8bc;
}

.form-control:focus {
    outline: none;
    box-shadow: none;
    border-color: var(--azul-claro);
    background-color: #fff;
}

.form-control:last-child {
    border-radius: 0 14px 14px 0;
}

/* ---------- Botón de mostrar/ocultar contraseña ---------- */
#togglePassword {
    border: 1.5px solid #dbe4f0;
    border-left: none;
    border-radius: 0 14px 14px 0;
    background-color: #f8fafd;
    color: var(--azul-marca);
    padding: 0 16px;
    transition: all 0.25s ease;
}

#togglePassword:hover {
    background-color: #eaf4ff;
    color: var(--azul-claro);
    border-color: #dbe4f0;
}

.input-group:focus-within #togglePassword {
    border-color: var(--azul-claro);
    background-color: #fff;
}

/* ---------- Botón principal ---------- */
.btn-primary {
    background: linear-gradient(135deg, var(--azul-marca) 0%, #0072e0 100%);
    border: none;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 77, 153, 0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Destello que recorre el botón al pasar el mouse */
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #003a75 0%, #005fb8 100%);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 77, 153, 0.5);
}

.btn-primary:hover::after {
    left: 130%;
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary i {
    margin-right: 8px;
}

/* ---------- Alertas de error ---------- */
.alert-danger {
    border: none;
    border-radius: 12px;
    background-color: #fdecec;
    color: #b3261e;
    font-size: 0.9rem;
    padding: 10px 14px;
    animation: sacudida 0.4s ease;
}

@keyframes sacudida {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}

.mt-2 {
    margin-top: 1.5rem !important;
}

/* ---------- Pie de la tarjeta ---------- */
.login-footer {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: #8b98ab;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a2a52;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 140, 255, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 140, 255, 0.8);
}

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
    .login-container {
        width: 90%;
        margin: 40px 0 50px;
        padding: 35px 24px 55px;
    }

    .login-container img {
        width: 96px;
    }

    .sistema-titulo {
        font-size: 40px;
        letter-spacing: 5px;
    }

    .header-container h1 {
        font-size: 0.8rem !important;
        letter-spacing: 3px;
    }

    .estado-sistema {
        top: 10px;
        right: 10px;
        font-size: 0.62rem;
        padding: 3px 8px;
    }

    /* Insignias reacomodadas en las esquinas, donde sí hay espacio libre */
    html::before { /* escudo */
        width: 120px;
        height: 120px;
        top: -25px;
        left: -30px;
    }

    html::after { /* candado */
        width: 85px;
        height: 85px;
        top: auto;
        bottom: -18px;
        left: 8%;
    }

    body::before { /* cámara */
        width: 150px;
        height: 150px;
        top: auto;
        bottom: -35px;
        right: -40px;
    }

    body::after { /* señal */
        width: 75px;
        height: 75px;
        top: 10px;
        right: 5%;
    }
}

/* ---------- Modo oscuro nocturno (11pm - 7am, activado por JS con la
   clase .modo-oscuro en <html>) ---------- */
.modo-oscuro body {
    background: linear-gradient(-45deg, #020a18, #04234d, #004d99, #0a3d77);
    background-size: 400% 400%;
    animation: gradientMove 20s ease infinite;
}

.modo-oscuro::before,
.modo-oscuro::after,
.modo-oscuro body::before,
.modo-oscuro body::after {
    background-color: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.18);
}

.modo-oscuro .login-container {
    background: rgba(13, 27, 48, 0.88);
    border-color: rgba(56, 189, 248, 0.2);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(0, 140, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.modo-oscuro .header-container h1,
.modo-oscuro .login-container h2,
.modo-oscuro .form-label {
    color: #e2eaf5;
}

.modo-oscuro .sistema-subtitulo {
    color: #8fa3bd;
}

.modo-oscuro .frase-rotativa {
    color: #7cc3ff;
}

.modo-oscuro .form-control {
    background-color: #10233f;
    border-color: #24405f;
    color: #e2eaf5;
}

.modo-oscuro .form-control::placeholder {
    color: #5f7591;
}

.modo-oscuro .form-control:focus {
    background-color: #142c4e;
    border-color: var(--azul-claro);
}

.modo-oscuro #togglePassword {
    background-color: #10233f;
    border-color: #24405f;
    color: #7cc3ff;
}

.modo-oscuro #togglePassword:hover {
    background-color: #142c4e;
    color: #a8d8ff;
}

.modo-oscuro .input-group:focus-within #togglePassword {
    background-color: #142c4e;
}

.modo-oscuro .estado-sistema {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
}

.modo-oscuro .caps-warning {
    color: #fbd77e;
    background: rgba(146, 96, 10, 0.2);
    border-color: rgba(245, 216, 136, 0.3);
}

.modo-oscuro .alert-danger {
    background-color: rgba(179, 38, 30, 0.18);
    color: #ff9d96;
}

.modo-oscuro .login-footer {
    color: #5f7591;
}
