:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e3f2fd;
    --success-color: #28a745;
    --success-dark: #1e7e34;
    --success-light: #f1f8e9;
    --background-color: #ffffff;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #333333;
    --text-muted: #666666;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 123, 255, 0.2);
    --border-radius: 8px;
    --border-radius-large: 12px;
}

body {
    background-color: var(--background-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.task-selection-section {
    background: var(--surface-color);
    border-radius: var(--border-radius-large);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-medium);
    border-left: 4px solid var(--primary-color);
}

.task-instructions {
    background: var(--primary-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
    border-left: 4px solid var(--primary-dark);
    display: none;
}

.task-instructions.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.task-instructions h3 {
    color: var(--primary-dark);
    margin-top: 0;
    margin-bottom: 1rem;
}

.task-instructions-content {
    color: var(--text-color);
    line-height: 1.6;
}

.chat-container {
    height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 1rem;
    background: var(--surface-color);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-light);
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    animation: fadeIn 0.3s ease-in;
}

.message-user {
    background-color: var(--primary-light);
    margin-left: 2rem;
    text-align: right;
}

.message-assistant {
    background-color: var(--success-light);
    margin-right: 2rem;
}

.message-system {
    background-color: #f5f5f5;
    font-style: italic;
}

.message-role {
    font-weight: bold;
    margin-bottom: 0.25rem;
    display: block;
}

.text-area {
    height: 300px;
    resize: vertical;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    padding: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.text-area:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.content-section {
    background: var(--surface-color);
    border-radius: var(--border-radius-large);
    padding: 2rem;
    box-shadow: var(--shadow-medium);
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.section-header {
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), var(--success-dark));
    border: none;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

select {
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    background: var(--surface-color);
    color: var(--text-color);
    box-sizing: border-box;
}

select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="text"] {
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    background: var(--surface-color);
    color: var(--text-color);
    box-sizing: border-box;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="text"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #721c24;
}

.text-muted {
    color: var(--text-muted);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


.loading-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

.loading-spinner.htmx-indicator {
    display: inline-block;
}

.htmx-request .btn-primary,
.htmx-request .btn-success {
    opacity: 0.8;
    pointer-events: none;
}

.htmx-request .btn-text {
    opacity: 0.7;
}

/* Additional form-level loading states */
form.htmx-request button {
    opacity: 0.8;
    pointer-events: none;
}

/* Remove the conflicting rule and add proper HTMX indicator support */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* Additional form-level loading states */
form.htmx-request button {
    opacity: 0.8;
    pointer-events: none;
}

form.htmx-request .loading-spinner {
    display: inline-block;
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
    }

    .main-container {
        padding: 1rem;
    }
}

/* sidebar */
.tab-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
}

.tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active:hover {
    background: #0056b3;
}