:root {
    --primary-color: #343541;
    --secondary-color: #444654;
    --accent-color: #10a37f;
    --text-color: #ffffff;
    --message-bg-user: #343541;
    --message-bg-ai: #444654;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0;
    --error-color: #ff3b30;
    --success-color: #10a37f;
    --border-color: #565869;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--primary-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #2A2B32 0%, #343541 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: width var(--transition-speed) ease-in-out;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

.container.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: 0;
}

.sidebar-toggle {
    position: absolute;
    left: var(--sidebar-width);
    top: 20px;
    z-index: 100;
    padding: 10px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: left var(--transition-speed) ease-in-out;
    border: 1px solid var(--border-color);
    border-left: none;
}

.container.sidebar-collapsed .sidebar-toggle {
    left: 0;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
    opacity: 0.9;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: #0d8c6b;
}

.settings-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.settings-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    margin: 20px 0;
}

.chat-history-item {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-history-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.chat-history-item.active {
    background-color: var(--secondary-color);
    border-color: var(--accent-color);
}

.chat-preview {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.delete-chat-btn {
    background: transparent;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-chat-btn:hover {
    opacity: 1;
    background-color: rgba(255, 68, 68, 0.1);
}

.chat-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-preview-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.chat-preview-time {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
}

.profile-selector select {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
/* Profile selection required highlight */
.highlight-required {
    border: 2px solid var(--error-color) !important;
    animation: pulse-highlight 1.5s infinite, shake 0.5s ease-in-out;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Profile selection message bubble */
.profile-selection-message {
    width: 300px;
    background-color: var(--error-color);
    color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: absolute;
    pointer-events: none; /* Allow clicks to pass through */
    border: 2px solid #fff;
}

.profile-selection-message .message-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 1.1rem;
}

.profile-selection-message i {
    font-size: 1.4rem;
    animation: pulse-icon 1s infinite;
}

@keyframes pulse-icon {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.profile-selection-message .message-arrow {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid var(--error-color);
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.2));
}

.profile-selection-message.fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    50% { opacity: 1; transform: scale(1.05) translateY(-5px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fade-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease-in-out;
}

.container.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.chat-header {
    padding: 15px 20px;
    background-color: var(--primary-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.chat-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-color);
    font-size: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.icon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-color);
    border-radius: inherit;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    z-index: 1;
}

.icon-btn:hover {
    background-color: rgba(16, 163, 127, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.icon-btn:hover::before {
    opacity: 0.05;
    transform: scale(1);
}

.icon-btn.active {
    color: var(--accent-color);
    background-color: rgba(16, 163, 127, 0.15);
    border-color: var(--accent-color);
}

.icon-btn i {
    font-size: 1.1rem;
    position: relative;
    z-index: 2;
    transition: all 0.2s ease;
}

/* Ensure the icon color changes when button is active */
.icon-btn.active i {
    color: white !important;
}

.icon-btn:hover i {
    transform: scale(1.1);
}

/* Deep Think Button */
#deepThinkBtn {
    position: relative;
}

/* Hide the search button since it's not working */
#urlSearchBtn {
    display: none;
}

#deepThinkBtn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    position: relative;
    overflow: visible;
    color: white;
}

#deepThinkBtn.active i {
    color: white;
}

#deepThinkBtn.active::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--accent-color);
    border-radius: 50%;
    filter: blur(15px);
    opacity: 0.3;
    z-index: -1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.1;
    }
    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

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

