File size: 21,143 Bytes
4343907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
<template>
  <div class="dashboard">
    <!-- Header Section -->
    <div class="dashboard-header">
      <div class="header-content">
        <div class="header-left">
          <h1 class="dashboard-title">SAAP Multi-Agent Dashboard</h1>
          <p class="dashboard-subtitle">Manage and monitor your AI agent ecosystem</p>
        </div>
        <div class="header-right">
          <div class="status-indicator">
            <div class="status-dot" :class="connectionStatus === 'connected' ? 'status-connected' : 'status-disconnected'"></div>
            <span class="status-text">{{ connectionStatus === 'connected' ? 'Connected' : 'Disconnected' }}</span>
          </div>
          <div class="agents-counter">
            <span class="counter-number">{{ systemStats.activeAgents }}</span>
            <span class="counter-label">AGENTS ACTIVE</span>
          </div>
        </div>
      </div>
    </div>

    <!-- Action Buttons -->
    <div class="action-section">
      <button class="action-button refresh-button" @click="refreshData">
        <ArrowPathIcon class="button-icon" />
        <span>Refresh</span>
      </button>
      <button class="action-button add-button" @click="showAddAgent = true">
        <PlusIcon class="button-icon" />
        <span>Add Agent</span>
      </button>
    </div>

    <!-- System Statistics -->
    <div class="stats-grid">
      <div class="stat-card">
        <div class="stat-icon-wrapper stat-icon-blue">
          <UserGroupIcon class="stat-icon" />
        </div>
        <div class="stat-content">
          <h3>{{ systemStats.totalAgents }}</h3>
          <p>Total Agents</p>
        </div>
      </div>
      
      <div class="stat-card">
        <div class="stat-icon-wrapper stat-icon-green">
          <ChartBarIcon class="stat-icon" />
        </div>
        <div class="stat-content">
          <h3>{{ systemStats.activeAgents }}</h3>
          <p>Active Agents</p>
        </div>
      </div>
      
      <div class="stat-card">
        <div class="stat-icon-wrapper stat-icon-orange">
          <ChatBubbleLeftIcon class="stat-icon" />
        </div>
        <div class="stat-content">
          <h3>{{ systemStats.totalMessages }}</h3>
          <p>Messages Today</p>
        </div>
      </div>
      
      <div class="stat-card">
        <div class="stat-icon-wrapper stat-icon-purple">
          <ClockIcon class="stat-icon" />
        </div>
        <div class="stat-content">
          <h3>{{ systemStats.averageResponseTime }}s</h3>
          <p>Avg Response Time</p>
        </div>
      </div>
    </div>

    <!-- Agents Grid -->
    <div class="agents-section">
      <div class="section-header">
        <h2>Active Agents</h2>
        <div class="view-toggle">
          <button 
            class="toggle-button" 
            :class="{ active: viewMode === 'grid' }"
            @click="viewMode = 'grid'"
          >
            <Squares2X2Icon class="toggle-icon" />
            Grid
          </button>
          <button 
            class="toggle-button" 
            :class="{ active: viewMode === 'list' }"
            @click="viewMode = 'list'"
          >
            <Bars3Icon class="toggle-icon" />
            List
          </button>
        </div>
      </div>

      <!-- Grid View -->
      <div v-if="viewMode === 'grid'" class="agents-grid">
        <AgentCard
          v-for="agent in agents"
          :key="agent.id"
          :agent="agent"
          @start="startAgent"
          @stop="stopAgent"
          @chat="openChat"
          @details="showAgentDetails"
        />
        
        <!-- Empty State -->
        <div v-if="agents.length === 0" class="empty-state">
          <div class="empty-state-content">
            <CpuChipIcon class="empty-icon" />
            <h3>No Agents Available</h3>
            <p>Start by adding your first AI agent to the platform.</p>
            <button class="empty-action-button" @click="showAddAgent = true">
              <PlusIcon class="button-icon" />
              Add First Agent
            </button>
          </div>
        </div>
      </div>

      <!-- List View -->
      <div v-if="viewMode === 'list'" class="agents-list">
        <div class="list-header">
          <div class="list-column">Name</div>
          <div class="list-column">Type</div>
          <div class="list-column">Status</div>
          <div class="list-column">Messages</div>
          <div class="list-column">Response Time</div>
          <div class="list-column">Actions</div>
        </div>
        
        <div
          v-for="agent in agents"
          :key="agent.id"
          class="list-row"
        >
          <div class="list-cell">
            <div class="agent-name-cell">
              <div 
                class="agent-avatar"
                :style="{ backgroundColor: agent.color || '#6B7280' }"
              >
                {{ agent.name?.charAt(0) || 'A' }}
              </div>
              <span>{{ agent.name }}</span>
            </div>
          </div>
          <div class="list-cell">
            <span class="agent-type-badge">{{ agent.type }}</span>
          </div>
          <div class="list-cell">
            <span 
              class="status-badge"
              :class="`status-${agent.status}`"
            >
              {{ agent.status }}
            </span>
          </div>
          <div class="list-cell">
            {{ agent.metrics?.messages_processed || 0 }}
          </div>
          <div class="list-cell">
            {{ agent.metrics?.average_response_time?.toFixed(2) || 0 }}s
          </div>
          <div class="list-cell">
            <div class="action-buttons">
              <button 
                v-if="agent.status !== 'active'"
                class="action-btn start-btn"
                @click="startAgent(agent)"
              >
                <PlayIcon class="action-icon" />
              </button>
              <button 
                v-if="agent.status === 'active'"
                class="action-btn stop-btn"
                @click="stopAgent(agent)"
              >
                <StopIcon class="action-icon" />
              </button>
              <button 
                class="action-btn chat-btn"
                @click="openChat(agent)"
              >
                <ChatBubbleLeftIcon class="action-icon" />
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Add Agent Modal -->
    <AddAgentModal 
      v-if="showAddAgent"
      @close="showAddAgent = false"
      @add="handleAddAgent"
    />

    <!-- Chat Modal -->
    <ChatModal
      v-if="showChat && selectedAgent"
      :agent="selectedAgent"
      @close="showChat = false"
    />

    <!-- Agent Details Modal -->
    <AgentDetailsModal
      v-if="showDetails && selectedAgent"
      :agent="selectedAgent"
      @close="showDetails = false"
      @update="handleAgentUpdate"
    />
  </div>
