/* Agent Chat Panel Styles */
.agent-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
}

.agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: #0066cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #2d2d2d;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.agent-input-area {
    display: flex;
    padding: 10px;
    background: #252525;
    border-top: 1px solid #333;
    gap: 8px;
}

#agent-input {
    flex: 1;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px 12px;
    color: #e0e0e0;
    font-size: 13px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

#agent-input:focus {
    outline: none;
    border-color: #0066cc;
}

.btn-agent-send {
    background: #0066cc;
    border: none;
    border-radius: 8px;
    color: white;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-agent-send:hover {
    background: #0052a3;
}

.btn-agent-send:disabled {
    background: #444;
    cursor: not-allowed;
}

/* Code blocks in chat */
.code-block {
    background: #1a1a1a;
    border-radius: 8px;
    margin: 8px 0;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #252525;
    border-bottom: 1px solid #333;
}

.code-lang {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.code-actions {
    display: flex;
    gap: 6px;
}

.btn-code-action {
    background: #333;
    border: none;
    border-radius: 4px;
    color: #aaa;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-code-action:hover {
    background: #444;
    color: white;
}

.btn-apply-code {
    background: #1a5c1a;
    color: #8f8;
}

.btn-apply-code:hover {
    background: #2a7c2a;
}

.code-block pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #d4d4d4;
}

.inline-code {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px !important;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Files Panel Styles */
.files-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
}

.files-toolbar {
    display: flex;
    padding: 8px;
    background: #252525;
    border-bottom: 1px solid #333;
    gap: 6px;
}

.btn-files {
    background: #333;
    border: none;
    border-radius: 4px;
    color: #aaa;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-files:hover {
    background: #444;
    color: white;
}

.file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 10px;
    border: 2px dashed #444;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.file-dropzone:hover,
.file-dropzone.dragover {
    border-color: #0066cc;
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
}

.file-dropzone i {
    font-size: 24px;
    margin-bottom: 8px;
}

.file-dropzone span {
    font-size: 12px;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 8px;
}

.file-item:hover {
    background: #2d2d2d;
}

.file-item.active {
    background: #0066cc33;
}

.file-icon {
    color: #888;
    width: 20px;
    text-align: center;
}

.file-name {
    flex: 1;
    color: #e0e0e0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #666;
    font-size: 11px;
}

.file-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.btn-file-action {
    background: none;
    border: none;
    color: #888;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-file-action:hover {
    background: #444;
    color: #ff6b6b;
}

.no-files {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 13px;
}

/* Upload progress bar */
.upload-progress {
    height: 6px;
    margin: 8px 10px;
    border-radius: 3px;
    background: #333;
}

.upload-progress::-webkit-progress-bar {
    background: #333;
    border-radius: 3px;
}

.upload-progress::-webkit-progress-value {
    background: #0066cc;
    border-radius: 3px;
}

/* File item copied feedback */
.file-item.copied {
    background: #1a5c1a33;
}

.file-item.copied .file-name::after {
    content: ' (copied!)';
    color: #8f8;
    font-size: 11px;
}

/* Insert button */
.btn-insert:hover {
    color: #8f8;
}

/* Copy button */
.btn-copy:hover {
    color: #88f;
}

/* Browser nav buttons */
#btn-back:disabled,
#btn-forward:disabled {
    opacity: 0.5;
}

/* ============================================
   Diff Viewer Styles
   ============================================ */

.diff-viewer-modal {
    padding: 0;
}

.diff-viewer-modal h3 {
    margin: 0;
    padding: 15px 20px;
    background: #252525;
    border-bottom: 1px solid #333;
    color: #e0e0e0;
    font-size: 16px;
}

.diff-viewer-modal h3 i {
    margin-right: 8px;
    color: #667eea;
}

.diff-container {
    max-height: 60vh;
    overflow: auto;
    background: #1a1a1a;
}

