:root {
    /* Light theme (default) */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    
    /* Background and text colors */
    --bg-color: white;
    --bg-secondary: #f3f4f6;
    --text-color: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
}

/* Dark theme */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --danger-color: #ef4444;
    --danger-hover: #f87171;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-600: #9ca3af;
    --gray-700: #d1d5db;
    --gray-800: #f3f4f6;
    
    /* Background and text colors */
    --bg-color: #111827;
    --bg-secondary: #1f2937;
    --text-color: #f3f4f6;
    --text-secondary: #d1d5db;
    --border-color: #374151;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--bg-secondary);
}

.navbar {
    background-color: var(--bg-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: #666;
    font-size: 0.9rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.hidden {
    display: none !important;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.actions {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    gap: 1rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
}

.filter-select {
    padding: 0.5rem !important;
    font-size: 0.875rem !important;
    margin-top: 0 !important;
}

.search-input {
    padding: 0.5rem !important;
    margin-top: 0 !important;
}

/* Buttons */
.primary-button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

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

.secondary-button {
    background-color: var(--gray-200);
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.secondary-button:hover {
    background-color: var(--gray-300);
}

.danger-button {
    background-color: var(--danger-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.danger-button:hover {
    background-color: var(--danger-hover);
}

/* Assistants List */
.assistants-list {
    display: grid;
    gap: 1rem;
}

.assistant-card {
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: white;
}

.assistant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.assistant-tools {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tool-tag {
    background-color: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--gray-100);
    margin: 3rem auto;
    padding: 2.5rem;
    border-radius: 1rem;
    max-width: 700px;
    max-height: 85vh;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

.close {
    float: right;
    cursor: pointer;
    font-size: 1.5rem;
}

/* Form */
.form-group {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: auto;
    box-sizing: border-box;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    margin-top: 0.5rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 100px;
}

.tools-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
}

.tools-checkboxes label {
    padding: 0.5rem 0;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.tools-checkboxes label:hover {
    background-color: var(--gray-100);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Header styling */
h1 {
    color: var(--gray-800);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 1rem;
}

.tool-resources-select select {
    width: 100%;
}

/* Specific styles for files multi-select */
#files-select {
    size: 5;
}

/* Model Configuration Styles */
.config-group {
    display: flex;
}

.slider-group {
    display: flex;
    gap: 2rem;
    width: 100%;
}

.slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-container input[type="range"] {
    width: 100%;
}

.slider-value {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* File Upload Styles */
.file-upload-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-name {
    font-size: 0.875rem;
    color: var(--gray-800);
}

.file-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.file-upload-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
}

.file-source-select{
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.file-source-select label {
    margin-bottom: 0;
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-source-select select {
    width: 100%;
    min-width: 150px;
    max-width: 300px;
    flex: 1;
}

.advanced-options {
    margin-top: 1rem;
    padding: 0 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.advanced-options-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.advanced-options-content {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.slider-container {
    display: flex;
    flex-direction: column;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    user-select: none;
    pointer-events: none;
    margin-bottom: 0;
}

.slider-value {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.file-list-loading {
    color: var(--gray-600);
    font-size: 0.875rem;
    text-align: center;
    padding: 0.5rem;
    font-style: italic;
}

.vector-store-container {
    margin-top: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    overflow: hidden;
}

.vector-store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.vector-store-title {
    font-weight: 500;
    color: var(--gray-800);
}

.vector-store-id {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.125rem;
}

.vector-store-files {
    padding: 0.5rem;
}

.vector-store-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.vector-store-file:last-child {
    border-bottom: none;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.file-upload-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.assistant-upload-progress-container {
    margin: 5px auto;
    width: calc(100% - 30px);
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    padding: 5px;
}

.assistant-upload-progress-bar {
    height: 3px;
    background-color: #4CAF50;
    border-radius: 1.5px;
    transition: width 0.3s ease-in-out;
}

.upload-progress-text {
    margin-top: 2px;
    font-size: 11px;
    color: #666;
    text-align: center;
}

.function-input-group {
    position: relative;
    margin-bottom: 10px;
}

.function-json-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
    font-size: 14px;
    line-height: 1;
}

.remove-function-button {
    position: absolute;
    right: -5px;
    top: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Files List Styles */
.files-container {
    margin: 0 auto;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    transition: border-color 0.2s ease;
}

.list-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-item.deleting {
    opacity: 0.5;
    pointer-events: none;
}

.list-item-title {
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--gray-800);
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
}

.error-message {
    padding: 1rem;
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.list-item-details {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Upload Progress Styles */
#uploadProgress {
    margin-top: 1rem;
}

.upload-progress-container {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.upload-filename {
    font-size: 0.875rem;
    color: var(--gray-800);
}

.upload-status {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.upload-progress-bar {
    background-color: var(--gray-200);
    border-radius: 0.25rem;
    height: 0.5rem;
    overflow: hidden;
}

.upload-progress-fill {
    background-color: var(--primary-color);
    height: 100%;
    width: 0;
    transition: width 0.2s ease;
}

.upload-complete .upload-progress-fill {
    background-color: #22c55e;
}

.upload-error .upload-progress-fill {
    background-color: var(--danger-color);
}

.upload-complete .upload-status {
    color: #22c55e;
}

.upload-error .upload-status {
    color: var(--danger-color);
}

.upload-file-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.upload-count {
    font-size: 0.75rem;
    color: var(--gray-600);
    background-color: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.load-more {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* Theme toggle button styles */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--gray-200);
}

.theme-toggle-icon {
    stroke: currentColor;
}

/* Add these dark mode styles for list items */
[data-theme="dark"] .list-item {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .list-item-title {
    color: var(--text-color);
}

[data-theme="dark"] .list-item-details {
    color: var(--text-secondary);
}

/* Make sure buttons and icons within list items are visible */
[data-theme="dark"] .list-item-actions button {
    color: var(--text-color);
    background-color: transparent;
}

[data-theme="dark"] .list-item-actions button:hover {
    background-color: var(--gray-200);
}

/* Dark mode styles for assistant cards */
[data-theme="dark"] .assistant-card {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .assistant-card h3 {
    color: var(--text-color);
}

[data-theme="dark"] .assistant-card p {
    color: var(--text-secondary);
}

/* Dark mode styles for action buttons and containers */
[data-theme="dark"] .actions {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .actions button {
    color: var(--text-color);
}

/* Ensure dropdown menus and other UI elements are visible in dark mode */
[data-theme="dark"] .dropdown-content {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dropdown-content a {
    color: var(--text-color);
}

[data-theme="dark"] .dropdown-content a:hover {
    background-color: var(--gray-200);
}

/* Fix assistant metadata display in dark mode */
[data-theme="dark"] .assistant-metadata {
    color: var(--text-secondary);
}

[data-theme="dark"] .tag {
    background-color: var(--gray-200);
    color: var(--text-color);
}