</template>

<script>
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import AgentCard from '../components/agent/AgentCard.vue'
import AddAgentModal from '../components/modals/AddAgentModal.vue'
import ChatModal from '../components/modals/ChatModal.vue'
import AgentDetailsModal from '../components/modals/AgentDetailsModal.vue'

// Icons from Heroicons
import { 
  ArrowPathIcon, 
  PlusIcon, 
  UserGroupIcon, 
  ChartBarIcon,
  ChatBubbleLeftIcon, 
  ClockIcon, 
  Squares2X2Icon, 
  Bars3Icon,
  CpuChipIcon, 
  PlayIcon, 
  StopIcon
} from '@heroicons/vue/24/outline'

export default {
  name: 'Dashboard',
  components: {
    AgentCard,
    AddAgentModal,
    ChatModal,
    AgentDetailsModal,
    ArrowPathIcon,
    PlusIcon,
    UserGroupIcon,
    ChartBarIcon,
    ChatBubbleLeftIcon,
    ClockIcon,
    Squares2X2Icon,
    Bars3Icon,
    CpuChipIcon,
    PlayIcon,
    StopIcon
  },
  setup() {
    const agents = ref([])
    const viewMode = ref('grid')
    const connectionStatus = ref('disconnected')
    const showAddAgent = ref(false)
    const showChat = ref(false)
    const showDetails = ref(false)
    const selectedAgent = ref(null)
    const loading = ref(false)

    const systemStats = reactive({
      totalAgents: 0,
      activeAgents: 0,
      totalMessages: 0,
      averageResponseTime: 0
    })

    // WebSocket connection
    let ws = null

    const connectWebSocket = () => {
      try {
        ws = new WebSocket('ws://localhost:8000/ws')
        
        ws.onopen = () => {
          connectionStatus.value = 'connected'
          console.log('βœ… WebSocket connected')
        }
        
        ws.onmessage = (event) => {
          const data = JSON.parse(event.data)
          handleWebSocketMessage(data)
        }
        
        ws.onclose = () => {
          connectionStatus.value = 'disconnected'
          console.log('❌ WebSocket disconnected')
          // Reconnect after 5 seconds
          setTimeout(connectWebSocket, 5000)
        }
        
        ws.onerror = (error) => {
          console.error('❌ WebSocket error:', error)
          connectionStatus.value = 'disconnected'
        }
      } catch (error) {
        console.error('❌ WebSocket connection failed:', error)
        connectionStatus.value = 'disconnected'
      }
    }

    const handleWebSocketMessage = (data) => {
      switch (data.type) {
        case 'agent_status_update':
          updateAgentInList(data.agent)
          break
        case 'system_stats':
          Object.assign(systemStats, data.stats)
          break
        case 'new_message':
          // Handle new message notifications
          break
        default:
          console.log('πŸ“¨ Unknown WebSocket message:', data)
      }
    }

    const updateAgentInList = (updatedAgent) => {
      const index = agents.value.findIndex(a => a.id === updatedAgent.id)
      if (index !== -1) {
        agents.value[index] = { ...agents.value[index], ...updatedAgent }
      }
    }

    const fetchAgents = async () => {
      try {
        loading.value = true
        console.log('πŸ”„ Fetching agents from API...')
        
        const response = await fetch('http://localhost:8000/api/v1/agents')
        console.log('πŸ“‘ Response status:', response.status)
        
        if (response.ok) {
          const data = await response.json()
          console.log('πŸ“Š Agents data:', data)
          agents.value = data
          updateSystemStats()
        } else {
          console.error('❌ API Error:', response.status, response.statusText)
          throw new Error(`API Error: ${response.status}`)
        }
      } catch (error) {
        console.error('❌ Error fetching agents:', error)
        // Keep existing mock data as fallback
        if (agents.value.length === 0) {
          agents.value = [
            {
              id: 'jane_alesi',
              name: 'Jane Alesi',
              type: 'Coordinator',
              status: 'active',
              color: '#8B5CF6',
              metrics: {
                messages_processed: 42,
                average_response_time: 1.2
              }
            },
            {
              id: 'john_alesi',
              name: 'John Alesi',
              type: 'Developer',
              status: 'inactive',
              color: '#14B8A6',
              metrics: {
                messages_processed: 23,
                average_response_time: 2.1
              }
            },
            {
              id: 'lara_alesi',
              name: 'Lara Alesi',
              type: 'Medical Expert',
              status: 'active',
              color: '#EC4899',
              metrics: {
                messages_processed: 15,
                average_response_time: 1.8
              }
            }
          ]
        }
        updateSystemStats()
      } finally {
        loading.value = false
      }
    }

    const fetchSystemStatus = async () => {
      try {
        console.log('πŸ”„ Fetching system status...')
        const response = await fetch('http://localhost:8000/api/v1/health')
        
        if (response.ok) {
          const data = await response.json()
          console.log('πŸ₯ Health data:', data)
          
          // Update system stats based on health data
          Object.assign(systemStats, {
            totalAgents: agents.value.length,
            activeAgents: agents.value.filter(a => a.status === 'active').length,
            totalMessages: agents.value.length * 15, // Mock calculation
            averageResponseTime: 1.8 // Mock data
          })
        }
      } catch (error) {
        console.error('❌ Error fetching system status:', error)
        updateSystemStats()
      }
    }

    const updateSystemStats = () => {
      systemStats.totalAgents = agents.value.length
      systemStats.activeAgents = agents.value.filter(a => a.status === 'active').length
      systemStats.totalMessages = agents.value.length * 15 // Mock
      systemStats.averageResponseTime = 1.8 // Mock
    }

    const refreshData = async () => {
      console.log('πŸ”„ Refreshing dashboard data...')
      await Promise.all([
        fetchAgents(),
        fetchSystemStatus()
      ])
    }

    const startAgent = async (agent) => {
      try {
        console.log(`πŸš€ Starting agent: ${agent.name}`)
        const response = await fetch(`http://localhost:8000/api/v1/agents/${agent.id}/start`, {
          method: 'POST'
        })
        
        if (response.ok) {
          const data = await response.json()
          console.log('βœ… Agent started:', data)
          // Update agent status immediately
          agent.status = 'active'
          updateSystemStats()
        } else {
          console.error('❌ Failed to start agent:', response.status)
        }
      } catch (error) {
        console.error('❌ Error starting agent:', error)
      }
    }

    const stopAgent = async (agent) => {
      try {
        console.log(`πŸ›‘ Stopping agent: ${agent.name}`)
        const response = await fetch(`http://localhost:8000/api/v1/agents/${agent.id}/stop`, {
          method: 'POST'
        })
        
        if (response.ok) {
          const data = await response.json()
          console.log('βœ… Agent stopped:', data)
          // Update agent status immediately
          agent.status = 'inactive'
          updateSystemStats()
        } else {
          console.error('❌ Failed to stop agent:', response.status)
        }
      } catch (error) {
        console.error('❌ Error stopping agent:', error)
      }
    }

    const openChat = (agent) => {
      selectedAgent.value = agent
      showChat.value = true
    }

    const showAgentDetails = (agent) => {
      selectedAgent.value = agent
      showDetails.value = true
    }

    const handleAddAgent = (newAgent) => {
      // Add agent logic handled in modal
      showAddAgent.value = false
      refreshData()
    }

    const handleAgentUpdate = (updatedAgent) => {
      // Update agent logic
      showDetails.value = false
      refreshData()
    }

    onMounted(async () => {
      console.log('πŸš€ Dashboard mounted - initializing...')
      await refreshData()
      connectWebSocket()
    })

    onUnmounted(() => {
      if (ws) {
        ws.close()
      }
    })

    return {
      agents,
      viewMode,
      connectionStatus,
      showAddAgent,
      showChat,
      showDetails,
      selectedAgent,
      loading,
      systemStats,
      refreshData,
      startAgent,
      stopAgent,
      openChat,
      showAgentDetails,
      handleAddAgent,
      handleAgentUpdate
    }
  }
}
</script>

