.judge0-file-menu {
    min-width: 15rem !important;
}

#judge0-status-line {
    font-family: "JetBrains Mono" !important;
}

#judge0-status-line:empty {
    display: none;
}

.judge0-hidden {
    display: none !important;
}

@media (display-mode: standalone) {
    .judge0-standalone-hidden {
        display: none !important;
    }
}

/* Chat Component Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--vscode-editor-background, #1e1e1e);
    color: var(--vscode-editor-foreground, #d4d4d4);
    font-family: "JetBrains Mono", monospace;
}

.chat-header {
    padding: 10px;
    border-bottom: 1px solid var(--vscode-panel-border, #3c3c3c);
}

.chat-header select {
    width: 100%;
    background: var(--vscode-dropdown-background, #3c3c3c);
    color: var(--vscode-dropdown-foreground, #cccccc);
    border: 1px solid var(--vscode-dropdown-border, #3c3c3c);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
}

.chat-header input {
    width: 100%;
    background: var(--vscode-input-background, #3c3c3c);
    color: var(--vscode-input-foreground, #cccccc);
    border: 1px solid var(--vscode-input-border, #3c3c3c);
    border-radius: 4px;
    padding: 6px 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
}

.chat-header input:focus,
.chat-header select:focus {
    outline: none;
    border-color: var(--vscode-focusBorder, #007fd4);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.chat-message {
    max-width: 85%;
    margin: 4px 0;
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    position: relative;
}

.chat-message.outgoing {
    align-self: flex-end;
    background-color: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border-bottom-right-radius: 4px;
}

.chat-message.incoming {
    align-self: flex-start;
    background-color: var(--vscode-editor-inactiveSelectionBackground, #3a3d41);
    color: var(--vscode-editor-foreground, #d4d4d4);
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    gap: 8px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    position: relative;
}

.chat-input {
    flex: 1;
    background: var(--vscode-input-background, #3c3c3c);
    color: var(--vscode-input-foreground, #cccccc);
    border: 1px solid var(--vscode-input-border, #3c3c3c);
    border-radius: 4px;
    padding: 6px 10px;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    padding-right: 80px; /* Space for send button */
}

.chat-input:focus {
    outline: none;
    border-color: var(--vscode-focusBorder, #007fd4);
}

.chat-send-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    cursor: pointer;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
}

.chat-send-btn:hover {
    transform: translateY(-50%) scale(1.05);
}

.chat-send-btn i {
    font-size: 14px;
}