.message {
    width: 60%;
    margin: 8px auto;
    padding: 15px 20px;
    position: relative;
    color: var(--text-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user {
    background-color: #10a37f;
    border-radius: 20px 20px 0 20px;
    align-self: flex-end;
    margin-right: 40px;
    margin-left: 15%;
}

.message.assistant {
    background-color: #444654;
    border-radius: 20px 20px 20px 0;
    align-self: flex-start;
    margin-left: 40px;
    margin-right: 15%;
    padding: 30px;
}

.message.system {
    background-color: var(--secondary-color);
    border-radius: 10px;
    width: 80%;
    margin: 10px auto;
    text-align: center;
    font-style: italic;
    opacity: 0.8;
}

.message + .message {
    margin-top: 12px;
}

.message pre {
    margin: 10px 0;
}

.message-content {
    line-height: 1.8;
    font-size: 1rem;
    word-wrap: break-word;
}

.message-timestamp {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 8px;
    text-align: right;
}

/* Deep Think Message Styling */
.message.assistant .thinking-process {
    background-color: var(--secondary-color);
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
}

.message.assistant .thinking-process h3 {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.message.assistant .problem-deconstruction,
.message.assistant .hypothesis-arena,
.message.assistant .verification-log,
.message.assistant .momentum-report,
.message.assistant .final-confidence {
    margin: 10px 0;
    padding: 10px;
    border-left: 3px solid var(--accent-color);
    background-color: rgba(16, 163, 127, 0.1);
}

.message.assistant .confidence-score {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1.1rem;
    margin: 10px 0;
}

/* Code Block Styles */
.message pre {
    background-color: #1e1e1e !important;
    border-radius: 6px;
    margin: 15px 0;
    position: relative;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.message pre code {
    font-family: 'Fira Code', 'Consolas', monospace;
    padding: 15px;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background-color: #2d2d2d;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    color: #888;
    border-bottom: 1px solid var(--border-color);
}

.code-copy-btn {
    background: transparent;
    border: 1px solid #666;
    color: #888;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.code-copy-btn:hover {
    background-color: #666;
    color: white;
}

/* File Drop Zone */
.file-drop-zone {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 3px dashed var(--accent-color);
    border-radius: 10px;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.file-drop-zone.active {
    display: flex;
    pointer-events: all;
}

.file-drop-zone.dragging {
    background-color: rgba(16, 163, 127, 0.1);
    border-color: var(--accent-color);
}

.file-drop-message {
    color: var(--text-color);
    font-size: 1.2rem;
    text-align: center;
    pointer-events: none;
}

.file-drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1001;
}

/* Chat Input */
.chat-input-container {
    padding: 20px;
    background-color: var(--primary-color);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}


#userInput {
    flex: 1;
    padding: 12px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    resize: none;
    min-height: 50px;
    max-height: 200px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    position: relative; /* For the pseudo-element */
}

/* Overlay for disabled input to capture clicks */
#userInput:disabled {
    position: relative;
}

#userInput:disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    cursor: not-allowed;
}

/* Animation for disabled input when clicked */
#userInput:disabled:active,
#userInput:disabled:focus {
    animation: shake-input 0.5s ease-in-out, flash-border 1s ease !important;
    border: 3px solid var(--error-color) !important;
    background-color: rgba(255, 59, 48, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.6) !important;
}

#userInput:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Input error animation - more pronounced */
.input-error-animation {
    animation: shake-input 0.5s ease-in-out, flash-border 1s ease;
    border: 3px solid var(--error-color) !important;
    background-color: rgba(255, 59, 48, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.6);
    transition: all 0.3s ease !important;
    z-index: 100;
    position: relative;
}

@keyframes shake-input {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes flash-border {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 25px rgba(255, 59, 48, 0.8); }
}

.attach-btn {
    padding: 12px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: all 0.2s;
}

.attach-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

#sendBtn {
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

#sendBtn:hover {
    background-color: #0d8c6b;
}

/* Thinking Indicator */
.thinking {
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dot-flashing {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    animation: dot-flashing 1s infinite linear alternate;
    animation-delay: .5s;
}

.dot-flashing::before, .dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
}

.dot-flashing::before {
    left: -15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 0s;
}

.dot-flashing::after {
    left: 15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 1s;
}

@keyframes dot-flashing {
    0% {
        background-color: var(--accent-color);
    }
    50%, 100% {
        background-color: rgba(16, 163, 127, 0.2);
    }
}

/* Thinking Process Styling */
.thinking-process-container {
    width: 90%;
    margin: 10px auto;
    padding: 0;
    background-color: transparent;
    border-radius: 10px;
}

