/* ============================================
   Global Agent Communication Sidebar
   ============================================ */

.agent-sidebar {
    position: fixed;
    right: -400px;
    top: 80px;
    width: 380px;
    height: calc(100vh - 100px);
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1040; /* Aligned with z-index system (modal-backdrop level) */
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl, 12px) 0 0 var(--radius-xl, 12px);
}

.agent-sidebar.open {
    right: 0;
}

.agent-sidebar-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #31B2E0 0%, #4ECDC4 100%);
    color: white;
    border: none;
    padding: 1rem 0.75rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md, 8px) 0 0 var(--radius-md, 8px);
    cursor: pointer;
    z-index: 1050; /* Aligned with z-index system (modal level) */
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.agent-sidebar-toggle:hover {
    transform: translateY(-50%) translateX(-5px);
    box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.3);
}

.agent-sidebar-toggle:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.agent-sidebar-toggle .badge {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.125rem 0.25rem;
}

.agent-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #31B2E0 0%, #4ECDC4 100%);
    color: white;
    border-radius: var(--radius-xl, 12px) 0 0 0;
}

.agent-sidebar-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.agent-sidebar-header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.agent-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.agent-status-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md, 8px);
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
}

.agent-status-item:hover {
    transform: translateX(-4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.agent-status-item.active {
    border-left-color: #10b981;
}

.agent-status-item.busy {
    border-left-color: #f59e0b;
}

.agent-status-item.offline {
    border-left-color: #6c757d;
}

.agent-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.agent-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-status-badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
}

/* WCAG AA compliant status badges */
.agent-status-badge.active {
    background: #d1fae5;
    color: #065f46;  /* Contrast ratio: 7.5:1 */
}

.agent-status-badge.busy {
    background: #fef3c7;
    color: #78350f;  /* Darker for better contrast: 7.2:1 */
}

.agent-status-badge.offline {
    background: #e5e7eb;
    color: #1f2937;  /* Darker for better contrast: 10.5:1 */
}

/* Dark mode status badges */
body.dark-mode .agent-status-badge.active {
    background: #065f46;
    color: #d1fae5;
}

body.dark-mode .agent-status-badge.busy {
    background: #78350f;
    color: #fef3c7;
}

body.dark-mode .agent-status-badge.offline {
    background: #374151;
    color: #e5e7eb;
}

.agent-activity {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.agent-activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Dark mode text */
body.dark-mode .agent-name {
    color: var(--text-primary-dark);
}

body.dark-mode .agent-activity,
body.dark-mode .agent-activity-time {
    color: var(--text-secondary-dark);
}

/* Dark mode - ensure icons in agent sidebar are white */
body.dark-mode .agent-sidebar i,
body.dark-mode .agent-name i,
body.dark-mode .agent-sidebar-header i,
body.dark-mode .agent-sidebar-footer i {
    color: #ffffff !important;
}

.agent-sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.agent-sidebar-footer button {
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .agent-sidebar {
        width: 100%;
        right: -100%;
        top: 60px;
        height: calc(100vh - 60px);
        border-radius: 0;
    }

    .agent-sidebar-toggle {
        right: 1rem;
        top: auto;
        bottom: 1rem;
        transform: none;
        border-radius: 50%;
        padding: 1rem;
        min-width: 56px;
        min-height: 56px;
    }

    .agent-sidebar-toggle:hover {
        transform: scale(1.05);
    }

    .agent-status-item {
        padding: 1rem;
    }

    .agent-sidebar-footer {
        padding: 1rem;
    }

    .agent-sidebar-footer .btn {
        width: 100%;
    }
}

/* Ensure touch targets are at least 44x44px */
@media (max-width: 768px) {
    .btn,
    button,
    a.nav-link,
    .agent-sidebar-toggle {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    /* Larger text for mobile readability */
    body {
        font-size: 16px;
    }

    .metric-card {
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