/* Make the popup draggable area look like VS Code */
.lm_header {
    background: var(--vscode-editor-background, #1e1e1e) !important;
    height: 32px !important;
    border-bottom: 1px solid var(--vscode-panel-border, #3c3c3c) !important;
}

.lm_tab {
    background: var(--vscode-tab-inactiveBackground, #2d2d2d) !important;
    color: var(--vscode-tab-inactiveForeground, #969696) !important;
    border: none !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    height: 32px !important;
    line-height: 24px !important;
}

.lm_tab.lm_active {
    background: var(--vscode-tab-activeBackground, #1e1e1e) !important;
    color: var(--vscode-tab-activeForeground, #ffffff) !important;
}

/* Code block formatting */
.chat-message pre {
    margin: 12px 0;
    padding: 32px 12px 12px;
    position: relative;
    background: var(--vscode-editor-background, #1e1e1e);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 6px;
}

.chat-message code {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--vscode-editor-background, #1e1e1e);
    padding: 2px 4px;
    border-radius: 3px;
}

.chat-message .code-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 2;
    background: var(--vscode-editor-background, #1e1e1e);
    padding: 4px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-message .code-action-btn {
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    opacity: 0.9;
    white-space: nowrap;
}

.chat-message .code-action-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.chat-message .code-action-btn.view-diff {
    background: var(--vscode-button-background, #0e639c);
}

.chat-message .code-action-btn.apply {
    background: var(--vscode-gitDecoration-addedResourceForeground, #81b88b);
}

.chat-message .code-action-btn.cancel {
    background: var(--vscode-button-secondaryBackground, #3c3c3c);
}

.chat-message .code-action-btn i {
    font-size: 14px;
}

/* Markdown formatting */
.chat-message h1, 
.chat-message h2, 
.chat-message h3, 
.chat-message h4 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--vscode-editor-foreground, #d4d4d4);
}

.chat-message p {
    margin: 8px 0;
}

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

.chat-message li {
    margin: 4px 0;
}

.chat-message blockquote {
    border-left: 3px solid var(--vscode-button-background, #0e639c);
    margin: 8px 0;
    padding-left: 12px;
    color: var(--vscode-descriptionForeground, #cccccc);
}

.chat-message a {
    color: var(--vscode-textLink-foreground, #3794ff);
    text-decoration: none;
}

.chat-message a:hover {
    text-decoration: underline;
}

.chat-message table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.chat-message th,
.chat-message td {
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    padding: 6px 8px;
}

.chat-message th {
    background-color: var(--vscode-editor-background, #1e1e1e);
}

/* Syntax highlighting for code blocks */
.chat-message .hljs-keyword,
.chat-message .hljs-selector-tag,
.chat-message .hljs-built_in,
.chat-message .hljs-name,
.chat-message .hljs-tag {
    color: #569cd6;
}

.chat-message .hljs-string,
.chat-message .hljs-title,
.chat-message .hljs-section,
.chat-message .hljs-attribute,
.chat-message .hljs-literal,
.chat-message .hljs-template-tag,
.chat-message .hljs-template-variable,
.chat-message .hljs-type,
.chat-message .hljs-addition {
    color: #ce9178;
}

.chat-message .hljs-comment,
.chat-message .hljs-quote,
.chat-message .hljs-deletion,
.chat-message .hljs-meta {
    color: #6a9955;
}

.chat-message .hljs-number,
.chat-message .hljs-regexp,
.chat-message .hljs-literal,
.chat-message .hljs-variable,
.chat-message .hljs-template-variable {
    color: #b5cea8;
}

/* Loading animation */
.chat-message .loading {
    color: var(--vscode-descriptionForeground, #cccccc);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-message .loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--vscode-button-background, #0e639c);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Selection Indicator Styles */
.selection-indicator {
    padding: 8px;
    margin: 8px 0;
    display: none;
}

.selection-info {
    display: flex;
    align-items: center;
    background: var(--vscode-editor-selectionBackground, rgba(73, 72, 62, 0.5));
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.selection-icon {
    margin-right: 8px;
}

.selection-text {
    flex-grow: 1;
    color: var(--vscode-editor-foreground, #d4d4d4);
}

.clear-selection {
    background: none;
    border: none;
    color: var(--vscode-editor-foreground, #d4d4d4);
    cursor: pointer;
    padding: 0 4px;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.clear-selection:hover {
    opacity: 1;
}

/* Inline Popup Styles */
.inline-popup {
    position: absolute;
    z-index: 1000;
    background: var(--vscode-editor-background, #1e1e1e);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    max-width: 400px;
}

.popup-actions {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.action-btn {
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    text-align: left;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background: var(--vscode-button-hoverBackground, #1177bb);
}

.popup-content {
    padding: 8px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    max-height: 300px;
    overflow-y: auto;
}

.popup-content .loading {
    color: var(--vscode-descriptionForeground, #cccccc);
    font-style: italic;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-content .error {
    color: var(--vscode-errorForeground, #f48771);
    padding: 8px;
}

.popup-content .response {
    padding: 8px;
    line-height: 1.4;
}

/* Code block styles in popup */
.popup-content pre {
    background: var(--vscode-editor-background, #1e1e1e);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 4px;
    padding: 8px;
    margin: 8px 0;
    overflow-x: auto;
}

.popup-content code {
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--vscode-button-background, #0e639c);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Selection Popup Styles */
.selection-popup {
    position: fixed;
    z-index: 1000;
    background: var(--vscode-editor-background, #1e1e1e);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 12px;
    min-width: 400px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.selection-popup.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.selection-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 12px;
    color: var(--vscode-editor-foreground, #d4d4d4);
    font-size: 13px;
    cursor: move;
    user-select: none;
}

.selection-popup-header .selection-icon {
    font-size: 16px;
}

.selection-popup-header .line-info {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
    background: var(--vscode-editor-inactiveSelectionBackground, #3a3d41);
    border-radius: 4px;
    color: var(--vscode-descriptionForeground, #cccccc);
}

.selection-popup-input-container {
    position: relative;
    margin-bottom: 12px;
}

.selection-popup-input {
    width: 100%;
    background: var(--vscode-input-background, #3c3c3c);
    color: var(--vscode-input-foreground, #cccccc);
    border: 1px solid var(--vscode-input-border, #3c3c3c);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.selection-popup-input:focus {
    outline: none;
    border-color: var(--vscode-focusBorder, #007fd4);
}

.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.selection-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selection-popup-btn:hover {
    background: var(--vscode-button-hoverBackground, #1177bb);
    transform: translateY(-1px);
}

.selection-popup-btn i {
    font-size: 14px;
}

.selection-popup-preview {
    margin: 12px -12px -12px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    background: var(--vscode-editor-background, #1e1e1e);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.preview-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--vscode-editor-inactiveSelectionBackground, #3a3d41);
    font-size: 12px;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--vscode-editor-foreground, #d4d4d4);
    font-weight: 500;
}

.preview-content {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.selection-popup-hint {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    color: var(--vscode-descriptionForeground, #cccccc);
    font-size: 11px;
    text-align: center;
}

.selection-popup-hint kbd {
    display: inline-block;
    padding: 2px 4px;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    line-height: 1;
    color: var(--vscode-editor-foreground, #d4d4d4);
    background: var(--vscode-editor-inactiveSelectionBackground, #3a3d41);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0,0,0,.2);
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--vscode-descriptionForeground, #cccccc);
}

.loading-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Selection Popup Styles */
.selection-popup-btn i {
    font-size: 14px;
}

.selection-popup-btn.ask-btn i {
    color: #4CAF50;
}

.selection-popup-btn.suggest-btn i {
    color: #2196F3;
}

.selection-popup-btn.cancel-btn i {
    color: #9E9E9E;
}

/* Code Preview Enhancements */
.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-actions button {
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-actions button i {
    font-size: 14px;
}

/* Loading Animation Enhancement */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-left: 4px;
}

.loading-dots span {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDots {
    0%, 100% { transform: scale(0.2); opacity: 0.2; }
    50% { transform: scale(1); opacity: 1; }
}

/* Diff View Styles */
.diff-view-container {
    margin: 8px -12px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    background: var(--vscode-editor-background, #1e1e1e);
    overflow: hidden;
}

.diff-container {
    width: 100%;
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
}

/* Enhanced Code Actions */
.code-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 2;
    background: var(--vscode-editor-background, #1e1e1e);
    padding: 4px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.code-action-btn {
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    opacity: 0.9;
    white-space: nowrap;
}

.code-action-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.code-action-btn.view-diff {
    background: var(--vscode-button-background, #0e639c);
}

.code-action-btn.apply {
    background: var(--vscode-gitDecoration-addedResourceForeground, #81b88b);
}

.code-action-btn.cancel {
    background: var(--vscode-button-secondaryBackground, #3c3c3c);
}

.code-action-btn i {
    font-size: 14px;
}

/* Popup Diff View */
.popup-diff-view {
    margin: 12px -12px;
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
    background: var(--vscode-editor-background, #1e1e1e);
    overflow: hidden;
}

.popup-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: var(--vscode-editor-background, #1e1e1e);
    border-top: 1px solid var(--vscode-panel-border, #3c3c3c);
}

.popup-action-btn {
    background: var(--vscode-button-background, #0e639c);
    color: var(--vscode-button-foreground, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.popup-action-btn:hover {
    transform: translateY(-1px);
}

.popup-action-btn.apply {
    background: var(--vscode-gitDecoration-addedResourceForeground, #81b88b);
}

.popup-action-btn.cancel {
    background: var(--vscode-button-secondaryBackground, #3c3c3c);
}

.popup-action-btn i {
    font-size: 14px;
}

/* Code Block Enhancements */
.chat-message pre {
    margin: 12px 0;
    padding: 32px 12px 12px;
    position: relative;
    background: var(--vscode-editor-background, #1e1e1e);
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 6px;
}

.chat-message pre code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    tab-size: 4;
}

/* Loading State */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--vscode-descriptionForeground, #cccccc);
}

.loading-spinner {
    border: 2px solid var(--vscode-button-background, #0e639c);
    border-top-color: transparent;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chat-message .diff-container {
    margin-top: 12px;
    border: 1px solid var(--vscode-panel-border, #3c3c3c);
    border-radius: 4px;
    overflow: hidden;
}
