/* Dashboard Layout */
.dashboard-body {
    margin: 0;
    padding: 0;
    background: #f5f7fa;
}

#dashboard-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .brand-icon {
    font-size: 1.75rem;
    color: #6366f1;
}

.sidebar-header .brand-name {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: white;
    border-left: 3px solid #6366f1;
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
}

.nav-item .badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-item .badge-notification {
    margin-left: auto;
    background: #ef4444;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.icon-btn:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 2rem;
}

.welcome-card {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.welcome-text h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.welcome-text p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.welcome-card .btn {
    background: white;
    color: var(--primary-color);
}

.welcome-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.human-color {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.stat-icon.ai-color {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon.insight-color {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon.opportunity-color {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.neutral {
    color: var(--text-secondary);
}

/* Dual Layer Section */
.dual-layer-section {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.view-all:hover {
    text-decoration: underline;
}

.layer-toggle {
    display: flex;
    gap: 0.5rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.layer-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.layer-btn:hover {
    color: var(--text-primary);
}

.layer-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Network Canvas */
.network-canvas-wrapper {
    position: relative;
    background: #f9fafb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.network-canvas {
    width: 100%;
    height: 500px;
    display: block;
}

.network-legend {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.human-dot {
    background: #3b82f6;
}

.legend-dot.ai-dot {
    background: #8b5cf6;
}

.legend-line {
    width: 20px;
    height: 2px;
}

.legend-line.human-line {
    background: #3b82f6;
}

.legend-line.ai-line {
    background: #8b5cf6;
}

/* Two Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Activity Section */
.activity-section,
.agents-section {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.activity-item:hover {
    background: #f3f4f6;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.activity-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.activity-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.activity-action:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

/* Agent Cards */
.agent-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agent-card {
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.agent-card:hover {
    border-color: var(--primary-color);
    background: white;
}

.agent-card.active {
    border-color: var(--primary-color);
    background: white;
}

.agent-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
    position: relative;
}

.agent-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
}

.agent-status.online {
    background: #10b981;
}

.agent-status.idle {
    background: #f59e0b;
}

.agent-status.offline {
    background: #6b7280;
}

.agent-info {
    margin-bottom: 1rem;
}

.agent-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.agent-specialty {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.agent-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.agent-stat {
    display: flex;
    flex-direction: column;
}

.agent-stat .stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.agent-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .welcome-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .layer-toggle {
        flex-wrap: wrap;
    }
    
    .network-canvas {
        height: 300px;
    }
}

/* AI Insights Section */
.insights-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.insights-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.insights-section .section-header h3 {
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.insights-section .section-header h3 i {
    color: #fbbf24;
    margin-right: 0.5rem;
}

.insights-controls {
    display: flex;
    gap: 0.5rem;
}

.insights-container {
    min-height: 200px;
}

.loading-state {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #8b5cf6;
}

.insight-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.insight-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.insight-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    margin: 0;
}

.insight-type {
    background: #8b5cf6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 500;
}

.insight-type.pattern {
    background: #10b981;
}

.insight-type.recommendation {
    background: #3b82f6;
}

.insight-type.discovery {
    background: #f59e0b;
}

.insight-content {
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.insight-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #6b7280;
}

.insight-sources {
    display: flex;
    gap: 0.5rem;
}

.insight-source {
    background: #e5e7eb;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.insight-timestamp {
    font-style: italic;
}

.insight-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.insight-action {
    background: none;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.insight-action:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.insight-action.helpful {
    color: #10b981;
    border-color: #10b981;
}

.insight-action.helpful:hover {
    background: #ecfdf5;
}

.sleep-schedule-status {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.sleep-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sleep-indicator i {
    color: #fbbf24;
}

.next-processing {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.empty-insights {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.empty-insights i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.insights-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.insight-stat {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.insight-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.insight-stat-label {
    font-size: 0.8rem;
    color: #6b7280;
}