.thinking-toggle-btn {
    width: 100%;
    padding: 10px;
    background-color: rgba(16, 163, 127, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.thinking-toggle-btn:hover {
    background-color: rgba(16, 163, 127, 0.2);
}

.thinking-toggle-btn i {
    font-size: 1.1rem;
}

.thinking-process-content {
    margin-top: 10px;
    padding: 15px;
    background-color: rgba(68, 70, 84, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

.thinking-process-content h3 {
    color: var(--accent-color);
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 1rem;
}

.thinking-process-content ul,
.thinking-process-content ol {
    padding-left: 20px;
    margin: 10px 0;
}

.thinking-process-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.thinking-process-content th,
.thinking-process-content td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.thinking-process-content th {
    background-color: rgba(16, 163, 127, 0.2);
}

/* Live Thinking Process Styling */
.live-thinking-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    margin-bottom: 10px;
    color: var(--accent-color);
    font-style: italic;
    position: relative;
}

.live-thinking-indicator::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 10px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse-thinking 1.5s infinite;
}

@keyframes pulse-thinking {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

/* Highlight the live thinking process container */
.thinking-process-container.live-container {
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(16, 163, 127, 0.3);
    animation: highlight-container 2s infinite alternate;
}

/* For browsers that support :has() */
@supports (selector(:has(.live-thinking-indicator))) {
    .thinking-process-container:has(.live-thinking-indicator) {
        border: 1px solid var(--accent-color);
        box-shadow: 0 0 10px rgba(16, 163, 127, 0.3);
        animation: highlight-container 2s infinite alternate;
    }
}

@keyframes highlight-container {
    from {
        box-shadow: 0 0 5px rgba(16, 163, 127, 0.2);
    }
    to {
        box-shadow: 0 0 15px rgba(16, 163, 127, 0.4);
    }
}

/* Profile Modal Specific Styles */
#profileModal .modal-content {
    max-width: 800px;
}

#profileModal .form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

#profileModal .form-field {
    position: relative;
    margin-bottom: 20px;
}

#profileModal .form-field label {
    position: absolute;
    left: 45px;
    top: -10px;
    background-color: var(--primary-color);
    padding: 0 5px;
    font-size: 12px;
    color: var(--text-color);
}

#profileModal .field-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
}

/* Attached Files Styles */
.attached-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px auto;
    padding: 15px;
    background-color: rgba(16, 163, 127, 0.1);
    border-radius: 10px;
    width: 80%;
    border: 1px solid var(--accent-color);
}

.files-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--secondary-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.file-name {
    font-weight: bold;
    flex-grow: 1;
}

.file-size {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.8rem;
}

.remove-file {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.remove-file:hover {
    opacity: 1;
}

/* Login and User Management Styles */
#appLoginModal .modal-content {
    max-width: 400px;
    margin: 10% auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

#appLoginModal .modal-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#appLoginModal .modal-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.login-section {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--primary-color);
}

.login-section .form-field {
    position: relative;
    margin-bottom: 20px;
}

.login-section .form-field input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

.login-section .form-field input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.login-section .form-field label {
    position: absolute;
    left: 45px;
    top: -10px;
    background-color: var(--primary-color);
    padding: 0 5px;
    font-size: 12px;
    color: var(--text-color);
    z-index: 1;
}

.login-section .field-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-size: 1.1rem;
}

.login-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.login-btn:hover {
    background-color: #0d8c6b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.error-message {
    background-color: rgba(255, 59, 48, 0.1);
    border-left: 3px solid var(--error-color);
    padding: 10px;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
    color: var(--error-color) !important;
}

/* User Management Styles */
.user-management-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-user-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.add-user-form input,
.add-user-form select {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: var(--text-color);
}

.add-user-form button {
    padding: 8px 15px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-user-form button:hover {
    background-color: #0d8c6b;
}

#usersList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--secondary-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.username {
    font-weight: bold;
}

.role-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.role-badge.admin {
    background-color: var(--accent-color);
    color: white;
}

.role-badge.user {
    background-color: #666;
    color: white;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.edit-user-btn,
.delete-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.edit-user-btn {
    color: var(--accent-color);
}

.delete-user-btn {
    color: var(--error-color);
}

.edit-user-btn:hover,
.delete-user-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* User display in sidebar */
.user-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.current-user {
    font-weight: bold;
    font-size: 0.9rem;
}

/* Logout button */
.logout-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logout-btn:hover {
    background-color: rgba(255, 59, 48, 0.1);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        z-index: 1000;
    }

    .sidebar-toggle {
        display: block;
    }

    .container.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .message {
        max-width: 95%;
    }

    .chat-input-container {
        padding: 10px;
    }

    .chat-actions {
        gap: 10px;
    }

    .icon-btn {
        padding: 8px;
    }
    
    .attached-files {
        width: 95%;
    }
    
    #appLoginModal .modal-content {
        width: 90%;
        margin: 20% auto;
    }
    
    .add-user-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Crawler Styles */
