/* ================================
   CSS: Glassmorphism Elegante
   Login PER - Moodle
   ================================ */

/* ---- RESET & BASE ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../img/fondo.jpg') no-repeat center center/cover;
    position: relative;
}

/* ---- OVERLAY DE FONDO ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.75) 0%, 
        rgba(30, 58, 138, 0.65) 50%,
        rgba(37, 99, 235, 0.55) 100%
    );
    z-index: 0;
}

/* ---- WRAPPER PRINCIPAL ---- */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    animation: fadeSlideUp 0.8s ease-out;
}

/* ---- CONTENEDOR GLASSMORPHISM ---- */
.login-container {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-radius: 32px;
    padding: 2.5rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 30px 50px -20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* ---- BORDE BRILLANTE ANIMADO ---- */
.login-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 32px;
    background: linear-gradient(45deg, 
        rgba(37, 99, 235, 0.3),
        rgba(147, 197, 253, 0.1),
        rgba(37, 99, 235, 0.3)
    );
    z-index: -1;
    animation: borderGlow 4s ease-in-out infinite;
    background-size: 300% 300%;
}

/* ---- ICONO ---- */
.login-icon {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-icon i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 50%;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.login-icon i:hover {
    transform: scale(1.05);
}

/* ---- TÍTULOS ---- */
.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.login-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 300;
    letter-spacing: 0.3px;
}

/* ---- ALERTAS ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    backdrop-filter: blur(8px);
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

/* ---- FORMULARIO ---- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    position: relative;
}

/* ---- INPUTS ---- */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(37, 99, 235, 0.6);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-wrapper .input-icon {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    padding: 0 0 0 1rem;
    transition: color 0.3s ease;
}

.input-wrapper:focus-within .input-icon {
    color: rgba(147, 197, 253, 0.8);
}

.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 0.75rem;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 300;
}

.input-wrapper input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px rgba(30, 58, 138, 0.5) inset !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* ---- TOGGLE PASSWORD ---- */
.toggle-password {
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0 1rem 0 0;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ---- BOTÓN ---- */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    border: none;
    border-radius: 16px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s ease;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.35);
}

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

.login-btn .btn-icon {
    transition: transform 0.3s ease;
}

.login-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ---- FOOTER ---- */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.forgot-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.forgot-link:hover {
    color: #93c5fd;
}

/* ---- EXTRA INFO ---- */
.login-extra {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-extra p {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    margin: 0.15rem 0;
    font-weight: 300;
}

.login-extra .small {
    font-size: 0.65rem;
}

/* ---- PARTÍCULAS DECORATIVAS ---- */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: floatParticle 20s infinite linear;
}

.particles span:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; animation-duration: 18s; }
.particles span:nth-child(2) { top: 30%; left: 90%; animation-delay: 2s; animation-duration: 22s; width: 6px; height: 6px; }
.particles span:nth-child(3) { top: 70%; left: 10%; animation-delay: 4s; animation-duration: 20s; }
.particles span:nth-child(4) { top: 85%; left: 85%; animation-delay: 1s; animation-duration: 24s; width: 8px; height: 8px; }
.particles span:nth-child(5) { top: 50%; left: 3%; animation-delay: 3s; animation-duration: 16s; }
.particles span:nth-child(6) { top: 20%; left: 70%; animation-delay: 5s; animation-duration: 26s; width: 5px; height: 5px; }
.particles span:nth-child(7) { top: 60%; left: 95%; animation-delay: 0.5s; animation-duration: 19s; }
.particles span:nth-child(8) { top: 40%; left: 45%; animation-delay: 2.5s; animation-duration: 21s; width: 7px; height: 7px; }

@keyframes floatParticle {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
    25% { transform: translateY(-30vh) translateX(10px) scale(1.2); opacity: 0.8; }
    50% { transform: translateY(-60vh) translateX(-10px) scale(0.8); opacity: 0.4; }
    75% { transform: translateY(-90vh) translateX(15px) scale(1.1); opacity: 0.7; }
    100% { transform: translateY(-120vh) translateX(-5px) scale(1); opacity: 0; }
}

/* ---- ANIMACIONES ---- */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
    .login-wrapper {
        padding: 1rem;
    }
    
    .login-container {
        padding: 1.75rem 1.25rem;
        border-radius: 24px;
    }
    
    .login-title {
        font-size: 1.4rem;
    }
    
    .login-icon i {
        font-size: 2.2rem;
        padding: 0.75rem;
    }
    
    .input-wrapper input {
        padding: 0.75rem 1rem 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .login-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* ---- SEGURIDAD: Desactivar zoom en inputs en iOS ---- */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    input[type="text"],
    input[type="password"] {
        font-size: 16px !important;
    }
}