/* Agent Interface Styles - Minimalist Zen Design */

/* SVG Icon Styles for Monochrome Design */
.action-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.source-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    display: inline-block;
    vertical-align: middle;
    opacity: 0.8;
}

.share-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    display: inline-block;
    vertical-align: middle;
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.error-icon svg {
    width: 32px;
    height: 32px;
    opacity: 0.7;
    color: var(--color-error, #ef4444);
}

.action-link:hover .action-icon {
    opacity: 1;
}

.source-type-button.active .source-icon {
    opacity: 1;
}

/* Avatar Type Selector and Preview Styles */
.avatar-type-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border, #e1e5e9);
    border-radius: 6px;
    background-color: var(--color-background, #ffffff);
    color: var(--color-text, #2d3748);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-type-selector:focus {
    outline: none;
    border-color: var(--color-primary, #60A5FA);
    box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.1);
}

.avatar-preview-container {
    margin-top: 12px;
    padding: 12px;
    background-color: var(--color-background-secondary, #f8f9fa);
    border: 1px solid var(--color-border, #e1e5e9);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-preview-container label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary, #718096);
    margin: 0;
    min-width: 60px;
}

.avatar-preview {
    width: 50px !important;
    height: 50px !important;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--color-border, #e1e5e9);
    background-color: var(--color-background, #ffffff);
}

/* Agent Avatar Styles - Support both text and image avatars */
.agent-avatar, .agent-detail-avatar, .chat-avatar, .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--color-background, #ffffff);
    background: linear-gradient(135deg, var(--color-primary, #60A5FA) 0%, #3B82F6 100%);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.agent-detail-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.message-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* Ensure images fit properly in avatar containers */
.agent-avatar img, 
.agent-detail-avatar img, 
.chat-avatar img, 
.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.agents-layout {
    display: grid;
    grid-template-columns: 320px 1fr 420px; /* Left | Chat(Middle) | Agent List(Right) */
    grid-template-areas: "sessions chat agents";
    gap: var(--space-lg); /* Reduced spacing between panels for tighter layout */
    height: calc(100vh - 240px); /* Adjusted for reduced header height */
    margin: 0; /* Clean margins */
}

.left-panel, .center-panel, .right-panel {
    background: var(--color-card-background);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle); /* Ultra-subtle shadow */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.left-panel { grid-area: sessions; } /* No change - Session Management stays left */
.center-panel { 
    grid-area: agents;  /* Move Agent Grid to right position */
    order: 3;
}
.right-panel { 
    grid-area: chat;    /* Move to middle for chat display */
    order: 2;
}

/* Convert right-panel from agent details to chat interface */
.right-panel .agent-details {
    display: none; /* Hide original agent details */
}

.right-panel .chat-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Reuse existing chat modal styles */
}

.left-panel:hover, .center-panel:hover, .right-panel:hover {
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.panel-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
    color: var(--color-text);
    flex-shrink: 0;
    background: var(--color-background);
    letter-spacing: -0.01em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

/* Left Panel Styles - Clean and purposeful */
.left-panel {
    display: flex;
    flex-direction: column;
}

.agent-selector {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--color-border-subtle);
}

.selector-dropdown {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
    font-size: 0.875rem;
    font-family: var(--font-primary);
    color: var(--color-text);
    margin-bottom: var(--space-lg);
    transition: all 0.2s ease;
}

.selector-dropdown:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.create-btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.create-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.create-btn:active {
    transform: translateY(0);
}

/* Create button in panel header */
.panel-header .create-btn {
    width: auto;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Quick Actions - Zen-inspired navigation */
.quick-actions {
    padding: var(--space-lg) var(--space-xl);
    flex: 1;
    overflow-y: auto;
}

.quick-actions h3 {
    font-size: 0.75rem; /* 12px */
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-lg);
    color: var(--color-text-light);
    letter-spacing: 0.025em;
}

.action-link {
    display: block;
    padding: var(--space-md) 0;
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--color-border-subtle);
    font-weight: var(--font-weight-normal);
}

.action-link:hover {
    color: var(--color-text);
    transform: translateX(4px);
}

.action-link:last-child {
    border-bottom: none;
}

/* Center Panel Styles - Clean and functional */
.agents-toolbar {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex-shrink: 0;
    background: var(--color-background);
}

.search-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--space-md);
}


.search-with-filter {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-background);
    transition: all 0.2s ease;
    position: relative;
}

.search-with-filter:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.filter-icon-btn {
    padding: 8px;
    height: 36px;
    width: 36px;
    border: none;
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.filter-icon-btn:hover {
    color: var(--color-text);
    background: var(--color-hover);
}

.filter-icon-btn.active {
    color: #F5910B;
}

.group-filter {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 200px;
    background: rgba(42, 48, 60, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    font-size: 14px;
    font-family: var(--font-primary);
    overflow: hidden;
    padding: 8px 0;
}

.group-filter.hidden {
    display: none;
}

.filter-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #ffffff;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.filter-option.active {
    background-color: rgba(96, 165, 250, 0.15);
    border-left: 3px solid #60A5FA;
    color: #ffffff;
}

.filter-option.active::after {
    content: "✓";
    color: #60A5FA;
    font-weight: 600;
    font-size: 12px;
}

.search-input {
    flex: 1;
    padding: 8px 16px;
    height: 36px;
    border: none;
    font-size: 14px;
    font-family: var(--font-primary);
    background: transparent;
    color: var(--color-text);
    transition: all 0.2s ease;
    font-weight: var(--font-weight-normal);
    width: 100%;
}

.search-input:focus {
    outline: none;
}

/* Ensure proper keyboard navigation for the new two-row layout */
.search-row:focus-within {
    border-radius: var(--radius-md);
}


.search-input::placeholder {
    color: var(--color-text-subtle);
}

/* Create Agent Icon Button in Search Row */
.create-agent-icon-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
}

.create-agent-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    color: white;
}

/* Session Toolbar Styles */
.session-toolbar {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex-shrink: 0;
    background: var(--color-background);
}

.session-search-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--space-md);
}

.session-search-input {
    flex: 1;
    padding: 8px 16px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-primary);
    background: var(--color-card-background);
    color: var(--color-text);
    transition: all 0.2s ease;
    font-weight: var(--font-weight-normal);
}

.session-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.session-search-input::placeholder {
    color: var(--color-text-subtle);
}

.new-session-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    background: var(--color-card-background);
    color: var(--color-text);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-session-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.new-session-btn svg {
    width: 16px;
    height: 16px;
    fill: white;
    color: white;
}

.new-session-btn:hover svg {
    fill: white;
    color: white;
}

.create-agent-icon-btn:hover svg {
    fill: white;
    color: white;
}

/* Session Item Styles */
.session-item {
    padding: 3px;
    background: var(--color-card-background);
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xs);
}

.session-title {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
    margin-right: var(--space-sm);
}

.session-timestamp {
    font-size: 11px;
    color: var(--color-text-secondary);
    opacity: 0.8;
    font-style: italic;
    white-space: nowrap;
}