/* URL Processing Styles */
.url-item {
    padding: 8px;
    margin: 4px 0;
    background: #343541;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
}

.url-item.processing {
    color: var(--text-color);
    background: #444654;
    border-left: 4px solid #10a37f;
}

.url-item.error {
    background: rgba(255, 59, 48, 0.2);
    border-left: 4px solid var(--error-color);
}

.progress-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

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

.url-error {
    color: var(--error-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.retry-url {
    background: none;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.retry-url:hover {
    background: var(--error-color);
    color: var(--text-color);
    transform: translateY(-1px);
}

.remove-url-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    color: var(--text-color);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.remove-url-btn:hover {
    color: var(--error-color);
    opacity: 1;
}

/* URL Search Modal Specific Styles */
#urlSearchModal .modal-content {
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

#urlSearchModal .modal-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

#urlSearchModal .modal-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
}

#urlSearchModal .form-section {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--primary-color);
}

/* URL Search Input Styling */
#urlSearchModal .form-field {
    position: relative;
    margin-bottom: 20px;
}

#urlSearchModal .form-field input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

#urlSearchModal .form-field input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

#urlSearchModal .form-field label {
    position: absolute;
    left: 45px;
    top: -10px;
    background-color: var(--primary-color);
    padding: 0 5px;
    font-size: 12px;
    color: var(--text-color);
    z-index: 1;
}

#urlSearchModal .field-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Crawler Options Styling */
.crawler-options {
    position: relative;
    margin: 15px 0;
}

.option-group-container {
    display: flex;
    gap: 15px;
    margin-left: 45px;
    padding: 15px;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group label {
    font-size: 0.9rem;
    color: var(--text-color);
}

.option-group input {
    width: 70px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--primary-color);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.option-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.options-label {
    position: absolute;
    left: 45px;
    top: -10px;
    background-color: var(--primary-color);
    padding: 0 5px;
    font-size: 12px;
    color: var(--text-color);
    z-index: 1;
}

/* Progress Container Styling */
.progress-container {
    margin: 20px 0;
    padding: 15px;
    background-color: rgba(16, 163, 127, 0.1);
    border-radius: 8px;
    border: 1px solid var(--accent-color);
}

.progress-label {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-color);
    font-weight: bold;
}

.progress-bar {
    height: 10px;
    background-color: var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
    box-shadow: 0 1px 3px rgba(16, 163, 127, 0.5);
}

.status-message {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
}

/* Button Styling */
.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Start Crawl Button */
#startCrawlBtn {
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#startCrawlBtn:hover {
    background-color: #0d8c6b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#startCrawlBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

/* Cancel Button */
.cancel-btn {
    background-color: var(--error-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.cancel-btn:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

/* Crawl summary in chat */
.crawl-summary {
    background-color: rgba(16, 163, 127, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 10px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.crawl-summary-header {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--accent-color);
}

.crawl-summary-content {
    padding-left: 15px; /* Add left padding to prevent content from extending over the left border */
}

/* Show the search button */
#urlSearchBtn {
    display: block;
}

/* Crawler Progress in Chat */
.crawl-progress {
    margin: 10px 0;
    padding: 12px;
    background: rgba(16, 163, 127, 0.1);
    border-radius: 8px;
}

.message.system .crawl-progress .progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.message.system .crawl-progress .progress-fill {
    height: 100%;
    width: 45%;
    background: var(--accent-color);
    animation: progress-indeterminate 2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.message.system .crawl-progress .progress-text {
    font-size: 0.9rem;
    color: var(--accent-color);
    text-align: center;
}
/* --- Spinner Animation for File Processing --- */
.spinner {
  width: 24px; /* Size of spinner */
  height: 24px;
  border: 4px solid rgba(255, 255, 255, 0.2); /* Light grey track */
  border-radius: 50%;
  border-top-color: var(--accent-color, #ffffff); /* Color of the spinning part */
  animation: spin 1s linear infinite;
  margin: 8px auto 0 auto; /* Center below text with some top margin */
  display: block; /* Ensure it takes its own line */
}

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

/* Optional: Adjust spacing in the system message */
.message.system div:first-child + .spinner {
  /* Targets spinner immediately following the text div */
  margin-top: 8px;
}
.message.system div:first-child {
    /* Ensure text doesn't have extra bottom margin if spinner is present */
    margin-bottom: 0;
}

