/* ============================================
   COMPONENTS — Buttons, Cards, Chat UI
   ============================================ */

/* ---- Buttons ---- */
.btn-launch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--grad-brand);
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  letter-spacing: -0.1px;
  position: relative;
  overflow: hidden;
}
.btn-launch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}
.btn-launch:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 24px var(--primary-glow); }
.btn-launch:active { transform: translateY(0); }
.btn-launch.large { padding: 13px 30px; font-size: 15px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-3); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(239,68,68,0.10);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--t-base);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; }

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--grad-brand);
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  cursor: pointer;
  transition: opacity var(--t-base), transform var(--t-base), box-shadow var(--t-base);
  flex-shrink: 0;
}
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.send-btn:not(:disabled):hover { opacity: 0.88; transform: scale(1.06); box-shadow: 0 4px 14px var(--primary-glow); }
.hero-send { width: 40px; height: 40px; border-radius: var(--r-md); }

.stop-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  padding: 6px 12px;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}
.stop-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---- Feature Cards ---- */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s, background 0.25s;
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity 0.25s;
}
.feature-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-accent);
  background: var(--surface-2);
}
.feature-card:hover::before { opacity: 1; }
.feature-icon { font-size: 28px; margin-bottom: var(--sp-4); display: block; }
.feature-card h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: var(--sp-2); }
.feature-card p { font-size: 14px; color: var(--text-2); line-height: 1.7; }

/* ---- Chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-full);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--t-base), border-color var(--t-base), color var(--t-base), transform var(--t-base);
  white-space: nowrap;
}
.chip:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--text);
  transform: translateY(-1px);
}

/* ---- Hero Input ---- */
.hero-input-box {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-lg);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.hero-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim), var(--shadow-lg);
}
.hero-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: var(--font-sans);
  color: var(--text);
  padding: var(--sp-2) 0;
  caret-color: var(--primary);
}
.hero-input::placeholder { color: var(--text-3); }
.hero-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.hero-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; flex: 1; }

/* ---- Model Badge ---- */
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-full);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.1px;
}
.model-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--india-green);
  box-shadow: 0 0 8px rgba(34,197,94,0.7);
  animation: dotPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(34,197,94,0.7); }
  50%       { opacity: 0.55; box-shadow: 0 0 3px rgba(34,197,94,0.3); }
}

/* ---- Status Indicator ---- */
.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-3);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--india-green);
  flex-shrink: 0;
  transition: background var(--t-base);
}
.status-dot.loading { background: var(--saffron); animation: pulse 1s infinite; }
.status-dot.error   { background: #ef4444; animation: none; }
.status-dot.ready   { background: var(--india-green); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-text { white-space: nowrap; }

/* ---- Sidebar Components ---- */
.new-chat-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-3) var(--sp-3) var(--sp-2);
  padding: 10px var(--sp-4);
  background: var(--grad-brand);
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.1px;
}
.new-chat-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.new-chat-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px var(--primary-glow); }
.new-chat-btn:active { transform: translateY(0); }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 var(--sp-3) var(--sp-2);
  padding: 8px var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3);
  flex-shrink: 0;
}
.sidebar-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text);
  min-width: 0;
}
.sidebar-search input::placeholder { color: var(--text-3); }

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-1) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-empty {
  padding: var(--sp-4);
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}
.conv-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
}
.conv-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-base);
  position: relative;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-dim); }
.conv-item-title {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.conv-item.active .conv-item-title { color: var(--text); }
.conv-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.conv-item:hover .conv-item-actions { display: flex; }
.conv-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: none;
  border: none;
  border-radius: var(--r-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}
.conv-action-btn:hover { background: var(--surface-3); color: var(--text); }
.conv-action-btn.danger:hover { color: #ef4444; }

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-3);
  background: none;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
  width: 100%;
  text-align: left;
}
.sidebar-footer-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---- Chat Input Box ---- */
.input-box-container {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.input-box-container:focus-within {
  border-color: rgba(249,115,22,0.45);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.07), 0 0 20px rgba(249,115,22,0.05);
}
.chat-textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--text);
  resize: none;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  caret-color: var(--primary);
  display: block;
}
.chat-textarea::placeholder { color: var(--text-3); }
.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}
.input-left-controls,
.input-right-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ============================================
   MESSAGE ROWS — Core chat UI
   User messages: LEFT aligned
   AI messages: LEFT aligned (clean layout)
   ============================================ */