.session-preview {
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-btn {
    padding: 3px var(--space-md);
    height: 24px;
    border: 1px solid var(--color-border);
    background: var(--color-card-background);
    color: var(--color-text-light);
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: var(--font-weight-medium);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.filter-btn:hover {
    border-color: var(--color-text);
    color: var(--color-text);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--color-primary);
    color: var(--color-background);
    border-color: var(--color-primary);
}

.agents-grid {
    padding: var(--space-md) var(--space-lg);
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-md);
    align-content: start;
    /* Enable smooth scrolling */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
    /* Smooth height transitions when cards expand/collapse */
    transition: min-height 0.3s ease;
}

/* Agent Card Styles - Zen minimalism */
.agent-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    background: var(--color-card-background);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow-subtle);
}

.agent-card:hover {
    border-color: var(--color-text-light);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.agent-card.selected {
    border-color: var(--color-primary);
    background: #1E3A8A;
    box-shadow: 0 0 0 2px var(--color-focus);
}

.permission-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.permission-badge.owner {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.permission-badge.view-only {
    background: rgba(107, 114, 128, 0.15);
    color: #374151;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Dark theme support for permission badges */
@media (prefers-color-scheme: dark) {
    .permission-badge.owner {
        background: rgba(34, 197, 94, 0.2);
        color: #22c55e;
        border: 1px solid rgba(34, 197, 94, 0.4);
    }

    .permission-badge.view-only {
        background: rgba(156, 163, 175, 0.2);
        color: #9ca3af;
        border: 1px solid rgba(156, 163, 175, 0.4);
    }
}

.agent-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-background);
    font-weight: var(--font-weight-semibold);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.agent-info h3 {
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-xs);
    color: var(--color-text);
    line-height: 1.3;
}

.agent-meta {
    font-size: 0.85rem;
    color: var(--color-text-light);
    letter-spacing: 0.025em;
}

.agent-description {
    color: var(--color-text-light);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.agent-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 8px;
    background: var(--color-border);
    color: var(--color-text-light);
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
}

.tag.group {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
}

.agent-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    background: var(--color-card-background);
    color: var(--color-text);
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.action-btn.primary {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.action-btn.primary:hover {
    background: var(--primary-dark);
}

/* Expandable Agent Card Styles */
.agent-card-expandable {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card-background);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    min-height: 77px;
}

.agent-card-expandable:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    border-color: var(--color-text-light);
}

.agent-card-expandable.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-focus);
}

.agent-header-compact {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.agent-content {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.agent-content .agent-meta {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 4px;
    /* Hide agent-meta in collapsed state - only show when expanded */
    display: none;
}

/* Show agent-meta only in expanded state */
.agent-card-expandable.expanded .agent-content .agent-meta {
    display: block;
}

.expand-toggle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.expand-toggle:hover {
    background: var(--color-hover);
}

.expand-toggle svg {
    width: 16px;
    height: 16px;
    color: var(--color-text-light);
    transition: transform 0.2s ease;
}

.agent-card-expandable.expanded .expand-toggle svg {
    transform: rotate(180deg);
}

/* Star icon styles */
.star-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-right: 8px;
    cursor: pointer;
    position: relative;
}

.star-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.star-icon svg {
    width: 14px;
    height: 14px;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.star-icon.starred svg {
    fill: #fbbf24;
    color: #fbbf24;
    stroke: #f59e0b;
}

.star-icon:hover svg {
    color: #fbbf24;
    transform: scale(1.1);
}

.star-icon.starred:hover svg {
    color: #f59e0b;
}

.agent-expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--color-border);
}

.agent-card-expandable.expanded .agent-expand-content {
    /* Remove overflow-y: visible to prevent individual card scrollbars */
}

.agent-expand-details {
    padding: 16px;
}

.agent-description-full {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 16px;
    line-height: 1.6;
}

.agent-meta-expanded {
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 8px;
    line-height: 1.4;
}

.meta-item strong {
    color: var(--color-text);
    min-width: 100px;
    margin-right: 8px;
}

/* Permission and Group Tags for Expandable Cards */
.agent-tags .permission-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.agent-tags .group-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.permission-tag.owner {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.permission-tag.view-only {
    background: rgba(107, 114, 128, 0.2);
    color: #374151;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.group-tag {
    background: rgba(96, 165, 250, 0.15);
    color: var(--color-primary);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

/* Dark theme support for expandable cards */
@media (prefers-color-scheme: dark) {
    .agent-card-expandable {
        background: var(--color-card-background);
        border-color: var(--color-border);
    }
    
    .agent-card-expandable:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .agent-expand-content {
        background: rgba(255, 255, 255, 0.02);
    }
    
    .permission-tag.owner {
        background: rgba(34, 197, 94, 0.2);
        color: #22c55e;
        border: 1px solid rgba(34, 197, 94, 0.4);
    }

    .permission-tag.view-only {
        background: rgba(156, 163, 175, 0.2);
        color: #9ca3af;
        border: 1px solid rgba(156, 163, 175, 0.4);
    }
    
    .expand-toggle {
        background: rgba(255, 255, 255, 0.05);
    }
}


/* Right Panel Styles */
.agent-details {
    padding: var(--space-lg) var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.agent-detail-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-xl);
    margin-bottom: 0;
    padding-bottom: var(--space-sm);
}

.agent-detail-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-weight: var(--font-weight-semibold);
    font-size: 24px;
    flex-shrink: 0;
}

