/**
 * Panel de Presencias - Usuarios Online
 * Diseño tipo "radar" con presencias animadas
 */

/* Contador clickable */
.online-counter {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.online-counter:hover {
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
}

.online-counter.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}

/* Panel principal */
.online-panel {
    position: fixed;
    top: 60px;
    right: 10px;
    width: 320px;
    max-height: 70vh;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(99, 102, 241, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 99999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.online-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header con efecto radar */
.online-panel-header {
    position: relative;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    overflow: hidden;
}

.online-panel-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: radar-pulse 3s ease-out infinite;
}

@keyframes radar-pulse {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.online-panel-title {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

.online-panel-title .radar-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.8), 0 0 40px rgba(16, 185, 129, 0.3); }
}

.online-panel-title .radar-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.online-panel-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.online-panel-title .online-stats {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

/* Lista de usuarios */
.online-panel-list {
    max-height: calc(70vh - 120px);
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.online-panel-list::-webkit-scrollbar { width: 4px; }
.online-panel-list::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 2px;
}

/* Card de usuario */
.online-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: card-slide-in 0.4s ease backwards;
}

.online-user-card:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.online-user-card:nth-child(1) { animation-delay: 0.05s; }
.online-user-card:nth-child(2) { animation-delay: 0.1s; }
.online-user-card:nth-child(3) { animation-delay: 0.15s; }
.online-user-card:nth-child(4) { animation-delay: 0.2s; }
.online-user-card:nth-child(5) { animation-delay: 0.25s; }
.online-user-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes card-slide-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Avatar */
.online-user-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.online-user-avatar .avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    position: relative;
    overflow: hidden;
}

.online-user-avatar .avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Colores por rol */
.online-user-card[data-role="GM"] .avatar-circle {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

.online-user-card[data-role="admin"] .avatar-circle {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.online-user-card[data-role="user"] .avatar-circle {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.online-user-card[data-role="guest"] .avatar-circle {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 0 10px rgba(100, 116, 139, 0.3);
}

/* Indicador de estado */
.online-user-avatar .status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 3px solid rgba(15, 23, 42, 0.95);
    border-radius: 50%;
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Info del usuario */
.online-user-info {
    flex: 1;
    min-width: 0;
}

.online-user-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.online-user-name .role-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.gm {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.role-badge.admin {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.role-badge.user {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.role-badge.guest {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.online-user-name .device-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.4);
}

.online-user-name .device-icon svg {
    width: 14px;
    height: 14px;
}

.online-user-page {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

.online-user-page svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* Card para visitantes anónimos */
.online-user-card.anonymous {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.1) 0%, rgba(71, 85, 105, 0.05) 100%);
    border-style: dashed;
}

.online-user-card.anonymous .avatar-circle svg {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.6);
}

/* Estado vacío */
.online-panel-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.online-panel-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.online-panel-empty p {
    font-size: 14px;
    margin: 0;
}

/* Footer */
.online-panel-footer {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.online-panel-footer .live-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: live-blink 1.5s ease-in-out infinite;
}

@keyframes live-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 400px) {
    .online-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }
}
