/* ==========================================================================
   NexusAI - 100% Handcrafted Human-Designed Conversational UI
   Inspired by Claude 3.5, Linear, and Raycast
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface Tokens */
  --bg-app: #090c15;
  --bg-sidebar: #0d121f;
  --bg-surface: #121828;
  --bg-surface-elevated: #182238;
  --bg-input: #101626;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-focus: #6366f1;
  --border-glow: rgba(99, 102, 241, 0.35);

  /* Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;

  /* Text Hierarchy */
  --text-main: #f8fafc;
  --text-body: #e2e8f0;
  --text-muted: #8c9eb5;
  --text-dim: #4d5d75;

  /* Sizing */
  --sidebar-w: 270px;
  --chat-max-w: 780px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* Subtle Ambient Gradient Lighting */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(99, 102, 241, 0.12), transparent 70%),
    radial-gradient(circle 400px at 85% 15%, rgba(56, 189, 248, 0.05), transparent 70%),
    radial-gradient(circle 350px at 15% 85%, rgba(139, 92, 246, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Layout */
#app-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
#sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 14px var(--primary-glow);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* New Chat Button */
.new-chat-btn {
  margin: 14px 14px 10px 14px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

/* Search Box */
.search-box {
  padding: 0 14px 10px 14px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Section Header */
.sidebar-section-title {
  padding: 8px 16px 4px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Chat History List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-item {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
}

.chat-item svg.chat-icon {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.chat-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}
.chat-item:hover svg.chat-icon {
  color: var(--cyan);
}

.chat-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.04));
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-left: 3px solid var(--primary);
}
.chat-item.active svg.chat-icon {
  color: var(--primary);
}

.chat-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-delete {
  opacity: 0;
  color: var(--text-dim);
  padding: 3px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.chat-item:hover .chat-item-delete {
  opacity: 1;
}

.chat-item-delete:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.15);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.footer-btn-group {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   MAIN WORKSPACE & TOP BAR
   ========================================================================== */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Top Navbar */
.top-navbar {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 12, 21, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 30;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-title-group {
  display: flex;
  flex-direction: column;
}

.current-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-model-tag {
  font-size: 0.73rem;
  color: var(--cyan);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.model-pill-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.model-pill-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  box-shadow: 0 0 14px var(--primary-glow);
}

/* ==========================================================================
   CONVERSATION STREAM (HUMAN-DESIGNED EDITORIAL LAYOUT)
   ========================================================================== */
#messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  scroll-behavior: smooth;
}

/* --- Hero / Welcome State --- */
.hero-welcome {
  max-width: var(--chat-max-w);
  margin: auto;
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: hero-in 0.35s ease-out;
}

@keyframes hero-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: #a5b4fc;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 75%, #818cf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 720px;
}

.suggestion-card {
  padding: 16px 18px;
  background: rgba(18, 24, 40, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.suggestion-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 14px var(--primary-glow);
}

.suggestion-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.92rem;
}

.suggestion-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* --- Conversational Message Rows --- */
.message-wrapper {
  max-width: var(--chat-max-w);
  width: 100%;
  margin: 0 auto;
  display: flex;
}

/* USER ROW: Right-aligned, sleek bubble without clumsy badge */
.message-wrapper.user {
  justify-content: flex-end;
}

.user-bubble-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 80%;
}

.message-bubble.user-bubble {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  font-size: 0.95rem;
  line-height: 1.6;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  word-break: break-word;
  white-space: pre-wrap;
}

/* ASSISTANT ROW: Full-width editorial reading flow (Like Claude & ChatGPT) */
.message-wrapper.assistant {
  justify-content: flex-start;
  width: 100%;
}

.assistant-message-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2px;
}

.assistant-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sparkle-icon-wrapper {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 10px var(--cyan-glow);
}

.assistant-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.assistant-model-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.assistant-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-msg-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.copy-msg-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Assistant Typography Bubble */
.message-bubble.assistant-bubble {
  color: var(--text-body);
  font-size: 0.96rem;
  line-height: 1.72;
  word-break: break-word;
  padding: 2px 0 6px 0;
}

/* Markdown Formatting */
.message-bubble h1, 
.message-bubble h2, 
.message-bubble h3 {
  color: var(--text-main);
  margin: 18px 0 10px 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.message-bubble h1 { font-size: 1.25rem; }
.message-bubble h2 { font-size: 1.12rem; }
.message-bubble h3 { font-size: 1.0rem; }

.message-bubble p {
  margin-bottom: 12px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul, 
.message-bubble ol {
  margin: 8px 0 12px 22px;
}
.message-bubble li {
  margin-bottom: 5px;
}

.message-bubble blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin: 12px 0;
}

/* Code Blocks */
.message-bubble pre {
  margin: 14px 0;
  border-radius: var(--radius-md);
  background: #080c14 !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.message-bubble code {
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
  font-size: 0.88rem;
}

.message-bubble :not(pre) > code {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid rgba(99, 102, 241, 0.22);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  background: #0e1422;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Streaming Cursor Indicator */
.typing-cursor::after {
  content: '▋';
  display: inline-block;
  vertical-align: middle;
  color: var(--cyan);
  animation: pulse-caret 0.8s ease-in-out infinite;
  margin-left: 4px;
}

@keyframes pulse-caret {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0; transform: scaleY(0.85); }
}

/* ==========================================================================
   FLOATING INPUT DOCK (CLAUDE / CHATGPT STYLE)
   ========================================================================== */
#input-wrapper {
  padding: 10px 20px 24px 20px;
  background: linear-gradient(to top, var(--bg-app) 75%, transparent);
}

.input-container {
  max-width: var(--chat-max-w);
  margin: 0 auto;
  background: var(--bg-input);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 12px 14px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 20px var(--primary-glow), 0 12px 36px rgba(0, 0, 0, 0.65);
  background: #121828;
}

#chat-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.96rem;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  min-height: 24px;
  padding: 2px 0;
  outline: none;
  font-family: inherit;
}

#chat-input::placeholder {
  color: var(--text-dim);
}

.input-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.input-model-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.input-model-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--cyan);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.send-btn, .stop-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.send-btn:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.stop-btn {
  background: var(--rose);
  color: #fff;
  display: none;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.3);
}

.stop-btn:hover {
  transform: scale(1.08);
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: rgba(16, 22, 38, 0.96);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modal-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  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;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.form-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-input {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.94rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 12px var(--primary-glow);
}

.form-btn {
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 700;
  font-size: 0.93rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.form-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

/* Model Selector Cards */
.model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.model-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.model-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.model-card.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 14px var(--primary-glow);
}

.model-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-card-name {
  font-weight: 700;
  font-size: 0.93rem;
  color: #fff;
}

.model-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.model-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(18, 24, 40, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  pointer-events: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Mobile Layout */
#sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 40;
  display: none;
}

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 310px;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.85);
  }
  
  #sidebar.open {
    transform: translateX(0);
  }
  
  #sidebar-backdrop.open {
    display: block;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }
  
  .user-bubble-container {
    max-width: 90%;
  }

  .current-title {
    max-width: 150px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