.agent-detail-info h2 {
    font-size: 20px;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.agent-detail-info p {
    color: var(--color-text-light);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.agent-detail-meta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.agent-detail-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    margin-top: var(--space-sm);
    border-top: none;
}

.detail-action-btn {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    background: var(--color-card-background);
    color: var(--color-text);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.detail-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.detail-action-btn.primary {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.detail-action-btn.primary:hover {
    background: var(--primary-dark);
}

.agent-detail-content h3 {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

/* Agent Logs Section */
.agent-logs-section {
    margin-top: 20px;
}

.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.logs-header h3 {
    margin: 0;
}

.refresh-agent-logs-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-agent-logs-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.agent-logs-container {
    background: var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    max-height: 300px;
    overflow-y: auto;
}

.logs-loading {
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
}

.agent-logs-empty {
    text-align: center;
    padding: 20px;
}

.agent-logs-empty .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.agent-logs-empty h4 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.agent-logs-empty p {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-light);
}

.agent-logs-error {
    text-align: center;
    padding: 20px;
}

.agent-logs-error .error-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.agent-logs-error h4 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: var(--error);
}

.agent-logs-error p {
    margin: 0 0 var(--space-md) 0;
    font-size: 14px;
    color: var(--color-text-light);
}

.retry-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
}

.retry-btn:hover {
    background: var(--primary-dark);
}

.agent-logs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.agent-log-item {
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-log-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
    background: var(--color-hover);
}

.log-timestamp {
    font-size: 12px;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
    font-weight: var(--font-weight-medium);
}

.log-preview {
    margin-bottom: var(--space-sm);
}

.user-preview, .ai-preview {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

.user-preview {
    color: var(--color-text);
}

.ai-preview {
    color: var(--color-text-light);
}

.log-expand-hint {
    font-size: 12px;
    color: var(--primary);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.agent-log-item:hover .log-expand-hint {
    opacity: 1;
}

.logs-more-info {
    margin-top: var(--space-md);
    text-align: center;
    font-size: 12px;
    color: var(--color-text-light);
    font-style: italic;
}

/* Expanded Log Modal Styles */
.log-metadata {
    background: var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-xl);
    font-size: 14px;
    color: var(--color-text);
}

.log-messages-expanded {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.message-expanded {
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.user-message-expanded {
    background: rgba(60, 179, 113, 0.1);
    border-left: 4px solid var(--primary);
}

.ai-message-expanded {
    background: var(--color-border);
    border-left: 4px solid var(--color-text-light);
}

.message-label-expanded {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    font-size: 14px;
}

.user-message-expanded .message-label-expanded {
    color: var(--primary);
}

.ai-message-expanded .message-label-expanded {
    color: var(--color-text);
}

.message-content-expanded {
    line-height: 1.6;
    font-size: 14px;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    color: var(--color-text-light);
    height: 100%;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.empty-state p {
    font-size: 14px;
    max-width: 300px;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-text-light);
    font-size: 14px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Remove this duplicate .modal-content definition to avoid conflicts */

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.modal-close {
    cursor: pointer;
    font-size: 24px;
    color: var(--color-text-light);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-xl);
}

.source-type-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-md);
}

.source-type-button {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    background: var(--color-card-background);
    color: var(--color-text);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.source-type-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.source-type-button.active {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.source-form {
    display: none;
}

.source-form.active {
    display: block;
}

.form-group {
    margin-bottom: var(--space-xl);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-background);
    color: var(--color-text);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.file-info {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: var(--space-xs);
}

.add-source-btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-source-btn:hover {
    background: var(--primary-dark);
}

.add-source-btn:disabled {
    background: var(--disabled);
    cursor: not-allowed;
}

.form-help,
.form-help-text {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: var(--space-xs);
    display: block;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-lg);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
}

.primary-btn {
    padding: var(--space-md) var(--space-xl);
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.primary-btn:disabled {
    background: var(--disabled);
    cursor: not-allowed;
}

.secondary-btn {
    padding: var(--space-md) var(--space-xl);
    background: var(--color-card-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    border-color: var(--color-text-light);
    background: var(--color-hover);
}

/* Clear Context Button Styles - Brand-aligned design */
.clear-context-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: rgba(239, 68, 68, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    font-family: var(--font-primary);
    letter-spacing: -0.01em;
}

.clear-context-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: rgba(239, 68, 68, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.clear-context-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.2);
}

.clear-context-btn:focus {
    outline: 2px solid rgba(239, 68, 68, 0.4);
    outline-offset: 2px;
}

.clear-context-btn .clear-icon {
    width: 14px;
    height: 14px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.clear-context-btn:hover .clear-icon {
    opacity: 1;
}

/* Dark theme improvements for clear button */
@media (prefers-color-scheme: dark) {
    .clear-context-btn {
        background: rgba(239, 68, 68, 0.15);
        color: #ef4444;
        border: 1px solid rgba(239, 68, 68, 0.4);
    }
    
    .clear-context-btn:hover {
        background: rgba(239, 68, 68, 0.25);
        border-color: rgba(239, 68, 68, 0.6);
        color: #fca5a5;
    }
}

/* High contrast mode support for clear button */
@media (prefers-contrast: high) {
    .clear-context-btn {
        background: rgba(239, 68, 68, 0.25);
        border: 2px solid rgba(239, 68, 68, 0.8);
        color: #ef4444;
    }
    
    .clear-context-btn:hover {
        background: rgba(239, 68, 68, 0.4);
        border-color: #ef4444;
        color: #fca5a5;
    }
}

/* Reduced motion support for clear button */
@media (prefers-reduced-motion: reduce) {
    .clear-context-btn:hover {
        transform: none;
    }
}

/* Spark Button Styles - Warning theme for conversation summary */
.spark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    color: rgba(245, 158, 11, 0.9);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    font-family: var(--font-primary);
    letter-spacing: -0.01em;
}

.spark-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    color: rgba(245, 158, 11, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.spark-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.2);
}

.spark-btn:focus {
    outline: 2px solid rgba(245, 158, 11, 0.4);
    outline-offset: 2px;
}

.spark-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.spark-btn .spark-icon {
    width: 14px;
    height: 14px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    fill: currentColor;
}

.spark-btn:hover .spark-icon {
    opacity: 1;
}

/* Loading animation for spark icon */
.spark-btn .spark-icon.loading {
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1) rotate(0deg);
    }
    25% {
        opacity: 1;
        transform: scale(1.1) rotate(90deg);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9) rotate(180deg);
    }
    75% {
        opacity: 1;
        transform: scale(1.1) rotate(270deg);
    }
}

/* Dark theme improvements for spark button */
@media (prefers-color-scheme: dark) {
    .spark-btn {
        background: rgba(245, 158, 11, 0.15);
        color: #f59e0b;
        border: 1px solid rgba(245, 158, 11, 0.4);
    }
    
    .spark-btn:hover {
        background: rgba(245, 158, 11, 0.25);
        border-color: rgba(245, 158, 11, 0.6);
        color: #fbbf24;
    }
}

/* High contrast mode support for spark button */
@media (prefers-contrast: high) {
    .spark-btn {
        background: rgba(245, 158, 11, 0.25);
        border: 2px solid rgba(245, 158, 11, 0.8);
        color: #f59e0b;
    }
    
    .spark-btn:hover {
        background: rgba(245, 158, 11, 0.4);
        border-color: #f59e0b;
        color: #fbbf24;
    }
}

/* Reduced motion support for spark button */
@media (prefers-reduced-motion: reduce) {
    .spark-btn:hover {
        transform: none;
    }
    
    .spark-btn .spark-icon.loading {
        animation: none;
        opacity: 0.8;
    }
}

/* Chat Modal Styles - Dark Bubble Interface */
.chat-modal {
    max-width: 48rem;
    width: 100%;
    height: auto;
    max-height: 90vh;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    overflow: hidden;
    border: none;
    backdrop-filter: blur(20px);
    margin: 0 auto;
}

/* Override modal-content padding for chat modal */
.modal-content.chat-modal {
    padding: 0 !important;
}


.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-weight: var(--font-weight-semibold);
}

.chat-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: #ffffff;
}

.chat-info p {
    margin: var(--space-xs) 0 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    opacity: 0.8;
}

.chat-actions {
    display: flex;
    gap: var(--space-sm);
}

.share-btn {
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(60, 179, 113, 0.5);
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    padding: var(--space-xs);
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* Webkit scrollbar styling for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-text-light);
}

/* Webkit scrollbar styling for agents grid (matches sessions-container pattern) */
.agents-grid::-webkit-scrollbar {
    width: 6px;
}

.agents-grid::-webkit-scrollbar-track {
    background: transparent;
}

.agents-grid::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 3px;
}

.agents-grid::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-text-light);
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 8px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.user .message-avatar {
    background: var(--color-primary, #60A5FA);
    color: white;
}

.bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 16px;
    line-height: 1.4;
    font-size: 14px;
    word-wrap: break-word;
    white-space: normal;
    text-align: left;
    position: relative;
    backdrop-filter: blur(10px);
}

