/* LLM Conversations - Indigo Theme */

:root {
  --bg-primary: #0a0a10;
  --bg-secondary: #10101a;
  --bg-card: #16162a;
  --bg-card-hover: #1c1c36;
  --bg-sidebar: #0c0c14;
  --bg-input: #12121e;

  --text-primary: #e4e4ef;
  --text-secondary: #a1a1b5;
  --text-muted: #525268;

  --border-color: #242438;
  --border-light: #1c1c2e;

  /* Primary — Indigo */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: #4338ca;
  --accent-muted: rgba(99, 102, 241, 0.12);
  --accent-light: #818cf8;

  /* Success */
  --green: #34d399;
  --green-muted: rgba(52, 211, 153, 0.15);

  /* Error */
  --red: #f87171;
  --red-muted: rgba(248, 113, 113, 0.12);

  /* Warning */
  --orange: #fbbf24;
  --orange-muted: rgba(251, 191, 36, 0.12);

  /* Info */
  --blue: #60a5fa;
  --blue-muted: rgba(96, 165, 250, 0.12);

  /* ChatGPT source */
  --chatgpt: #10a37f;
  --chatgpt-muted: rgba(16, 163, 127, 0.15);

  /* Claude source */
  --claude: #d97706;
  --claude-muted: rgba(217, 119, 6, 0.15);

  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --topbar-height: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */

.llm-layout {
  display: flex;
  min-height: 100vh;
}

.llm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.llm-sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.llm-sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.llm-sidebar-brand .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.llm-sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px 8px;
}

.llm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.llm-nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.llm-nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.llm-nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  opacity: 0.7;
}

.llm-nav-item.active .nav-icon {
  opacity: 1;
}

.llm-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.llm-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
}

.llm-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.llm-user-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.llm-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}

.llm-logout-btn:hover { color: var(--red); }

/* ---- Main Content ---- */

.llm-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.llm-topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.llm-topbar h2 {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.llm-search-box {
  width: 320px;
  position: relative;
}

.llm-search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.llm-search-box input:focus {
  border-color: var(--accent);
}

.llm-search-box::before {
  content: "\1F50D";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.5;
}

.llm-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ---- Cards ---- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

/* ---- Buttons ---- */

.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ---- Conversation List ---- */

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.conv-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.conv-source {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.conv-source.chatgpt {
  background: var(--chatgpt-muted);
  color: var(--chatgpt);
}

.conv-source.claude {
  background: var(--claude-muted);
  color: var(--claude);
}

.conv-source.manual {
  background: var(--accent-muted);
  color: var(--accent);
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.conv-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

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

/* ---- Tags ---- */

.tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-muted);
  color: var(--accent);
}

.tag.auto {
  background: var(--blue-muted);
  color: var(--blue);
}

/* ---- Messages ---- */

.message {
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.message.user {
  background: var(--accent-muted);
  margin-left: 40px;
}

.message.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  margin-right: 40px;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.message-role {
  font-weight: 600;
  text-transform: capitalize;
}

.message-role.user { color: var(--accent); }
.message-role.assistant { color: var(--text-secondary); }

.message-content {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message-content code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
}

.message-content pre {
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 12px 0;
}

.message-content pre code {
  background: none;
  padding: 0;
}

.message-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.bookmark-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.bookmark-btn:hover { color: var(--orange); background: var(--orange-muted); }
.bookmark-btn.active { color: var(--orange); }

/* ---- Mind Map ---- */

.mindmap-container {
  width: 100%;
  height: calc(100vh - 140px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mindmap-container svg {
  width: 100%;
  height: 100%;
}

.mindmap-node {
  cursor: pointer;
}

.mindmap-node circle {
  transition: all 0.2s;
}

.mindmap-node:hover circle {
  stroke: var(--accent);
  stroke-width: 2;
}

.mindmap-link {
  stroke: var(--border-color);
  stroke-opacity: 0.6;
}

.mindmap-label {
  font-size: 10px;
  fill: var(--text-secondary);
  pointer-events: none;
}

/* ---- Import ---- */

.import-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px;
  text-align: center;
  transition: all 0.2s;
}

.import-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.import-dropzone h3 {
  margin: 16px 0 8px;
  font-size: 16px;
}

.import-dropzone p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---- Loading & Empty States ---- */

.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ---- Folder Tree ---- */

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.folder-item:hover {
  background: var(--bg-card);
}

.folder-item.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.folder-item .folder-icon {
  font-size: 14px;
}

.folder-item .folder-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Forms ---- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  animation: slideIn 0.2s ease-out;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

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