<style scoped>
.dashboard {
  @apply min-h-screen bg-gray-50;
}

.dashboard-header {
  @apply bg-white border-b border-gray-200 px-6 py-4;
}

.header-content {
  @apply flex justify-between items-start max-w-7xl mx-auto;
}

.header-left {
  @apply space-y-1;
}

.dashboard-title {
  @apply text-2xl font-bold text-saap-gray-900;
}

.dashboard-subtitle {
  @apply text-sm text-saap-gray-600;
}

.header-right {
  @apply flex items-center space-x-6;
}

.status-indicator {
  @apply flex items-center space-x-2;
}

.status-dot {
  @apply w-2 h-2 rounded-full;
}

.status-connected {
  @apply bg-green-400;
}

.status-disconnected {
  @apply bg-red-400;
}

.status-text {
  @apply text-sm font-medium text-saap-gray-700;
}

.agents-counter {
  @apply text-right;
}

.counter-number {
  @apply block text-2xl font-bold text-saap-primary-600;
}

.counter-label {
  @apply text-xs font-medium text-saap-gray-500 uppercase tracking-wide;
}

.action-section {
  @apply px-6 py-4 bg-white border-b border-gray-200;
}

.action-section {
  @apply flex space-x-3 max-w-7xl mx-auto;
}