.msg-row {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  max-width: var(--msg-max-w);
  margin: 0 auto;
  width: 100%;
  animation: msgIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 15px;
}

.user-avatar {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-2);
  letter-spacing: 0.5px;
}

.ai-avatar {
  background: linear-gradient(135deg, rgba(249,115,22,0.18), rgba(251,191,36,0.08));
  border: 1px solid var(--border-accent);
  box-shadow: 0 0 14px rgba(249,115,22,0.10);
}

/* Message body */
.msg-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

/* Meta row (name + badge) */
.msg-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 4px;
}

.msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Streaming badge */
.msg-streaming-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stream-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  animation: streamPulse 1.2s ease-in-out infinite;
}
.stream-dot:nth-child(2) { animation-delay: 0.2s; }
.stream-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes streamPulse {
  0%, 60%, 100% { transform: scale(1); opacity: 0.4; }
  30%            { transform: scale(1.4); opacity: 1; }
}

/* Message bubbles */
.msg-bubble {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* User bubble — distinct card style */
.user-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  border-top-left-radius: var(--r-xs);
  padding: var(--sp-3) var(--sp-4);
  display: inline-block;
  max-width: 88%;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.65;
}

/* AI bubble — clean, no background */
.ai-bubble {
  padding: 0;
  background: none;
  border: none;
}

/* Streaming bubble */
.streaming-bubble {
  min-height: 40px;
}

/* Streaming cursor */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.75s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: var(--sp-2) 0;
}
.typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  animation: typingBounce 1.3s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30%            { transform: translateY(-7px); opacity: 1; }
}

/* Message actions */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: var(--sp-2);
  opacity: 0;
  transition: opacity var(--t-base);
}
.msg-row:hover .msg-actions { opacity: 1; }

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 4px 8px;
  transition: background var(--t-base), color var(--t-base);
  white-space: nowrap;
}
.msg-action-btn:hover { background: var(--surface-2); color: var(--text); }
.msg-action-btn.danger:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

/* ============================================
   MARKDOWN CONTENT TYPOGRAPHY
   ============================================ */

.ai-bubble p {
  margin-bottom: var(--sp-3);
  line-height: 1.8;
}
.ai-bubble p:last-child { margin-bottom: 0; }

.ai-bubble h1, .ai-bubble h2, .ai-bubble h3,
.ai-bubble h4, .ai-bubble h5, .ai-bubble h6 {
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin: var(--sp-5) 0 var(--sp-3);
}
.ai-bubble h1:first-child, .ai-bubble h2:first-child,
.ai-bubble h3:first-child { margin-top: 0; }
.ai-bubble h1 { font-size: 1.4em; letter-spacing: -0.3px; }
.ai-bubble h2 { font-size: 1.2em; letter-spacing: -0.2px; }
.ai-bubble h3 { font-size: 1.05em; }
.ai-bubble h4 { font-size: 0.95em; }
.ai-bubble h5, .ai-bubble h6 { font-size: 0.9em; color: var(--text-2); }

.ai-bubble ul, .ai-bubble ol {
  padding-left: var(--sp-5);
  margin-bottom: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-bubble li { line-height: 1.7; }
.ai-bubble li > ul, .ai-bubble li > ol { margin-top: 4px; margin-bottom: 0; }

.ai-bubble strong { font-weight: 700; color: var(--text); }
.ai-bubble em { font-style: italic; }
.ai-bubble del { text-decoration: line-through; color: var(--text-2); }

.ai-bubble a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(249,115,22,0.3);
  transition: border-color var(--t-base), color var(--t-base);
}
.ai-bubble a:hover { color: var(--accent); border-color: var(--accent); }

