/* Global Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

/* Layout */
.container-fluid {
    max-width: 1400px;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Task List */
.task-list {
    max-height: 500px;
    overflow-y: auto;
}

.task-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-item:hover {
    background-color: #f8f9fa;
}

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

.task-item.pending {
    border-left: 4px solid #6c757d;
    background-color: #fff;
}

.task-item.running {
    border-left: 4px solid #007bff;
    background-color: #e7f3ff;
    animation: pulse 2s infinite;
}

.task-item.completed {
    border-left: 4px solid #28a745;
    background-color: #e8f5e8;
}

.task-item.error {
    border-left: 4px solid #dc3545;
    background-color: #ffe6e6;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.task-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.task-description {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 8px;
}

.task-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-status .badge {
    font-size: 0.75em;
}

/* Execution Results */
.execution-results {
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 0.375rem;
    border-left: 4px solid #007bff;
    background-color: #f8f9fa;
}

.result-item.success {
    border-left-color: #28a745;
    background-color: #e8f5e8;
}

.result-item.error {
    border-left-color: #dc3545;
    background-color: #ffe6e6;
}

.result-header {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-content {
    font-size: 0.9em;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Code Output */
.code-output {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
}

/* Canvas */
#outputCanvas {
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom scrollbar */
.task-list::-webkit-scrollbar,
.execution-results::-webkit-scrollbar,
.code-output::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track,
.execution-results::-webkit-scrollbar-track,
.code-output::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.task-list::-webkit-scrollbar-thumb,
.execution-results::-webkit-scrollbar-thumb,
.code-output::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.task-list::-webkit-scrollbar-thumb:hover,
.execution-results::-webkit-scrollbar-thumb:hover,
.code-output::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Markdown Rendered Results */
.result-content.markdown-body {
    font-size: 0.9em;
    word-break: break-word;
}

.result-content.markdown-body h1,
.result-content.markdown-body h2,
.result-content.markdown-body h3,
.result-content.markdown-body h4 {
    margin-top: 0.75em;
    margin-bottom: 0.4em;
    font-size: 1em;
    font-weight: 700;
}

.result-content.markdown-body p {
    margin-bottom: 0.5em;
}

.result-content.markdown-body ul,
.result-content.markdown-body ol {
    padding-left: 1.4em;
    margin-bottom: 0.5em;
}

.result-content.markdown-body code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.result-content.markdown-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 10px 12px;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-size: 0.85em;
    margin-bottom: 0.5em;
}

.result-content.markdown-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.result-content.markdown-body blockquote {
    border-left: 3px solid #007bff;
    padding-left: 0.75em;
    margin-left: 0;
    color: #6c757d;
}

.result-content.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.5em;
    font-size: 0.9em;
}

.result-content.markdown-body th,
.result-content.markdown-body td {
    border: 1px solid #dee2e6;
    padding: 0.3em 0.6em;
    text-align: left;
}

.result-content.markdown-body th {
    background-color: #f1f3f5;
    font-weight: 600;
}

/* Keyboard shortcut hint */
.kbd-hint {
    font-size: 0.75em;
    color: #6c757d;
    margin-top: 0.25rem;
}

kbd {
    background-color: #e9ecef;
    border: 1px solid #adb5bd;
    border-radius: 3px;
    padding: 0.1em 0.3em;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

@media (max-width: 991.98px) {
    .col-lg-4 {
        margin-bottom: 1rem;
    }
    
    .card {
        height: auto !important;
    }
    
    .task-list,
    .execution-results {
        max-height: 300px;
    }
}

/* Attached files chip strip */
.attached-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.78em;
    padding: 0.25em 0.5em;
}

/* Image preview in task input */
#imagePreview img {
    border-radius: 0.375rem;
    object-fit: cover;
}

/* LLM badge on task items */
.llm-badge {
    font-size: 0.7em;
    font-weight: 600;
}

/* Settings tabs */
#settingsTabs .nav-link {
    font-size: 0.9em;
    padding: 0.4rem 0.75rem;
}