.action-button {
  @apply inline-flex items-center px-4 py-2 border border-gray-300 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.refresh-button {
  @apply text-saap-gray-700 hover:text-saap-gray-900 focus:ring-saap-gray-500;
}

.add-button {
  @apply bg-saap-primary-600 text-white border-saap-primary-600 hover:bg-saap-primary-700 focus:ring-saap-primary-500;
}

.button-icon {
  @apply w-4 h-4 mr-2;
}

.stats-grid {
  @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 px-6 py-6 max-w-7xl mx-auto;
}

.stat-card {
  @apply bg-white rounded-xl p-6 shadow-sm border border-gray-200 hover:shadow-md transition-shadow duration-200;
}

.stat-card {
  @apply flex items-center space-x-4;
}

.stat-icon-wrapper {
  @apply w-12 h-12 rounded-lg flex items-center justify-center;
}

.stat-icon-blue {
  @apply bg-saap-primary-100;
}

.stat-icon-green {
  @apply bg-saap-secondary-100;
}

.stat-icon-orange {
  @apply bg-saap-accent-100;
}

.stat-icon-purple {
  @apply bg-purple-100;
}

.stat-icon {
  @apply w-6 h-6;
}

.stat-icon-blue .stat-icon {
  @apply text-saap-primary-600;
}

.stat-icon-green .stat-icon {
  @apply text-saap-secondary-600;
}

.stat-icon-orange .stat-icon {
  @apply text-saap-accent-600;
}

.stat-icon-purple .stat-icon {
  @apply text-purple-600;
}

.stat-content h3 {
  @apply text-xl font-bold text-saap-gray-900 truncate;
}

.stat-content p {
  @apply text-sm text-saap-gray-600;
}

.agents-section {
  @apply px-6 py-6 max-w-7xl mx-auto;
}

.section-header {
  @apply flex justify-between items-center mb-6;
}

.section-header h2 {
  @apply text-xl font-semibold text-saap-gray-900;
}

.view-toggle {
  @apply flex bg-gray-100 rounded-lg p-1;
}

.toggle-button {
  @apply flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-all duration-200;
}

.toggle-button.active {
  @apply bg-white text-saap-primary-600 shadow-sm;
}

.toggle-button:not(.active) {
  @apply text-saap-gray-600 hover:text-saap-gray-900;
}

.toggle-icon {
  @apply w-4 h-4 mr-1.5;
}

.agents-grid {
  @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6;
}

.empty-state {
  @apply col-span-full;
}

.empty-state-content {
  @apply text-center py-12 px-4;
}

.empty-icon {
  @apply w-16 h-16 mx-auto text-saap-gray-400 mb-4;
}

.empty-state-content h3 {
  @apply text-lg font-medium text-saap-gray-900 mb-2;
}

.empty-state-content p {
  @apply text-saap-gray-600 mb-6;
}

.empty-action-button {
  @apply inline-flex items-center px-4 py-2 bg-saap-primary-600 text-white text-sm font-medium rounded-lg hover:bg-saap-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-saap-primary-500 transition-colors duration-200;
}

.agents-list {
  @apply bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden;
}

.list-header {
  @apply grid grid-cols-6 gap-4 px-6 py-3 bg-gray-50 border-b border-gray-200 text-xs font-medium text-saap-gray-500 uppercase tracking-wide;
}

.list-row {
  @apply grid grid-cols-6 gap-4 px-6 py-4 border-b border-gray-100 hover:bg-gray-50 transition-colors duration-200;
}

.list-row:last-child {
  @apply border-b-0;
}

.list-column, .list-cell {
  @apply flex items-center;
}

.agent-name-cell {
  @apply flex items-center space-x-3;
}

.agent-avatar {
  @apply w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-medium;
}

.agent-type-badge {
  @apply px-2 py-1 text-xs font-medium bg-gray-100 text-saap-gray-700 rounded-full;
}

.status-badge {
  @apply px-2 py-1 text-xs font-medium rounded-full;
}

.status-active {
  @apply bg-green-100 text-green-800;
}

.status-inactive {
  @apply bg-gray-100 text-saap-gray-800;
}

.status-starting {
  @apply bg-yellow-100 text-yellow-800;
}

.action-buttons {
  @apply flex items-center space-x-2;
}

.action-btn {
  @apply p-1.5 rounded-lg border border-gray-300 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-200;
}

.start-btn {
  @apply hover:border-green-300 focus:ring-green-500;
}

.start-btn .action-icon {
  @apply w-4 h-4 text-green-600;
}

.stop-btn {
  @apply hover:border-red-300 focus:ring-red-500;
}

.stop-btn .action-icon {
  @apply w-4 h-4 text-red-600;
}

.chat-btn {
  @apply hover:border-saap-primary-300 focus:ring-saap-primary-500;
}

.chat-btn .action-icon {
  @apply w-4 h-4 text-saap-primary-600;
}

.action-icon {
  @apply w-4 h-4;
}
</style>