/* Terminal AI Chat Assistant - Main Styles */

/* ====== SCROLLBAR STYLES ====== */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ====== BACKGROUND STYLES ====== */
.gradient-bg {
  background: #2d1b69;
}

.welcome-gradient {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* ====== REASONING DROPDOWN STYLES ====== */
.reasoning-dropdown-button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.reasoning-dropdown-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.reasoning-dropdown-menu {
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.reasoning-option {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.reasoning-option:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.reasoning-option.selected {
  background-color: rgba(99, 102, 241, 0.05);
}

/* ====== MODEL SELECTOR STYLES ====== */
.model-dropdown-button {
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.model-dropdown-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.model-dropdown-menu {
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.model-option {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.model-option:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.model-option.selected {
  background-color: rgba(99, 102, 241, 0.05);
}

/* ====== ANIMATION STYLES ====== */
.message-enter {
  animation: messageSlideIn 0.3s ease-out;
}

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

.user-menu {
  animation: dropdownFadeIn 0.2s ease-out;
}

.user-menu.hidden {
  display: none;
}

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

/* ====== HOVER EFFECTS ====== */
.chat-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.file-attachment:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ====== SIDEBAR ANIMATIONS ====== */
.sidebar {
  transition: all 0.3s ease-in-out;
  z-index: 100;
}

.sidebar-collapsed {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
}

.sidebar-collapsed .sidebar-text-zone {
  display: none !important;
}

.main-content {
  transition: margin-left 0.3s ease-in-out;
}

.main-content-expanded {
  margin-left: 64px !important; /* Only account for icon zone width */
}

.sidebar-text-zone {
  transition: transform 0.3s ease-in-out;
  position: relative;
}

/* ====== STARTER QUESTION ANIMATIONS ====== */
.starter-question {
  cursor: pointer;
  transform: translateY(0);
}

.starter-question:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.starter-question:active {
  transform: translateY(0);
}

/* ====== TYPOGRAPHY ====== */
body {
  font-family:
    'Sora',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
}

/* ====== SIDEBAR HEADER SPACING ====== */
/* Add spacing between Terminal title and space name */
.sidebar-text-zone h1 {
  margin-right: 1rem;
}

#currentSpaceName {
  margin-left: 1rem;
}

/* ====== MARKDOWN CONTENT STYLES ====== */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-weight: 600;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.markdown-content h1 {
  font-size: 1.5rem;
}
.markdown-content h2 {
  font-size: 1.25rem;
}
.markdown-content h3 {
  font-size: 1.125rem;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-content li {
  margin-bottom: 0.25rem;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
}

.markdown-content pre {
  background-color: #f3f4f6;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 4px solid #d1d5db;
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 0.75rem;
  font-style: italic;
  color: #6b7280;
}

/* ====== CUSTOM UI COLORS ====== */
/* User chat bubble color */
.user-chat-bubble {
  background-color: #6e50ff !important;
}

/* Avatar colors */
.user-avatar {
  background-color: #f0edff !important;
  border: 2px solid #f9f7ff !important;
}

.user-avatar-text {
  color: #a390fe !important;
}

.assistant-avatar {
  background-color: #f0edff !important;
  border: 2px solid #f9f7ff !important;
}

.assistant-avatar-text {
  color: #a390fe !important;
}

/* Reasoning trail background */
.subqueries-container {
  background-color: #ffffff !important;
}

/* Subquery response background */
.subquery-response .bg-gray-50 {
  background-color: #ffffff !important;
}

/* Reasoning trail circle */
.reasoning-trail-circle,
.subquery-status {
  background-color: #cec4ff !important;
  border: 2px solid #f0edff !important;
}

/* Submit button color */
.submit-button {
  background-color: #6e50ff !important;
}

.submit-button:hover {
  background-color: #5a42d9 !important;
}

/* Sidebar colors */
.custom-sidebar-bg {
  background-color: #281941 !important;
}

/* Selected thread colors */
.bg-purple-50 {
  background-color: #f0edff !important;
}

.border-r-purple-500 {
  border-right-color: #6e50ff !important;
}

/* ====== MOBILE RESPONSIVENESS ====== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    z-index: 999;
    height: 100vh;
  }
}

/* ====== SPACE SELECTOR STYLES ====== */
#spaceSelector {
  transition:
    border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
}

#spaceSelector:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#spaceSelector option {
  padding: 8px 12px;
}

/* ====== OFFICE DOCUMENT PREVIEW INDICATORS ====== */
.office-doc-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: #3b82f6;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.office-doc-indicator-compact {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  background-color: #3b82f6;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ====== Online preview MODAL STYLES ====== */
.google-docs-preview-option {
  transition: all 0.2s ease-in-out;
}

.google-docs-preview-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.direct-access-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ====== COPY MESSAGE BUTTON STYLES ====== */
.copy-message-btn {
  z-index: 10;
}

.copy-message-btn:hover {
  background-color: rgba(0, 0, 0, 0.1) !important;
}

/* Dark mode support for copy button */
.dark .copy-message-btn:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ====== HYPERLINK STYLES ====== */
/* Style for hyperlinks in message content */
.message-content a,
.markdown-content a,
.streaming-text a,
.final-response-container a {
  color: #7c3aed; /* Purple-600 color to match the theme */
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.message-content a:hover,
.markdown-content a:hover,
.streaming-text a:hover,
.final-response-container a:hover {
  color: #5b21b6; /* Purple-800 for hover state */
}

.message-content a:visited,
.markdown-content a:visited,
.streaming-text a:visited,
.final-response-container a:visited {
  color: #6b46c1; /* Purple-700 for visited links */
}

/* Ensure links are visible in dark mode too */
.dark .message-content a,
.dark .markdown-content a,
.dark .streaming-text a,
.dark .final-response-container a {
  color: #a78bfa; /* Purple-400 for dark mode */
}

.dark .message-content a:hover,
.dark .markdown-content a:hover,
.dark .streaming-text a:hover,
.dark .final-response-container a:hover {
  color: #c4b5fd; /* Purple-300 for dark mode hover */
}

/* ====== FILENAME CONTEXT BOXES STYLES ====== */
.context-files-container {
  margin-bottom: 4px;
  width: 100%;
  position: relative;
  z-index: 15; /* Lower than attachment area (z-20) but higher than chat */
}

.input-area-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.input-wrapper > div {
  position: relative;
}

.input-area-container > button {
  align-self: center;
  margin-bottom: 0;
}

.input-wrapper #sendButton {
  position: absolute !important;
  right: 12px !important;
  top: 45% !important;
  transform: translateY(-50%) !important;
  z-index: 10 !important;
}

/* ====== CONTEXT FILES DISPLAY STYLES ====== */
/* Context files display for user messages with scoped file selection */
.context-files-display {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.context-files-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.context-files-icon {
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.context-files-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.context-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.context-file-display {
  display: inline-flex;
  align-items: center;
  background: rgba(240, 237, 255, 0.8);
  border: 1px solid rgba(229, 215, 255, 0.9);
  border-radius: 10px;
  padding: 2px 8px 3px 8px;
  font-size: 11px;
  color: #64748b;
  max-width: 200px;
}

.context-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* For assistant messages (if needed later) */
.bg-gray-100 .context-files-display {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.bg-gray-100 .context-files-icon {
  color: rgba(0, 0, 0, 0.6);
}

.bg-gray-100 .context-files-label {
  color: rgba(0, 0, 0, 0.6);
}

.bg-gray-100 .context-file-display {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.8);
}

/* For user messages with purple background */
.user-chat-bubble .context-files-display {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.user-chat-bubble .context-files-icon {
  color: rgba(255, 255, 255, 0.9);
}

.user-chat-bubble .context-files-label {
  color: rgba(255, 255, 255, 0.9);
}

.user-chat-bubble .context-file-display {
  background: rgba(240, 237, 255, 0.9);
  border: 1px solid rgba(229, 215, 255, 1);
  color: #64748b;
}

/* ====== AUTO-RESIZING TEXTAREA STYLES ====== */
#messageInput {
  line-height: 1.5;
  transition: height 0.1s ease;
}

/* Ensure proper alignment when textarea grows */
.input-container {
  align-items: flex-end;
}

/* Export dropdown alignment with other buttons */
#exportDropdown {
  display: flex;
  align-items: center;
}

/* Ensure all input area buttons are properly centered */
.input-area-buttons {
  align-self: center !important;
}

/* Individual button alignment override */
#attachButton,
#shareButton,
#exportButton {
  align-self: center;
}

/* ====== GOOGLE DRIVE MODAL STYLES ====== */
.google-drive-modal {
  z-index: 1000;
}

.google-drive-modal .bg-white {
  animation: modalSlideIn 0.3s ease-out;
}

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

/* Progress indicators for file indexing */
.indexing-progress-item {
  transition: all 0.3s ease;
}

.indexing-progress-item.completed {
  background-color: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding-left: 8px;
}

/* File list styling */
#selectedFilesList {
  background-color: #fafafa;
}

#selectedFilesList:empty::after {
  content: 'No files selected';
  display: block;
  text-align: center;
  color: #9ca3af;
  padding: 1rem;
  font-size: 0.875rem;
}

/* Google Drive status indicators */
.drive-status-connected {
  position: relative;
}

.drive-status-connected::before {
  content: '●';
  color: #22c55e;
  margin-right: 0.25rem;
}

.drive-status-disconnected::before {
  content: '●';
  color: #ef4444;
  margin-right: 0.25rem;
}

/* Button state transitions */
button[disabled] {
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* Custom checkbox styles for Google Drive options */
.gdrive-checkbox {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  background: white;
  position: relative;
  cursor: pointer;
}

.gdrive-checkbox:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.gdrive-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}
