/* Chat interface styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-white);
}

.chat-header {
    background: var(--color-bg-white);
    color: var(--color-text-primary);
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    border: none;
    background: none;
    outline: none;
    flex: 1;
    cursor: text;
    min-width: 0;
}

.chat-title:hover {
    background: var(--color-bg-off-white);
    border-radius: 4px;
    padding: 4px 8px;
    margin: -4px -8px;
}

.chat-title:focus {
    background: var(--color-bg-white);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 4px 8px;
    margin: -4px -8px;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--color-bg-white);
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

.message.user {
    text-align: right;
}

.message.claude {
    text-align: left;
}

.message-bubble {
    display: inline-block;
    max-width: 70%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl);
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    text-align: left;
}

.message.user .message-bubble {
    background: var(--gray-100);
    color: var(--color-text-primary);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.message.claude .message-bubble {
    background: var(--color-bg-white);
    color: var(--color-text-primary);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

/* Chat input */
/* File preview area */
.file-preview-area {
    padding: 16px 24px 0 24px;
    background: var(--color-bg-white);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.file-thumbnail {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-off-white);
    overflow: hidden;
}

.file-thumbnail.pasted-content {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    border-style: dashed;
}

.file-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.file-thumbnail .file-icon {
    font-size: 24px;
    color: var(--color-text-tertiary);
    margin-bottom: 4px;
}

.file-thumbnail .file-name {
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-align: center;
    line-height: 1.2;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-thumbnail.pasted-content .file-icon {
    color: var(--color-primary);
}

.file-thumbnail.pasted-content .file-name {
    color: var(--color-primary);
    font-weight: 500;
}

.file-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-error);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.file-remove-btn:hover {
    background: var(--color-error-dark);
}

/* Screenshare Preview Styling - matches file preview pattern */
.screenshare-preview-container {
    padding: 16px 24px 0 24px;
    background: var(--color-bg-white);
    display: flex;
    gap: 12px;
}

.screenshare-preview-item {
    position: relative;
    width: 120px;
    height: 80px;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    background: var(--color-primary-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screenshare-preview-image {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

.screenshare-preview-label {
    font-size: 10px;
    color: var(--color-primary);
    text-align: center;
    padding: 4px;
    font-weight: 500;
    line-height: 1;
    background: var(--color-primary-light);
}

.chat-input-container {
    padding: 24px;
    background: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    outline: none;
    transition: all 0.15s ease;
    background: var(--color-bg-input);
    resize: none;
    overflow: hidden;
    min-height: 20px;
    max-height: 160px;
    line-height: var(--leading-normal);
    font-family: var(--font-sans);
}

#messageInput:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-white);
    box-shadow: var(--ring-primary);
}

.doc-context-indicator {
    display: none;
    color: var(--color-success);
    font-weight: bold;
    align-self: center;
    background: var(--color-success-bg-light);
    border: 1px solid var(--color-success);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.doc-context-indicator.active {
    display: flex;
}

/* Message file attachments */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.message-file {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 200px;
}

.message-file-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 4px;
    object-fit: cover;
}

.message-file-icon {
    font-size: 16px;
}

.message-file-name {
    font-size: 12px;
    color: var(--color-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message actions */
.message-actions {
    margin-top: 8px;
    margin-left: 4px;
}

.copy-to-document-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-to-document-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateX(2px);
}

.copy-to-document-btn:active {
    transform: translateX(1px);
}

/* Message formatting */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: var(--color-text-primary);
}

.message-bubble h1 {
    font-size: 20px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
}

.message-bubble h2 {
    font-size: 18px;
}

.message-bubble h3 {
    font-size: 16px;
}

.message-bubble p {
    margin: 12px 0;
    line-height: 1.6;
}

.message-bubble ul, .message-bubble ol {
    margin: 12px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-bubble code {
    background: var(--color-bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
}

.message-bubble pre {
    background: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
}

.message-bubble blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--color-text-tertiary);
    font-style: italic;
}

.message-bubble strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

.message-bubble em {
    font-style: italic;
    color: #57534e;
}

/* Multi-agent controls */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.agent-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-selector {
    position: relative;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-width: 120px;
}

.agent-selector:hover {
    background: var(--color-bg-input);
    border-color: var(--color-bg-disabled);
}

.agent-selector-text {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.agent-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Agent dropdown */
.agent-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    z-index: 1000;
    overflow: hidden;
}

.agent-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-bg-subtle);
    transition: background 0.2s ease;
}

.agent-dropdown-item:last-child {
    border-bottom: none;
}

.agent-dropdown-item:hover {
    background: var(--color-bg-input);
}

.agent-badge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agent-name {
    flex: 1;
    font-size: 14px;
    color: var(--color-text-primary);
    font-weight: 500;
}

.agent-actions {
    display: flex;
    gap: 4px;
}

.agent-edit-btn,
.agent-delete-btn {
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.agent-edit-btn:hover {
    background: var(--color-bg-subtle);
    color: var(--color-primary);
}

.agent-delete-btn:hover {
    background: var(--color-error-bg-light);
    color: var(--color-error);
}

.agent-active-label {
    font-size: 12px;
    color: var(--color-text-tertiary);
    font-style: italic;
    padding: 2px 6px;
    background: var(--color-bg-input);
    border-radius: 4px;
}

/* Turns control */
.turns-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.turns-label {
    font-size: 13px;
    color: var(--color-text-tertiary);
    font-weight: 500;
}

.turns-selector {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--color-text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.turns-selector:hover {
    border-color: var(--color-bg-disabled);
}

.turns-selector:focus {
    border-color: var(--color-primary);
}

/* Agent badge in messages */
.agent-badge-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.agent-badge-name {
    color: var(--color-text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal styles for agent management */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
}

.modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--color-text-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--color-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.cancel-btn,
.save-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cancel-btn {
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
}

.cancel-btn:hover {
    background: var(--color-border);
}

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

.save-btn:hover {
    background: var(--color-primary-hover);
}