.diff-actions {
    padding: 15px 20px;
    background: #252525;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Simple diff fallback */
.simple-diff {
    display: flex;
    gap: 0;
}

.diff-pane {
    flex: 1;
    overflow: auto;
}

.diff-pane h4 {
    margin: 0;
    padding: 8px 12px;
    background: #2d2d2d;
    font-size: 12px;
    color: #888;
    border-bottom: 1px solid #333;
}

.diff-old h4 {
    background: #3d2222;
    color: #faa;
}

.diff-new h4 {
    background: #223d22;
    color: #afa;
}

.diff-pane pre {
    margin: 0;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
    background: transparent;
    white-space: pre-wrap;
}

/* Diff2Html overrides */
.d2h-wrapper {
    background: #1a1a1a !important;
}

.d2h-file-header {
    display: none;
}

.d2h-code-line {
    font-size: 12px !important;
    font-family: 'Monaco', 'Menlo', monospace !important;
}

.d2h-code-side-linenumber {
    background: #252525 !important;
    color: #666 !important;
}

/* ============================================
   File Viewer Styles
   ============================================ */

.file-viewer {
    min-width: 500px;
    max-width: 90vw;
}

.viewer-header {
    padding: 15px 20px;
    background: #252525;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-header h3 {
    margin: 0;
    font-size: 16px;
    color: #e0e0e0;
}

.viewer-header h3 i {
    margin-right: 8px;
    color: #667eea;
}

.file-meta {
    font-size: 12px;
    color: #888;
}

.viewer-content {
    padding: 0;
    background: #1a1a1a;
    max-height: 60vh;
    overflow: auto;
}

/* Image viewer */
.image-viewer .viewer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: repeating-conic-gradient(#222 0% 25%, #2a2a2a 0% 50%) 50% / 20px 20px;
}

.image-viewer .viewer-content img {
    max-width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Video viewer */
.video-viewer .viewer-content {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #000;
}

.video-viewer video {
    max-width: 100%;
    max-height: 55vh;
    border-radius: 4px;
}

/* Code viewer */
.code-viewer .viewer-content pre {
    margin: 0;
    padding: 0;
    background: transparent;
}

.code-viewer .viewer-content code {
    display: block;
    padding: 15px 20px;
    font-size: 13px;
    line-height: 1.6;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    white-space: pre;
    overflow-x: auto;
}

.viewer-actions {
    padding: 15px 20px;
    background: #252525;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.viewer-actions .btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.viewer-actions .btn-default {
    background: #333;
    border: 1px solid #444;
    color: #e0e0e0;
}

.viewer-actions .btn-default:hover {
    background: #444;
}

.viewer-actions .btn-primary {
    background: #0066cc;
    border: 1px solid #0066cc;
    color: white;
}

.viewer-actions .btn-primary:hover {
    background: #0077ee;
}

/* ============================================
   Highlight.js Code Block Enhancements
   ============================================ */

.code-block pre {
    margin: 0;
    background: #1a1a1a;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.code-block pre code.hljs {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    background: #1a1a1a;
}

/* Diff button styling */
.btn-diff-code {
    background: transparent;
    color: #888;
}

.btn-diff-code:hover {
    color: #667eea;
}

/* ============================================
   Editable Diff Viewer Styles
   ============================================ */

.editable-diff {
    width: 90vw;
    max-width: 1400px;
    min-height: 500px;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #252525;
    border-bottom: 1px solid #333;
}

.diff-header h3 {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}

.diff-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.diff-stat-add {
    color: #4ade80;
}

.diff-stat-remove {
    color: #f87171;
}

.diff-editors-container {
    display: flex;
    height: 55vh;
    background: #1a1a1a;
}

.editable-diff .diff-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.diff-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2d2d2d;
    border-bottom: 1px solid #333;
}

.diff-current .diff-pane-header {
    background: #2d2222;
}

.diff-new .diff-pane-header {
    background: #223d22;
}

.diff-pane-title {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.diff-current .diff-pane-title {
    color: #f87171;
}

.diff-new .diff-pane-title {
    color: #4ade80;
}

.diff-pane-hint {
    font-size: 11px;
    color: #666;
}

.diff-editor {
    flex: 1;
    overflow: hidden;
}

.diff-editor .CodeMirror {
    height: 100%;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    background: #1a1a1a;
}

.diff-editor .CodeMirror-gutters {
    background: #252525;
    border-right: 1px solid #333;
}

.diff-editor .CodeMirror-linenumber {
    color: #666;
}

/* Diff line highlighting */
.diff-added {
    background: rgba(74, 222, 128, 0.15) !important;
}

.diff-added-gutter {
    background: rgba(74, 222, 128, 0.3) !important;
}

.diff-removed {
    background: rgba(248, 113, 113, 0.15) !important;
}

.diff-removed-gutter {
    background: rgba(248, 113, 113, 0.3) !important;
}

/* Chunk gutter (middle column with toggle buttons) */
.diff-gutter {
    width: 40px;
    background: #252525;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
    gap: 4px;
    overflow-y: auto;
}

.chunk-toggle {
    width: 28px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: #333;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chunk-toggle:hover {
    background: #444;
    color: #fff;
}

.chunk-toggle.staged {
    background: #1a5c1a;
    color: #4ade80;
}

.chunk-toggle.staged:hover {
    background: #2a7c2a;
}

.chunk-add {
    border-left: 2px solid #4ade80;
}

.chunk-remove {
    border-left: 2px solid #f87171;
}

/* Diff action buttons */
.editable-diff .diff-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #252525;
    border-top: 1px solid #333;
}

.diff-action-left,
.diff-action-right {
    display: flex;
    gap: 8px;
}

.editable-diff .btn {
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.editable-diff .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
}

.editable-diff .btn-default {
    background: #333;
    color: #e0e0e0;
}

.editable-diff .btn-default:hover {
    background: #444;
}

.editable-diff .btn-primary {
    background: #0066cc;
    color: white;
}

.editable-diff .btn-primary:hover {
    background: #0077ee;
}

.editable-diff .btn-primary:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.editable-diff .btn-success {
    background: #1a5c1a;
    color: #4ade80;
}

.editable-diff .btn-success:hover {
    background: #2a7c2a;
}

.btn-stage-all,
.btn-unstage-all {
    background: #333;
    color: #888;
}

.btn-stage-all:hover {
    background: #1a5c1a;
    color: #4ade80;
}

.btn-unstage-all:hover {
    background: #5c1a1a;
    color: #f87171;
}

/* Load more messages button */
.load-more-container {
    text-align: center;
    padding: 8px;
    margin-bottom: 8px;
}

.btn-load-more {
    background: #333;
    border: 1px solid #444;
    border-radius: 16px;
    color: #aaa;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: #444;
    color: #fff;
    border-color: #555;
}

.btn-load-more i {
    margin-right: 6px;
}

/* History indicator */
.chat-history-indicator {
    text-align: center;
    color: #666;
    font-size: 11px;
    padding: 4px;
    margin: 4px 0;
}
