/**
 * EasyDesktop - Lock Screen Styles
 * 
 * @author Alberto Luque Rivas
 * @version 1.0.0
 */

/* ============================================
   Lock Screen Container
   ============================================ */
#easydesktop-lockscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999; /* Alto z-index para estar encima de todo */
    z-index: var(--ed-z-lockscreen, 99999);
    display: none; /* Por defecto oculto */
    align-items: center;
    justify-content: center;
    pointer-events: auto !important; /* Siempre recibir eventos cuando está visible */
}

/* Cuando no tiene la clase hidden, mostrar */
#easydesktop-lockscreen:not(.easydesktop-hidden) {
    display: flex !important;
    visibility: visible !important;
}

#lockscreen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Animated background effect */
#lockscreen-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 120, 212, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(156, 39, 176, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 188, 212, 0.1) 0%, transparent 70%);
    animation: lockscreen-bg 20s ease-in-out infinite;
}

@keyframes lockscreen-bg {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ============================================
   Lock Screen Content
   ============================================ */
#lockscreen-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    text-align: center;
    animation: ed-fade-in 0.5s ease forwards;
}

/* ============================================
   Time Display
   ============================================ */
#lockscreen-time {
    font-size: 96px;
    font-weight: 200;
    color: white;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

#lockscreen-date {
    font-size: 24px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 60px;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}

/* ============================================
   User Info
   ============================================ */
#lockscreen-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

/* Avatar container */
#lockscreen-user .user-avatar {
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cualquier imagen dentro del avatar (incluye las de Form::showphoto) */
#lockscreen-user .user-avatar img,
#lockscreen-user .user-avatar-img,
#lockscreen-user img.user-avatar-img {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Avatar con icono (fallback sin foto) */
#lockscreen-user .user-avatar-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#lockscreen-user .user-avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#lockscreen-user .user-avatar-icon i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.8);
}

#lockscreen-user span {
    font-size: 24px;
    font-weight: 400;
    color: white;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}

/* ============================================
   PIN Input
   ============================================ */
#lockscreen-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

#lockscreen-pin-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

#lockscreen-pin-dots {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all var(--ed-transition-fast);
    box-sizing: border-box;
}

.pin-dot.filled {
    width: 16px !important;
    height: 16px !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

/* ============================================
   Numpad
   ============================================ */
#lockscreen-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
}

#lockscreen-numpad button {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: all var(--ed-transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#lockscreen-numpad button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

#lockscreen-numpad button:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

#lockscreen-numpad button[data-num="clear"],
#lockscreen-numpad button[data-num="enter"] {
    font-size: 20px;
}

#lockscreen-numpad button[data-num="enter"] {
    background: var(--ed-primary);
}

#lockscreen-numpad button[data-num="enter"]:hover {
    background: var(--ed-primary-hover);
}

/* ============================================
   Error Message
   ============================================ */
#lockscreen-error {
    margin-top: 16px;
    padding: 12px 24px;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    border-radius: 8px;
    color: #ff6b6b;
    font-size: 14px;
    animation: ed-shake 0.5s ease;
}

/* ============================================
   Lock Screen Animations
   ============================================ */
#easydesktop-lockscreen.unlocking #lockscreen-content {
    animation: lockscreen-unlock 0.5s ease forwards;
}

@keyframes lockscreen-unlock {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

#easydesktop-lockscreen.locking {
    animation: ed-fade-in 0.3s ease forwards;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    #lockscreen-time {
        font-size: 72px;
    }
    
    #lockscreen-date {
        font-size: 20px;
        margin-bottom: 40px;
    }
    
    #lockscreen-user img {
        width: 80px;
        height: 80px;
    }
    
    #lockscreen-user span {
        font-size: 20px;
    }
    
    #lockscreen-numpad button {
        width: 70px;
        height: 70px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    #lockscreen-content {
        padding: 24px;
    }
    
    #lockscreen-time {
        font-size: 56px;
    }
    
    #lockscreen-date {
        font-size: 16px;
        margin-bottom: 32px;
    }
    
    #lockscreen-user img {
        width: 64px;
        height: 64px;
    }
    
    #lockscreen-user span {
        font-size: 18px;
    }
    
    #lockscreen-numpad {
        gap: 8px;
    }
    
    #lockscreen-numpad button {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }
    
    .pin-dot {
        width: 12px;
        height: 12px;
    }
    
    .pin-dot.filled {
        width: 14px !important;
        height: 14px !important;
    }
}

/* ============================================
   Accessibility - High Contrast
   ============================================ */
@media (prefers-contrast: high) {
    #lockscreen-overlay {
        background: #000;
    }
    
    #lockscreen-numpad button {
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid white;
    }
    
    .pin-dot {
        border-width: 3px;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    #lockscreen-overlay::before,
    #lockscreen-content,
    #lockscreen-numpad button,
    .pin-dot {
        animation: none;
        transition: none;
    }
}
