/* Modern UI Styles for Second Brain */
:root {
  /* Theme colors - dynamically set by theme manager */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --accent-color: #7c3aed;
  --background-light: #f8fafc;
  --background-dark: #0f172a;
  --card-background: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  
  /* Fixed colors */
  --success-color: #059669;
  --error-color: #dc2626;
  --warning-color: #d97706;
  
  /* Layout */
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --panel-background: var(--card-background);
  --panel-border: var(--border-color);
  --panel-heading-background: rgba(255, 255, 255, 0.6);
  --panel-heading-color: var(--text-primary);
  --panel-control-background: rgba(255, 255, 255, 0.75);
  --panel-control-hover: rgba(37, 99, 235, 0.12);
  --panel-shadow: var(--shadow-md);
  
  /* Transitions */
  --transition: all 0.2s ease-in-out;
  --transition-duration: 0.3s;
  --theme-transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, border-color 0.3s ease-in-out;
  
  /* Font */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--background-light) 0%, #e0e7ff 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: var(--theme-transition);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: var(--card-background);
  padding: 0.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

.tab-button {
  flex: 1;
  min-width: 150px;
  padding: 0.875rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  border-radius: calc(var(--border-radius) - 2px);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.tab-button.active {
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

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

/* Main Chat Interface */
.chat-container {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}

.chat-input-section {
  padding: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.input-group {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.input-wrapper {
  flex: 1;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
  transform: translateY(-1px);
}

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

/* Loading States */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s ease-in-out infinite;
}

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

/* LLM Selection Checkboxes */
.llm-selection {
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--panel-background);
  border-radius: var(--border-radius);
  border: 2px solid var(--panel-border);
  box-shadow: var(--panel-shadow, var(--shadow-lg));
  color: var(--text-primary);
  backdrop-filter: blur(6px);
}

.selection-label {
  display: block;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--panel-heading-color);
  background: var(--panel-heading-background);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  border-bottom: 2px solid var(--panel-border);
  padding: 1rem;
  border-radius: 6px;
  margin: -1.5rem -1.5rem 1rem -1.5rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 1rem;
  border-radius: 8px;
  transition: var(--transition);
  background: var(--panel-control-background);
  border: 2px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.checkbox-item:hover {
  background: var(--panel-control-hover);
  transform: translateY(-2px);
  box-shadow: var(--panel-shadow, var(--shadow-md));
  border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 3px solid var(--panel-border);
  margin-right: 0.75rem;
  position: relative;
  transition: var(--transition);
  background: var(--panel-control-background);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
  border-color: var(--primary-color);
  background: var(--primary-color);
  box-shadow: 0 0 12px var(--primary-color);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark:after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 7px;
  height: 12px;
  border: solid white;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.checkmark.openai { border-color: #10b981; }
.checkbox-item input[type="checkbox"]:checked + .checkmark.openai { 
  background: #10b981; 
  border-color: #10b981; 
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.checkmark.claude { border-color: #f59e0b; }
.checkbox-item input[type="checkbox"]:checked + .checkmark.claude { 
  background: #f59e0b; 
  border-color: #f59e0b; 
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.checkmark.gemini { border-color: #3b82f6; }
.checkbox-item input[type="checkbox"]:checked + .checkmark.gemini { 
  background: #3b82f6; 
  border-color: #3b82f6; 
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.checkmark.grok { border-color: #8b5cf6; }
.checkbox-item input[type="checkbox"]:checked + .checkmark.grok { 
  background: #8b5cf6; 
  border-color: #8b5cf6; 
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.model-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Results Section */
.results-section {
  padding: 2rem;
}

.result-card {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--panel-background);
  border-radius: var(--border-radius);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--primary-color);
  box-shadow: var(--panel-shadow, var(--shadow-md));
  color: var(--text-primary);
}

.result-card h3 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--panel-heading-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-content, .answers-content {
  background: var(--panel-control-background);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--panel-border);
  white-space: pre-wrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow-sm);
}

.answer-item {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--panel-control-background);
  border-radius: var(--border-radius);
  border: 2px solid var(--panel-border);
  box-shadow: var(--panel-shadow, var(--shadow-md));
  transition: var(--transition);
}

.answer-item:hover {
  box-shadow: var(--panel-shadow, 0 6px 20px rgba(0, 0, 0, 0.15));
  transform: translateY(-2px);
  border-color: var(--primary-color);
}

.answer-item:last-child {
  margin-bottom: 0;
}

.answer-source {
  font-weight: 800;
  margin-bottom: 1rem;
  text-transform: uppercase;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: 0.5px;
  padding: 0.5rem 0;
  border-bottom: 2px solid #f1f5f9;
}

.answer-source.openai { 
  color: #059669; 
  border-bottom-color: #d1fae5;
  background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.answer-source.claude { 
  color: #d97706; 
  border-bottom-color: #fed7aa;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.answer-source.gemini { 
  color: #2563eb; 
  border-bottom-color: #bfdbfe;
  background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 100%);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.answer-source.grok { 
  color: #7c3aed; 
  border-bottom-color: #ddd6fe;
  background: linear-gradient(90deg, #faf5ff 0%, #f3e8ff 100%);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.answer-text {
  color: var(--text-primary);
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Related Knowledge Styling */
.related-knowledge {
  border-left: 4px solid #059669 !important;
  background: #f0fdf4 !important;
}

.answer-source.related {
  color: #059669 !important;
  background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%) !important;
}

.related-item {
  margin-bottom: 12px;
  padding: 12px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #d1fae5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.related-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.related-meta {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 400;
}

/* Suggested Topics Styling */
.suggested-topics {
  border-left: 4px solid #7c3aed !important;
  background: #faf5ff !important;
}

.answer-source.topics {
  color: #7c3aed !important;
  background: linear-gradient(90deg, #faf5ff 0%, #f3e8ff 100%) !important;
}

.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.topic-tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #c7d2fe;
  transition: var(--transition);
}

.topic-tag:hover {
  background: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tools Section */
.tools-section {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.tools-header {
  margin-bottom: 2rem;
  text-align: center;
}

.tools-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Search Mode Tabs */
.search-mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: -2px;
}

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

.tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.search-mode-content {
  width: 100%;
}


.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* Search header styling */
.search-header {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--background-light);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

.search-header h4 {
  margin: 0 0 0.25rem 0;
  color: #000000;
  font-weight: 600;
}

.search-header small {
  color: #666666;
  font-size: 0.85em;
}

.tool-card {
  padding: 1.5rem;
  background: var(--background-light);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.tool-card.full-width {
  grid-column: 1 / -1;
}

.tool-card h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.date-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.date-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.tool-results {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  max-height: 300px;
  overflow-y: auto;
}

/* Status Messages */
.status-message {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-top: 1rem;
  font-weight: 500;
}

.status-success {
  background: #d1fae5;
  color: var(--success-color);
  border: 1px solid #a7f3d0;
}

.status-error {
  background: #fee2e2;
  color: var(--error-color);
  border: 1px solid #fca5a5;
}

.status-info {
  background: #e0e7ff;
  color: var(--primary-color);
  border: 1px solid #c7d2fe;
}

/* JSON Output Styling */
.json-output {
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: var(--border-radius);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Topic Summary Interactive Buttons */
.topics-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.topic-item {
  border: 1px solid #10b981;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: #000000;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.topic-item:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

.topic-button {
  width: 100%;
  padding: 1rem;
  background: #000000;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #10b981;
  transition: background-color 0.2s ease;
  text-align: left;
}

.topic-button:hover {
  background-color: #1a1a1a;
}

.topic-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  color: #10b981;
}

.topic-title {
  flex: 1;
  line-height: 1.4;
  color: #10b981;
}

.topic-chevron {
  font-size: 0.875rem;
  color: #10b981;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.topic-content {
  border-top: 1px solid #10b981;
  background-color: #0a0a0a;
  display: none;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.knowledge-point {
  padding: 1.25rem;
  color: #10b981;
  line-height: 1.7;
  font-size: 0.9rem;
  white-space: pre-wrap;
  background-color: #0a0a0a;
  border-left: 3px solid #10b981;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .button-group {
    flex-direction: row;
  }
  
  .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --card-background: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --background-light: #0f172a;
  }
  
  body {
    background: linear-gradient(135deg, var(--background-dark) 0%, #1e1b4b 100%);
  }
  
  .answer-item,
  .summary-content,
  .answers-content {
    background: var(--card-background);
    color: var(--text-primary);
    border-color: var(--border-color);
  }

  .answer-text {
    color: var(--text-primary);
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

.pulse {
  animation: pulse 2s infinite;
}

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

/* Knowledge Graph Visualization Styles */
.graph-container {
  margin-top: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--card-background);
  box-shadow: var(--shadow-md);
}

.graph-controls {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-light);
  flex-wrap: wrap;
  align-items: center;
}

.graph-controls .btn-secondary {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

/* Zoom button styling */
#zoom-in-graph, #zoom-out-graph {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  min-width: auto;
}

#zoom-in-graph:hover, #zoom-out-graph:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
}

/* Center button special styling */
#center-graph {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  border: none;
  font-weight: 600;
}

#center-graph:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1px);
}

#graph-visualization {
  width: 100%;
  height: 500px;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

#graph-info {
  padding: 1rem;
  background: var(--background-light);
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Graph node and link styles */
.graph-node {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 3px;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.graph-node:hover {
  stroke-width: 4px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

.graph-node.concept {
  fill: #2563eb;
}

.graph-node.document {
  fill: #059669;
}

.graph-node.topic {
  fill: #d97706;
}

.graph-node.qa_concept {
  fill: #7c3aed;
}

.graph-link {
  stroke: #94a3b8;
  stroke-opacity: 0.8;
  stroke-width: 2px;
  transition: all 0.3s ease;
}

.graph-link.similarity {
  stroke: var(--primary-color);
  stroke-opacity: 0.4;
}

.graph-text {
  font-family: inherit;
  font-size: 11px;
  fill: #1e293b;
  font-weight: 600;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

/* Tooltip for graph nodes */
.graph-tooltip {
  position: absolute;
  background: #000000;
  color: #ff8c00;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1000;
  max-width: 200px;
  box-shadow: var(--shadow-md);
  border: 1px solid #ff8c00;
}

/* Graph loading state */
.graph-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 500px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.graph-loading::before {
  content: "🌐";
  margin-right: 0.5rem;
  animation: spin 2s linear infinite;
}

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

/* Image Upload Area */
.image-upload-area {
  margin: 1rem 0;
}

/* Compact drop zone for main Ask section */
.drop-zone-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-light);
  transition: var(--transition);
}

.drop-zone-compact:hover {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.drop-zone-compact.drag-over {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
  transform: scale(1.01);
}

.btn-upload {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-upload:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-clear-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-image:hover {
  background: rgb(220, 38, 38);
  transform: scale(1.1);
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  background: var(--background-light);
  transition: var(--transition);
  cursor: pointer;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.drop-zone.drag-over {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
  border-style: solid;
}

.drop-zone-content {
  pointer-events: none;
}

.drop-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.drop-zone p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

#image-preview {
  text-align: center;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

#image-analysis-results {
  margin-top: 1rem;
}

.analysis-description {
  background: rgba(37, 99, 235, 0.05);
  padding: 1rem;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  margin: 1rem 0;
}

.suggested-queries {
  margin-top: 1rem;
}

.query-chip {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  margin: 0.25rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.query-chip:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

#image-search-results {
  margin-top: 1rem;
}

/* Theme Selector Styles - Centered in Header */
.header-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  text-align: center;
}

/* ========== Theme Selector with Radio Buttons ========== */
.theme-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.theme-selector:hover {
  background: rgba(255, 255, 255, 0.12);
}

.theme-selector > span {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
  min-width: 80px;
}

.theme-selector > span::after {
  content: ' |';
  margin-left: 0.5rem;
  opacity: 0.5;
}

.theme-radio-group {
  display: flex;
  gap: 0;
  align-items: center;
}

.theme-radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

.theme-radio-label:not(:last-child)::after {
  content: '|';
  position: absolute;
  right: -0.5rem;
  color: var(--text-secondary);
  opacity: 0.4;
}

.theme-radio-label:hover {
  color: var(--primary-color);
}

.theme-radio {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.theme-radio:checked + span {
  font-weight: 700;
}

/* Nature theme radio - checked state */
.theme-label-nature:has(.theme-radio:checked) span {
  color: #339966;
}

/* Sakura theme radio - checked state */
.theme-label-sakura:has(.theme-radio:checked) span {
  color: #ff80b3;
}

/* Cyberpunk theme radio - checked state */
.theme-label-cyberpunk:has(.theme-radio:checked) span {
  color: #00ccff;
}

.theme-menu {
  position: absolute;
  top: 50px;
  right: 0;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  min-width: 280px;
  display: none;
  animation: slideIn 0.2s ease-out;
  transition: var(--theme-transition);
}

.theme-menu.active {
  display: block;
}

/* ========== Header Controls Layout ========== */
.header-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  width: 100%;
}

/* ========== Language Selector Styles ========== */
.language-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.language-selector:hover {
  background: rgba(255, 255, 255, 0.12);
}

.language-selector > span {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
  min-width: 80px;
}

.language-selector > span::after {
  content: ' |';
  margin-left: 0.5rem;
  opacity: 0.5;
}

.language-radio-group {
  display: flex;
  gap: 0;
  align-items: center;
}

.language-radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

.language-radio-label:not(:last-child)::after {
  content: '|';
  position: absolute;
  right: -0.5rem;
  color: var(--text-secondary);
  opacity: 0.4;
}

.language-radio-label:hover {
  color: var(--primary-color);
}

.language-radio {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.language-radio:checked + span {
  color: var(--primary-color);
  font-weight: 700;
}

/* Theme-specific adjustments for language selector */
.theme-nature .language-selector {
  background: rgba(51, 153, 102, 0.1);
}

.theme-nature .language-select-dropdown {
  border-color: rgba(51, 153, 102, 0.3);
}

.theme-nature .language-select-dropdown:hover,
.theme-nature .language-select-dropdown:focus {
  border-color: #339966;
}

.theme-sakura .language-selector {
  background: rgba(255, 128, 179, 0.1);
}

.theme-sakura .language-select-dropdown {
  border-color: rgba(230, 102, 153, 0.3);
}

.theme-sakura .language-select-dropdown:hover,
.theme-sakura .language-select-dropdown:focus {
  border-color: #e66699;
}

.theme-cyberpunk .language-selector {
  background: rgba(0, 204, 255, 0.1);
  border: 1px solid rgba(0, 204, 255, 0.3);
}

.theme-cyberpunk .language-select-dropdown {
  background: rgba(0, 0, 0, 0.6);
  color: #00ffff;
  border-color: rgba(0, 204, 255, 0.5);
}

.theme-cyberpunk .language-select-dropdown:hover,
.theme-cyberpunk .language-select-dropdown:focus {
  border-color: #00ccff;
  background: rgba(0, 0, 0, 0.8);
}

.theme-cyberpunk .language-select-dropdown option {
  background: #1a1a2e;
  color: #00ffff;
}

/* Responsive design */
@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    gap: 1rem;
  }
  
  .language-selector {
    width: 100%;
    justify-content: center;
  }
  
  .language-select-dropdown {
    min-width: 120px;
  }
}

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

.theme-menu h4 {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color var(--transition-duration);
}

.theme-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-light);
  cursor: pointer;
  transition: var(--transition);
}

.theme-option:hover {
  transform: translateX(5px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.theme-option.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.theme-option.active .theme-info h5,
.theme-option.active .theme-info p {
  color: white;
}

.theme-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.theme-info {
  flex: 1;
}

.theme-info h5 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: var(--text-primary);
  transition: color var(--transition-duration);
}

.theme-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  transition: color var(--transition-duration);
}

/* Theme-specific enhancements */
.theme-cyberpunk .llm-selection {
  box-shadow: 0 0 20px rgba(0, 204, 255, 0.3);
}

.theme-cyberpunk .tab-button.active {
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.5);
}

.theme-sakura .header h1 {
  text-shadow: 2px 2px 4px rgba(255, 128, 179, 0.3);
}

.theme-nature .result-card {
  box-shadow: 0 4px 12px rgba(51, 153, 102, 0.15);
}

/* Smooth transitions for all themed elements */
.header h1,
.tab-button,
.tab-content,
.chat-container,
.result-card,
.tool-card,
.answer-item,
textarea,
button,
.theme-toggle-btn,
.theme-menu {
  transition: var(--theme-transition);
}
