/* --- Variables y Estilos Base --- */
:root {
    /* --- COLORES AJUSTADOS --- */
    --primary-color: #3d9a4c; /* Verde suavizado y más profesional */
    --secondary-color: #0077b6; /* Azul marino de "Intercomunicaciones" */
    --text-color: #343a40; /* Gris oscuro para mejor contraste */
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* --- Animación de Fondo --- */
.bg-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}
.bg-animation span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: move 25s linear infinite;
    bottom: -150px;
}
.bg-animation span:nth-child(1) { left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.bg-animation span:nth-child(2) { left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.bg-animation span:nth-child(3) { left: 70%; width: 120px; height: 120px; animation-delay: 4s; }
.bg-animation span:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.bg-animation span:nth-child(5) { left: 65%; width: 20px; height: 20px; animation-delay: 0s; }
.bg-animation span:nth-child(6) { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }
.bg-animation span:nth-child(7) { left: 35%; width: 150px; height: 150px; animation-delay: 7s; }
.bg-animation span:nth-child(8) { left: 50%; width: 25px; height: 25px; animation-delay: 15s; animation-duration: 45s; }
.bg-animation span:nth-child(9) { left: 20%; width: 15px; height: 15px; animation-delay: 2s; animation-duration: 35s; }
.bg-animation span:nth-child(10) { left: 85%; width: 150px; height: 150px; animation-delay: 0s; animation-duration: 11s; }

@keyframes move {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; border-radius: 0; }
    100% { transform: translateY(-1000px) rotate(720deg); opacity: 0; border-radius: 50%; }
}

/* --- Contenedor del Formulario --- */
.login-container {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-container .avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.login-container .avatar i {
    font-size: 2.5em;
    color: #fff;
}

.login-container h2 {
    color: var(--text-color);
    margin: 0 0 25px;
    font-weight: 600;
}

/* --- Campos del Formulario con Animación Corregida --- */
.input-group {
    position: relative;
    margin-bottom: 25px;
    text-align: left;
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1em;
    color: var(--text-color);
    background: #f9f9f9;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 10px rgba(61, 154, 76, 0.2);
}

.input-group label {
    position: absolute;
    left: 18px;
    top: 50%;
    /* Estado inicial: centrado verticalmente */
    transform: translateY(-50%); 
    color: #999;
    /* ¡Aquí está la magia de la animación! */
    transition: all 0.3s ease;
    pointer-events: none; /* Evita que el label bloquee clics en el input */
    background: transparent;
    padding: 0 5px;
}

/* 
  ESTADO ANIMADO: El label se mueve si el input está enfocado O si ya tiene texto.
  - :focus -> cuando el usuario hace clic
  - :not(:placeholder-shown) -> cuando el usuario escribe (el placeholder desaparece)
*/
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    color: var(--primary-color);
    /* Estado final: movido hacia arriba y más pequeño */
    transform: translateY(-150%) scale(0.8);
    background: #fff; /* Fondo para que no se vea el texto de abajo */
    padding: 0 5px;
    z-index: 1; /* Asegura que el label quede por encima del borde del input */
}

/* --- Botón --- */
.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(61, 154, 76, 0.4);
}
.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(61, 154, 76, 0.5);
}
.btn-login:active {
    transform: translateY(-1px);
}

/* --- Mensajes de Alerta --- */
.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 10px;
    color: white;
    text-align: center;
    animation: fadeIn 0.5s;
}
.alert-success { background-color: #28a745; }
.alert-danger { background-color: #dc3545; }
.alert-warning { background-color: #ffc107; color: #212529; }
.alert-info { background-color: #17a2b8; }

/* --- Enlace de Registro --- */
.register-link {
    margin-top: 20px;
    font-size: 0.9em;
    color: var(--text-color);
}
.register-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.register-link a:hover {
    text-decoration: underline;
}

/* --- Estilos para la imagen dentro del avatar --- */
.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}