.message.user .bubble {
    background: #1E3A8A;
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.agent .bubble {
    background: transparent;
    color: #ffffff;
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: 100%;
}

/* System messages for conversation history - simplified styling without bubble */
.message.system {
    justify-content: center;
    text-align: center;
    margin: 15px 0;
    align-items: center;
    display: flex;
    width: 100%;
}

.message.system .bubble {
    background: transparent;
    color: #cccccc;
    border: none;
    border-radius: 0;
    padding: 0;
    text-align: center;
    max-width: 80%;
    font-size: 13px;
}

.message.system .timestamp {
    display: none;
}

.message-content {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 16px;
    line-height: 1.4;
    font-size: 14px;
    word-wrap: break-word;
    white-space: normal;
    text-align: left;
    position: relative;
    backdrop-filter: blur(10px);
}

.message.user .message-content {
    background: rgba(60, 179, 113, 0.9);
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(60, 179, 113, 0.3);
}

.message.agent .message-content {
    background: transparent;
    color: #ffffff;
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: 100%;
}

/* Welcome message - Dark theme - plain text style */
.message.agent:first-child .message-content,
.message.agent:first-child .bubble {
    background: transparent;
    border: none;
    font-size: 14px;
    padding: 0;
    text-align: left;
    color: #ffffff;
    backdrop-filter: none;
}

/* Enhanced Streaming Message Styles */
.message.streaming .message-content {
    position: relative;
}

.message.streaming .message-content::after {
    content: '|';
    color: var(--color-primary, #60A5FA);
    font-weight: bold;
    font-size: 1.1em;
    margin-left: 2px;
    animation: streaming-cursor 1.2s infinite;
    display: inline-block;
}

@keyframes streaming-cursor {
    0%, 50% { 
        opacity: 1;
        transform: scaleY(1);
    }
    51%, 100% { 
        opacity: 0;
        transform: scaleY(0.8);
    }
}

/* Streaming indicator for message bubbles - works for both user and agent messages */
.message.user.streaming .bubble::after {
    content: '|';
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    font-size: 1.1em;
    margin-left: 2px;
    animation: streaming-cursor 1.2s infinite;
    display: inline-block;
}

/* Streaming indicator for AI messages (without bubble styling) */
.message.agent.streaming .bubble::after {
    content: '|';
    color: var(--color-primary, #60A5FA);
    font-weight: bold;
    font-size: 1.1em;
    margin-left: 2px;
    animation: streaming-cursor 1.2s infinite;
    display: inline-block;
}

/* Markdown content styles within chat bubbles and AI messages */
.bubble h1, .bubble h2, .bubble h3, .bubble h4, .bubble h5, .bubble h6 {
    margin: 0.5em 0 0.3em 0;
    font-weight: 600;
    line-height: 1.3;
}

/* Ensure proper spacing for AI message headings without bubble padding */
.message.agent .bubble h1:first-child,
.message.agent .bubble h2:first-child,
.message.agent .bubble h3:first-child,
.message.agent .bubble h4:first-child,
.message.agent .bubble h5:first-child,
.message.agent .bubble h6:first-child {
    margin-top: 0;
}

.bubble h1 { font-size: 1.4em; }
.bubble h2 { font-size: 1.3em; }
.bubble h3 { font-size: 1.2em; }
.bubble h4 { font-size: 1.1em; }
.bubble h5 { font-size: 1.05em; }
.bubble h6 { font-size: 1em; }

.bubble p {
    margin: 0.3em 0;
    line-height: 1.4;
}

.bubble ul, .bubble ol {
    margin: 0.5em 0;
    padding-left: 1.2em;
}

.bubble li {
    margin-bottom: 0.2em;
    line-height: 1.4;
}

.bubble blockquote {
    margin: 0.5em 0;
    padding: 0.3em 0.8em;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

/* Enhanced blockquotes for AI messages */
.message.agent .bubble blockquote {
    border-left: 3px solid var(--color-primary, #60A5FA);
    background: rgba(0, 0, 0, 0.2);
}

.bubble pre {
    margin: 0.5em 0;
    padding: 0.6em;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced code blocks for AI messages without bubble background */
.message.agent .bubble pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bubble code {
    background: rgba(0, 0, 0, 0.15);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced inline code for AI messages without bubble background */
.message.agent .bubble code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bubble pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
}

.bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
    font-size: 0.9em;
}

.bubble th, .bubble td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.3em 0.6em;
    text-align: left;
}

.bubble th {
    background: rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.bubble a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
    text-decoration-color: rgba(60, 179, 113, 0.8);
    transition: all 0.2s ease;
}

.bubble a:hover {
    color: #ffffff;
    text-decoration-color: var(--color-primary, #60A5FA);
}

.bubble hr {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0.8em 0;
}

/* User message bubble - different styling for readability */
.message.user .bubble h1, 
.message.user .bubble h2, 
.message.user .bubble h3, 
.message.user .bubble h4, 
.message.user .bubble h5, 
.message.user .bubble h6 {
    color: inherit;
}

.message.user .bubble code {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.user .bubble pre {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.user .bubble blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.message.user .bubble a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration-color: rgba(255, 255, 255, 0.7);
}

.message.user .bubble a:hover {
    color: #ffffff;
    text-decoration-color: rgba(255, 255, 255, 0.9);
}

/* Stop button styles */
.chat-stop-button {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.chat-stop-button.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.chat-stop-button:hover {
    background: rgba(220, 38, 38, 0.95);
    transform: translateY(-50%) translateX(0) scale(1.05);
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
}

.chat-input-container {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
}

.chat-input-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 14px;
    resize: none;
    min-height: 38px;
    max-height: 100px;
    line-height: 1.4;
    font-family: var(--font-primary);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.chat-input:focus {
    outline: none;
    border-color: #60A5FA;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.send-btn {
    padding: 10px;
    background: #60A5FA;
    color: white;
    border: none;
    border-radius: 19px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 38px;
    transition: all 0.2s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.send-btn:hover {
    background: #3B82F6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.5;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Status indicator - Blue pulse animation */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 6px;
    background: #60A5FA;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Timestamp styling for bubble interface */
.timestamp {
    font-size: 0.7rem;
    opacity: 0.6;
    margin: 0 8px;
    color: rgba(255, 255, 255, 0.6);
    align-self: flex-end;
}

/* Typing indicator - Professional Animation */
.typing-dots {
    display: flex;
    gap: 3px;
    align-items: center;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary, #60A5FA);
    animation: typing-wave 1.8s infinite ease-in-out;
    opacity: 0.4;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-wave {
    0%, 60%, 100% {
        transform: translateY(0) scale(0.8);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px) scale(1);
        opacity: 1;
    }
}

/* Dark theme accessibility improvements - AI messages as plain text */
.chat-modal .message.agent .bubble {
    /* Enhanced contrast for AI messages - no bubble styling */
    background: transparent;
    color: #ffffff;
    border: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 0;
    max-width: 100%;
}

.chat-modal .message.user .bubble {
    /* High contrast for user messages */
    background: #1E3A8A;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Focus states for accessibility */
.chat-input:focus {
    outline: 2px solid #60A5FA;
    outline-offset: 2px;
}

.send-btn:focus {
    outline: 2px solid #60A5FA;
    outline-offset: 2px;
}

.close-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.share-btn:focus {
    outline: 2px solid rgba(60, 179, 113, 0.8);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-modal .message.agent .bubble {
        background: transparent;
        border: none;
        color: #ffffff;
    }
    
    .chat-modal .message.user .bubble {
        background: #1E3A8A;
        border: 2px solid rgba(255, 255, 255, 0.3);
        color: #ffffff;
    }
    
    .chat-input {
        border: 2px solid rgba(255, 255, 255, 0.4);
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .status-indicator {
        animation: none;
    }
    
    .typing-dots span {
        animation: none;
        opacity: 0.8;
    }
    
    .send-btn:hover {
        transform: none;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .agents-layout {
        grid-template-columns: 250px 1fr;
        grid-template-areas: "sessions chat";
    }
    .center-panel { /* Agent list - hidden on tablet */
        display: none;
    }
    
    /* Adjust toolbar spacing for smaller screens */
    .agents-toolbar {
        padding: var(--space-md) var(--space-lg);
    }
    
    .session-toolbar {
        padding: var(--space-md) var(--space-lg);
    }
    
    /* Tablet chat modal adjustments - keep max-width constraint */
    .chat-modal {
        max-width: 48rem;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        min-height: 100vh;
    }
    
    .chat-header {
        padding: 11px 15px;
    }
    
    .chat-messages {
        padding: 14px 15px;
        gap: 7px;
    }
    
    .chat-input-area {
        padding: 11px 15px;
    }
}

@media (max-width: 768px) {
    .agents-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas: 
            "sessions"
            "chat"
            "agents";
        height: auto;
        gap: var(--space-md);
    }
    
    .left-panel {
        order: 1;
    }
    
    .center-panel { /* Agent list - collapsible on mobile */
        order: 3;
        display: block;
        max-height: 200px;
    }
    
    .right-panel {
        display: block;
        order: 2;
    }

    .agents-grid {
        grid-template-columns: 1fr;
        padding: var(--space-md);
    }
    
    /* Stack filters vertically on mobile for better space usage */
    .filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    /* Mobile chat modal improvements - Reduced side gaps for better space utilization */
    .chat-modal {
        height: auto;
        max-height: 85vh;
        min-height: 50vh;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    
    .chat-header {
        padding: 8px 10px !important;
    }
    
    .chat-messages {
        padding: 8px 10px !important;
    }
    
    .chat-input-area {
        padding: 8px 10px !important;
    }
    
    .chat-input-container {
        gap: 8px; /* Reduced gap for mobile space optimization */
    }
}

/* Extra small screens optimization */
@media (max-width: 480px) {
    .agents-toolbar {
        padding: var(--space-sm) var(--space-md);
    }
    
    .session-toolbar {
        padding: var(--space-sm) var(--space-md);
    }
    
    .search-input {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
    }
    
    .panel-header {
        padding: var(--space-md);
        font-size: 0.9rem;
    }
    
    .agent-card {
        padding: var(--space-md);
    }
    
    /* Mobile chat modal adjustments - keep max-width constraint */
    .chat-modal {
        max-width: 48rem;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        min-height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 6px 8px !important;
    }
    
    .chat-messages {
        padding: 6px 8px !important;
    }
    
    .chat-input-area {
        padding: 6px 8px !important;
    }
    
    /* Mobile clear button optimizations */
    .clear-context-btn {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }
    
    .clear-context-btn .clear-icon {
        width: 12px;
        height: 12px;
    }
    
    /* Adjust chat actions spacing for mobile */
    .chat-actions {
        gap: 6px;
    }
    
    .share-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .chat-messages {
        padding: 6px 8px !important;
        gap: 4px !important;
    }
    
    .chat-input-area {
        padding: 6px 8px !important;
    }
    
    .bubble {
        max-width: 90%; /* Increased from 85% for better space utilization */
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 14px;
    }
    
    .message {
        margin-bottom: 6px;
        gap: 4px;
    }
    
    /* Ensure agent messages (plain text) utilize full available width */
    .message.agent .bubble {
        max-width: 100%;
        margin-right: 0;
        padding: 0;
    }
    
    .timestamp {
        font-size: 0.65rem;
        margin: 0 4px;
    }
    
    .chat-info h3 {
        font-size: 14px;
    }
    
    .chat-info p {
        font-size: 11px;
    }
    
    .chat-input {
        min-height: 36px;
        max-height: 80px;
        padding: 8px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
        flex: 1;
        min-width: 0; /* Allow input to shrink properly */
    }
    
    .send-btn {
        min-width: 36px;
        min-height: 36px;
        max-width: 36px;
        max-height: 36px;
        padding: 8px;
        flex-shrink: 0; /* Prevent button from shrinking */
    }
    
    .chat-input-container {
        gap: 6px; /* Further reduced gap for very small screens */
        display: flex;
        align-items: flex-end;
        width: 100%;
    }
}

/* ============================================
   SESSION PANEL STYLES
   ============================================ */

/* Session Panel Layout */
.session-panel {
    display: flex;
    flex-direction: column;
}

.session-section {
    border-bottom: 1px solid var(--color-border);
}

.session-section:last-child {
    border-bottom: none;
    flex: 1;
}

/* My Sessions Section */
.my-sessions-section {
    background: linear-gradient(135deg, rgba(60, 179, 113, 0.05) 0%, rgba(60, 179, 113, 0.02) 100%);
}

.my-sessions-section .section-header {
    color: var(--color-primary);
}

.new-session-btn {
    margin-left: auto;
    padding: 8px;
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-session-btn:hover {
    background: var(--color-primary-dark, #3B82F6);
    transform: translateY(-1px);
}

/* Sessions List */
.sessions-list-section {
    flex: 1;
    overflow: hidden;
}

.sessions-container {
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

.sessions-container::-webkit-scrollbar {
    width: 6px;
}

.sessions-container::-webkit-scrollbar-track {
    background: transparent;
}

.sessions-container::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 3px;
}

/* Session Item */
.session-item {
    padding: 16px var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.session-item:hover {
    background: rgba(60, 179, 113, 0.05);
}

.session-item.active {
    background: rgba(60, 179, 113, 0.1);
    border-left: 3px solid var(--color-primary);
    padding-left: calc(var(--space-lg) - 3px);
}

.session-item.active:hover {
    background: rgba(60, 179, 113, 0.15);
}

.session-item:last-child {
    border-bottom: none;
}

.session-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.session-star {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-btn:hover {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.star-btn.active {
    color: #fbbf24;
}

.star-btn.active:hover {
    color: #f59e0b;
}

.session-header .session-info {
    flex: 1;
    min-width: 0;
}

.session-header .session-actions {
    flex-shrink: 0;
}

/* .session-info styles are now handled above in .session-header .session-info */

.session-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.session-separator {
    opacity: 0.5;
}

.session-date {
    font-weight: 500;
}

.session-messages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.session-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.session-item:hover .session-actions {
    opacity: 1;
}

.session-action-btn {
    padding: 6px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-action-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.session-action-btn.danger:hover {
    background: var(--color-error, #ef4444);
    border-color: var(--color-error, #ef4444);
    color: white;
}

.session-timestamp {
    font-size: 11px;
    color: var(--color-text-secondary);
    opacity: 0.8;
    font-style: italic;
}

/* Session count in header */
.session-count {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* Empty state */
.empty-sessions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-secondary);
    height: 200px;
}

.empty-sessions p {
    margin: 0;
    line-height: 1.5;
}

.loading-sessions, .error-sessions {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

/* ============================================
   KNOWLEDGE PANEL STYLES (LEGACY - KEEP FOR COMPATIBILITY)
   ============================================ */

/* Knowledge Panel Layout */
.knowledge-panel {
    display: flex;
    flex-direction: column;
}

.knowledge-section {
    border-bottom: 1px solid var(--color-border);
}

.knowledge-section:last-child {
    border-bottom: none;
    flex: 1;
}

.section-header {
    padding: 20px var(--space-lg) 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.section-header:hover {
    color: var(--color-primary);
}

.section-header.collapsible {
    justify-content: space-between;
}

.section-header svg {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.source-count {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 400;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Personal Knowledge Section */
.personal-section {
    background: linear-gradient(135deg, rgba(60, 179, 113, 0.05) 0%, rgba(60, 179, 113, 0.02) 100%);
}

.personal-section .section-header {
    color: var(--color-primary);
}

.manage-sources-btn {
    margin: 0 var(--space-lg) 20px;
    padding: 12px 20px;
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.manage-sources-btn:hover {
    background: var(--color-primary-dark, #3B82F6);
    transform: translateY(-1px);
}

.manage-sources-btn.secondary {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.manage-sources-btn.secondary:hover {
    background: rgba(60, 179, 113, 0.1);
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* Agent Stores */
.agent-stores-list {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.agent-stores-list.collapsed {
    max-height: 0;
    overflow: hidden;
}

.agent-store-item {
    padding: 16px var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.agent-store-item:hover {
    background: rgba(60, 179, 113, 0.05);
}

.agent-store-item:last-child {
    border-bottom: none;
}

.agent-store-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-background);
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
}

.vector-store-id {
    font-size: 11px;
    color: var(--color-text-secondary);
    font-family: 'Monaco', 'Consolas', monospace;
    opacity: 0.8;
    margin-bottom: 4px;
}

.agent-store-item .source-count {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.agent-store-item .manage-sources-btn {
    margin: 0;
    padding: 8px 16px;
    font-size: 12px;
}

/* Quick Actions */
.actions-section {
    padding: 20px var(--space-lg);
}

.quick-action-btn {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-action-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: rgba(60, 179, 113, 0.05);
}

/* ============================================
   MODAL STYLES
   ============================================ */

/* Chat Modal Overlay - Clean and simple */
.chat-modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    align-items: stretch;
    justify-content: center;
    z-index: 1001 !important;
    backdrop-filter: blur(2px);
}

/* Ensure chat modal content has proper max-width */
.chat-modal-overlay .modal-content.chat-modal {
    max-width: 48rem !important;
    width: 90%;
}

/* Mobile modal overlay - remove margins */
@media (max-width: 768px) {
    .chat-modal-overlay {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .chat-modal-overlay .modal-content.chat-modal {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
}

/* ============================================
   AGENT DROPDOWN STYLES
   ============================================ */

/* Chat agent avatar container - clickable */
.chat-agent-avatar-container {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.chat-agent-avatar-container:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Chat modal specific avatar */
.chat-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Dropdown arrow */
.agent-dropdown-arrow {
    display: flex;
    align-items: center;
    margin-left: 4px;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-agent-avatar-container:hover .agent-dropdown-arrow {
    opacity: 1;
}

/* Agent dropdown container */
.agent-dropdown {
    position: fixed;
    background: rgba(42, 48, 60, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    min-width: 320px;
    max-height: 400px;
    overflow: hidden;
}

/* Dropdown header with search */
.agent-dropdown-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.agent-dropdown-search {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.agent-dropdown-search::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.agent-dropdown-search:focus {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.15);
}

/* Dropdown list container */
.agent-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Individual agent dropdown items */
.agent-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.agent-dropdown-item:last-child {
    border-bottom: none;
}

.agent-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.agent-dropdown-item.current {
    background-color: rgba(96, 165, 250, 0.15);
    border-left: 3px solid var(--color-primary);
}

.agent-dropdown-item.keyboard-focus {
    background-color: rgba(255, 255, 255, 0.12);
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Dropdown avatar */
.agent-dropdown-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Agent info in dropdown */
.agent-dropdown-info {
    flex: 1;
    min-width: 0;
}

.agent-dropdown-name {
    font-weight: 500;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-dropdown-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Current agent indicator */
.agent-dropdown-current {
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Empty state */
.agent-dropdown-empty {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .agent-dropdown {
        min-width: 280px;
        max-height: 300px;
    }
    
    .agent-dropdown-item {
        padding: 8px 10px;
    }
    
    .agent-dropdown-name {
        font-size: 13px;
    }
    
    .agent-dropdown-desc {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
}

/* Ensure auth modal content has proper max-width */
#auth-modal.modal-overlay .modal-content {
    max-width: 48rem !important;
    width: 90%;
}


/* Agent Form Modal Overlay - Higher specificity to override knowledge panel modal */
.agent-form-modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1002 !important;
    backdrop-filter: blur(4px);
}

/* Agent Form Modal Content - Specific max-width */
.agent-form-modal-overlay .modal-content {
    max-width: 48rem !important;
    width: 90%;
    background-color: var(--color-card-background);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Sources Modal Overlay */
.sources-modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1003 !important;
    backdrop-filter: blur(4px);
}

/* Log Modal Overlay */
.log-modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1004 !important;
    backdrop-filter: blur(4px);
}

/* Knowledge Panel Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-container {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: var(--color-text);
    background: var(--color-border);
}

.modal-content {
    position: relative;
    padding: 24px var(--space-lg);
    flex: 1;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    /* Override any width constraints from other CSS files */
    max-width: none !important;
}

/* Knowledge Sources Modal specific styles */
#knowledgeSourcesModal .modal-content {
    width: 100% !important;
    max-width: none !important;
    padding: 24px var(--space-lg);
}

/* Upload Options */
.upload-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: var(--space-lg);
    margin-top: var(--space-xl);
}

.upload-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-option:hover {
    border-color: var(--color-primary);
    background: rgba(60, 179, 113, 0.05);
}

.upload-option svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.upload-option-text {
    flex: 1;
}

.upload-option-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.upload-option-desc {
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Upload Forms */
.upload-form {
    margin-bottom: var(--space-lg);
}

.form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-btn {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.form-header h3 {
    font-size: 18px;
    color: var(--color-text);
    margin: 0;
}

.file-drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    padding: 48px var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--color-primary);
    background: rgba(60, 179, 113, 0.05);
}

.file-drop-zone svg {
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.upload-text {
    color: var(--color-text);
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--color-text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.upload-btn {
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: var(--color-primary-dark, #3B82F6);
    transform: translateY(-1px);
}

/* Upload Progress */
.upload-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease;
    width: 0%;
}

.upload-status {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Sources Section in Modal */
.sources-section {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
}

.sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sources-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.sources-count {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
}

.sources-list .loading-message,
.sources-list .error-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.sources-list .error-message {
    color: var(--color-danger, #ef4444);
}

.source-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.source-item:hover {
    background: var(--color-hover);
    transform: translateY(-1px);
}

.source-item.selected {
    background: rgba(60, 179, 113, 0.1);
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.source-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.source-checkbox.checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.source-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

.source-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.source-info {
    flex: 1;
}

.source-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

.source-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.source-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.source-item:hover .source-actions {
    opacity: 1;
}

.source-action-btn {
    padding: 6px 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.source-action-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.source-action-btn.danger:hover {
    background: var(--color-error, #ef4444);
    border-color: var(--color-error, #ef4444);
    color: white;
}

.batch-actions {
    position: sticky;
    bottom: 0;
    background: var(--color-background-secondary);
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.batch-actions.visible {
    opacity: 1;
    transform: translateY(0);
}

.batch-info {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.batch-buttons {
    display: flex;
    gap: 8px;
}

.batch-btn {
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.batch-btn.primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-background);
}

.batch-btn.primary:hover {
    background: var(--color-primary-dark, #3B82F6);
}

.batch-btn.danger {
    border-color: var(--color-error, #ef4444);
    color: var(--color-error, #ef4444);
}

.batch-btn.danger:hover {
    background: var(--color-error, #ef4444);
    color: white;
}

/* Scrollbar styling for modal */
.modal-content::-webkit-scrollbar,
.agent-stores-list::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.agent-stores-list::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb,
.agent-stores-list::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 3px;
}

/* Responsive Design for Knowledge Panel */
@media (max-width: 1024px) {
    .upload-options {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        width: 95%;
        max-height: 95%;
    }
}

@media (max-width: 768px) {
    .section-header {
        padding: 16px 24px 8px;
    }
    
    .manage-sources-btn {
        margin: 0 24px 16px;
    }
    
    .actions-section {
        padding: 20px 24px;
    }
    
    .modal-header {
        padding: 16px 24px;
    }
    
    .modal-content {
        padding: 24px;
        width: 100%;
        max-width: none !important;
    }
}

/* Get Code Modal Styles */
.get-code-modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1005 !important;
    backdrop-filter: blur(4px);
}

.get-code-modal {
    max-width: 56rem !important;
    width: 90%;
    background-color: var(--color-card-background);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.get-code-modal .modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.code-example-section {
    margin-bottom: var(--space-2xl);
}

.code-example-section h3 {
    margin-top: 0;
    margin-bottom: var(--space-sm);
    font-size: 1.125rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.example-description {
    margin-bottom: var(--space-lg);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* Language Tabs */
.language-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.lang-tab {
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-tab:hover {
    color: var(--color-text);
}

.lang-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Code Content */
.code-content {
    position: relative;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-block {
    display: none;
}

.code-block.active {
    display: block;
}

.code-block pre {
    margin: 0;
    padding: var(--space-lg);
    overflow-x: auto;
    background: var(--color-background);
}

.code-block code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--color-text);
    display: block;
}

/* Copy Code Button */
.copy-code-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-code-btn:hover {
    background: var(--color-primary-dark, #2E8B57);
    transform: translateY(-1px);
}

.copy-code-btn svg {
    width: 16px;
    height: 16px;
}

/* API Info Section */
.api-info {
    margin-top: var(--space-2xl);
    padding: var(--space-lg);
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.api-info h4 {
    margin-top: 0;
    margin-bottom: var(--space-md);
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.api-info ul {
    margin: 0;
    padding-left: var(--space-xl);
    list-style: disc;
}

.api-info li {
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.api-info strong {
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
}

.api-info code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.75rem;
    background: var(--color-background);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
    color: var(--color-primary);
}

/* Responsive adjustments for Get Code modal */
@media (max-width: 768px) {
    .get-code-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .language-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .lang-tab {
        white-space: nowrap;
    }
    
    .code-block pre {
        padding: var(--space-md);
    }
    
    .api-info {
/* Knowledge Panel Content in Right Panel */
.knowledge-panel-content {
    /* Remove modal constraints and adapt for panel */
    max-width: none !important;
    padding: 0;
}

/* knowledge-content-header removed - no longer used */

.back-to-overview-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    color: var(--color-text-light);
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.back-to-overview-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--color-hover);
}

.knowledge-management-section {
    /* Inherit panel styling */
}

/* Active state for Knowledge button */
.detail-action-btn.active {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.detail-action-btn.active:hover {
    background: var(--primary-dark);
}

/* Ensure upload options work in panel context */
.knowledge-panel-content .upload-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: var(--space-lg);
    margin-top: var(--space-xl); /* Add extra spacing above upload options */
}

/* Add spacing between sources section and upload options */
.knowledge-panel-content .sources-section {
    margin-bottom: var(--space-xl);
}

/* Ensure sources section works in panel context */
.knowledge-panel-content .sources-section {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
}

/* Form styling in panel context */
.knowledge-panel-content .form-group {
    margin-bottom: var(--space-md);
}

.knowledge-panel-content .form-input,
.knowledge-panel-content .form-textarea {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
    color: var(--color-text);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.knowledge-panel-content .form-input:focus,
.knowledge-panel-content .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.knowledge-panel-content .form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Upload button styling */
.knowledge-panel-content .upload-btn {
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background 0.2s ease;
}

.knowledge-panel-content .upload-btn:hover {
    background: var(--primary-dark);
}

/* File drop zone styling */
.knowledge-panel-content .file-drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: var(--space-md);
}

.knowledge-panel-content .file-drop-zone:hover,
.knowledge-panel-content .file-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(60, 179, 113, 0.05);
}

.knowledge-panel-content .upload-text {
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.knowledge-panel-content .upload-subtext {
    font-size: 14px;
    color: var(--color-text-light);
}

/* Progress bar styling */
.knowledge-panel-content .upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.knowledge-panel-content .upload-progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.knowledge-panel-content .upload-status {
    font-size: 14px;
    color: var(--color-text-light);
    text-align: center;
}

/* Source item styling */
.knowledge-panel-content .source-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--color-background);
    transition: all 0.2s ease;
}

.knowledge-panel-content .source-item:hover {
    background: var(--color-hover);
}

.knowledge-panel-content .source-checkbox input {
    margin: 0;
}

.knowledge-panel-content .source-info {
    flex: 1;
}

.knowledge-panel-content .source-name {
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.knowledge-panel-content .source-meta {
    font-size: 12px;
    color: var(--color-text-light);
    display: flex;
    gap: var(--space-md);
}

.knowledge-panel-content .source-action-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--color-text-light);
    transition: all 0.2s ease;
}

.knowledge-panel-content .source-action-btn:hover {
    color: var(--error, #ef4444);
    border-color: var(--error, #ef4444);
}

/* Batch actions styling */
.knowledge-panel-content .batch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--color-hover);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
}

.knowledge-panel-content .batch-info {
    font-size: 14px;
    color: var(--color-text);
}

.knowledge-panel-content .batch-buttons {
    display: flex;
    gap: var(--space-sm);
}

.knowledge-panel-content .batch-btn {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-background);
    color: var(--color-text);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.knowledge-panel-content .batch-btn:hover {
    background: var(--color-hover);
}

.knowledge-panel-content .batch-btn.danger:hover {
    background: var(--error, #ef4444);
    color: white;
    border-color: var(--error, #ef4444);
}

/* Empty state styling */
.knowledge-panel-content .empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-light);
}

/* Loading and error message styling */
.knowledge-panel-content .loading-message,
.knowledge-panel-content .error-message {
    padding: var(--space-lg);
    text-align: center;
    color: var(--color-text-light);
    font-style: italic;
}

.knowledge-panel-content .error-message {
    color: var(--error, #ef4444);
}

/* Responsive adjustments for knowledge panel in right panel */
@media (max-width: 1024px) {
    .knowledge-panel-content .upload-options {
        grid-template-columns: 1fr;
    }
    
    /* knowledge-content-header responsive rules removed */
}

/* Scrollbar styling for knowledge panel content */
.knowledge-panel-content .sources-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.knowledge-panel-content .sources-list::-webkit-scrollbar {
    width: 6px;
}

.knowledge-panel-content .sources-list::-webkit-scrollbar-track {
    background: transparent;
}

.knowledge-panel-content .sources-list::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 3px;
}

        padding: var(--space-md);
    }
}

/* Background Task Status Notification */
.background-task-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--color-secondary, #2A2A2A);
    border: 1px solid var(--color-border, #3A3A3A);
    color: var(--color-text, #FFFFFF);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.background-task-status.processing {
    background-color: #1E3A5F;
    color: #93C5FD;
    border: 1px solid #3B82F6;
}

.background-task-status.processing::before {
    content: '⏳ ';
    display: inline-block;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.background-task-status.completed {
    background-color: #1F3A28;
    color: #86EFAC;
    border: 1px solid #22C55E;
}

.background-task-status.completed::before {
    content: '✅ ';
}

.background-task-status.failed {
    background-color: #4A1E1E;
    color: #FCA5A5;
    border: 1px solid #EF4444;
}

.background-task-status.failed::before {
    content: '❌ ';
}

/* System message styling for background task notifications */
.message.system {
    opacity: 0.8;
    font-style: italic;
    color: var(--color-text-secondary, #B0B0B0);
    margin: 10px 0;
    padding: 8px 16px;
    background: transparent;
    border-radius: 4px;
    border-left: 3px solid var(--color-primary, #60A5FA);
}

/* OpenAI-style Background Processing Card */
.chat-input-wrapper {
    display: flex;
    flex-direction: column;
}

.background-processing-card {
    background: var(--color-secondary, #2D2D2D);
    border: 1px solid var(--color-border, #3D3D3D);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.processing-content {
    flex: 1;
}

.processing-title {
    font-weight: 500;
    color: var(--color-text, #FFFFFF);
    margin-bottom: 4px;
    font-size: 14px;
}

.processing-status {
    font-size: 13px;
    color: var(--color-text-secondary, #999);
    display: flex;
    align-items: center;
    gap: 8px;
}

.processing-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success, #10B981);
    border-radius: 50%;
    animation: processingPulse 2s infinite;
    flex-shrink: 0;
}

@keyframes processingPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.5; 
        transform: scale(0.8);
    }
}

.processing-details {
    background: transparent;
    border: 1px solid var(--color-border, #4A4A4A);
    color: var(--color-text-secondary, #CCC);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.processing-details:hover {
    background: var(--color-hover, #3A3A3A);
    border-color: var(--color-border-hover, #5A5A5A);
    color: var(--color-text, #FFF);
}

.processing-details:active {
    transform: scale(0.95);
}

/* Thinking indicator styles */
.thinking-indicator {
    opacity: 0.8;
}

.thinking-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--color-text-secondary, #999);
}

.thinking-text {
    color: var(--color-text-secondary, #999);
}

.thinking-animation {
    display: flex;
    gap: 2px;
}

.thinking-animation span {
    animation: thinkingPulse 1.4s ease-in-out infinite;
    opacity: 0.4;
}

.thinking-animation span:nth-child(1) {
    animation-delay: 0s;
}

.thinking-animation span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-animation span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingPulse {
    0%, 80%, 100% {
        opacity: 0.4;
    }
    40% {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
        max-height: 100px;
        padding-top: 16px;
        padding-bottom: 16px;
        margin-bottom: 12px;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
        max-height: 100px;
        padding-top: 16px;
        padding-bottom: 16px;
        margin-bottom: 12px;
    }
    to {
        transform: translateY(-20px);
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

/* Sitemap Styles */
.sitemap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.sitemap-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text);
}

.sitemap-actions {
    display: flex;
    gap: 8px;
}

.select-all-btn,
.select-none-btn {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    background: var(--color-background);
    color: var(--color-text);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-all-btn:hover,
.select-none-btn:hover {
    background: var(--color-border);
}

.sitemap-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px;
    background: var(--color-surface, #1a1a1a);
}

.sitemap-url-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.sitemap-url-item:hover {
    background: var(--color-border);
}

.sitemap-url-item input[type="checkbox"] {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.sitemap-url-label {
    display: flex;
    flex-direction: column;
    flex: 1;
    cursor: pointer;
}

.sitemap-url {
    font-size: 14px;
    color: var(--color-text);
    word-break: break-all;
}

.sitemap-url-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.upload-details {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* Tree Structure Styles for Sitemap */
.sitemap-tree-node {
    margin-bottom: 2px;
}

.sitemap-tree-header {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.sitemap-tree-header:hover {
    background: var(--color-border);
}

.sitemap-tree-toggle {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    color: var(--color-text-secondary);
}

.sitemap-tree-toggle.expanded {
    transform: rotate(90deg);
}

.sitemap-tree-toggle.leaf {
    visibility: hidden;
}

.sitemap-tree-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.sitemap-tree-label {
    flex: 1;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
}

.sitemap-tree-label.folder {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.sitemap-tree-children {
    margin-left: 24px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.sitemap-tree-children.collapsed {
    max-height: 0;
    opacity: 0;
}

.sitemap-tree-url-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    transition: background 0.2s ease;
    margin-left: 24px;
}

.sitemap-tree-url-item:hover {
    background: var(--color-border);
}

.sitemap-tree-url-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-left: 8px;
}

/* Indeterminate checkbox styling */
.sitemap-tree-checkbox:indeterminate {
    background-color: var(--color-primary, #0066cc);
    border-color: var(--color-primary, #0066cc);
}

.sitemap-tree-checkbox:indeterminate::after {
    content: '';
    display: block;
    width: 6px;
    height: 2px;
    background: white;
    margin: 6px auto;
}

/* Improve tree node spacing */
.sitemap-tree-node {
    margin-bottom: 1px;
}

.sitemap-tree-header {
    min-height: 28px;
}

.sitemap-tree-url-item {
    min-height: 24px;
    padding: 2px 8px;
}

/* Source Content Modal Styles */
.content-modal {
    width: 90vw;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.content-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.content-modal-title {
    font-size: 18px;
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin: 0;
    word-break: break-word;
}

.modal-close-btn {
    background: none;
    border: none;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--color-text-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

.content-modal .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.content-modal-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-md);
    color: var(--color-text-light);
    font-size: 14px;
}

.content-modal-loader .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.content-modal-body {
    width: 100%;
    height: 100%;
    padding: var(--space-lg);
    margin: 0;
    overflow: auto;
    background: var(--color-bg);
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    box-sizing: border-box;
}

.content-modal-body.error {
    color: var(--error, #ef4444);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Clickable source items */
.source-info.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    padding: var(--space-xs);
    margin: calc(-1 * var(--space-xs));
}

.source-info.clickable:hover {
    background: var(--color-hover);
    transform: translateY(-1px);
}

.source-info.clickable:active {
    transform: translateY(0);
}

/* Ensure clickable area doesn't interfere with checkbox */
.source-item .source-checkbox {
    z-index: 2;
    position: relative;
}

.source-item .source-actions {
    z-index: 2;
    position: relative;
}

/* Modal overlay improvements */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    box-sizing: border-box;
}

.modal-container {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
}

/* Responsive design for modal */
@media (max-width: 768px) {
    .content-modal {
        width: 95vw;
        height: 85vh;
    }
    
    .content-modal-body {
        font-size: 12px;
        padding: var(--space-md);
    }
    
    .content-modal-title {
        font-size: 16px;
    }
}