.ai-bubble blockquote {
  border-left: 3px solid var(--primary);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-4) 0;
  background: rgba(249,115,22,0.04);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-2);
  font-style: italic;
}
.ai-bubble blockquote p { margin-bottom: 0; }

.ai-bubble hr {
  border: none;
  border-top: 1px solid var(--border-2);
  margin: var(--sp-5) 0;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: var(--sp-4) 0;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
}
.ai-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 400px;
}
.ai-bubble th, .ai-bubble td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.ai-bubble th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.ai-bubble tr:last-child td { border-bottom: none; }
.ai-bubble tr:hover td { background: rgba(255,255,255,0.02); }

/* Inline code */
.inline-code {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--primary);
  word-break: break-all;
}

/* Code blocks */
.code-block-wrap {
  position: relative;
  margin: var(--sp-4) 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-2);
  background: #0d1117;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--sp-4);
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-lang {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.35);
  font-family: var(--font-mono);
}
.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  transition: background var(--t-base), color var(--t-base);
}
.copy-code-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75); }
.copy-code-btn.copied { color: var(--india-green); }

.code-block-wrap pre {
  margin: 0;
  padding: var(--sp-4);
  overflow-x: auto;
  background: transparent !important;
  -webkit-overflow-scrolling: touch;
}
.code-block-wrap pre code {
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

/* Light theme code blocks */
[data-theme="light"] .code-block-wrap { background: #1e1e2e; }
[data-theme="light"] .code-block-header { background: rgba(255,255,255,0.06); }

/* ---- Error message ---- */
.error-msg {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.18);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin: var(--sp-2) auto;
  max-width: var(--msg-max-w);
  width: 100%;
  animation: msgIn 0.22s ease;
}
.error-icon { color: #ef4444; flex-shrink: 0; margin-top: 1px; }
.error-body { flex: 1; min-width: 0; }
.error-title { font-size: 14px; font-weight: 600; color: #ef4444; margin-bottom: 4px; }
.error-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.error-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: var(--r-md);
  color: #ef4444;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  padding: 6px 12px;
  cursor: pointer;
  transition: background var(--t-base);
}
.error-retry-btn:hover { background: rgba(239,68,68,0.18); }

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  gap: var(--sp-4);
  flex: 1;
  position: relative;
  min-height: 60vh;
}
.empty-state::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  width: 500px; height: 350px;
  background: radial-gradient(ellipse, rgba(249,115,22,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.empty-logo {
  font-size: 52px;
  animation: heroFloat 5s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
.empty-state h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  position: relative;
  z-index: 1;
  letter-spacing: -0.3px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-2);
  max-width: 380px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}
.empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  max-width: 580px;
  margin-top: var(--sp-2);
  position: relative;
  z-index: 1;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-body {
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}
.settings-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
}
.setting-row label { font-size: 14px; color: var(--text-2); font-weight: 500; }
.setting-row select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
}
.setting-value { font-size: 13px; color: var(--text-3); font-family: var(--font-mono); }
.settings-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.shortcuts-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.shortcut-row { display: flex; align-items: center; gap: var(--sp-3); }
.shortcut-row span { font-size: 13px; color: var(--text-2); }
kbd {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-2);
  white-space: nowrap;
  min-width: 80px;
  justify-content: center;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  cursor: pointer;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 320px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-out { opacity: 0; transform: translateX(20px); transition: 0.3s ease; }
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast-icon { font-size: 14px; flex-shrink: 0; }

/* ---- Rename input ---- */
.conv-rename-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--primary);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  padding: 3px 8px;
  outline: none;
  min-width: 0;
}

/* ---- Offline banner ---- */
.offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  background: rgba(239,68,68,0.92);
  color: #fff;
  text-align: center;
  padding: var(--sp-2) var(--sp-4);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}
