/* ── Variables ─────────────────────────────── */
:root {
  --bg:         #0f0f0f;
  --bg2:        #1a1a1a;
  --bg3:        #242424;
  --bg4:        #2e2e2e;
  --border:     rgba(223,255,0,0.1);
  --border2:    rgba(223,255,0,0.15);
  --text:       #e8e8e8;
  --text2:      #a8a8a8;
  --text3:      #6a6a6a;
  --accent:     #DFFF00;
  --accent-dim: rgba(223,255,0,0.08);
  --accent-glow:rgba(223,255,0,0.2);
  --grad:       linear-gradient(135deg, #DFFF00, #c5e600);
  --user-bubble:#242424;
  --scrollbar:  #3a3a3a;
  --radius:     12px;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Logo ──────────────────────────────────── */
.logo-svg { flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(0,212,255,0.3)); }

.logo-text {
  font-size: 17px; font-weight: 800;
  color: var(--cyan);
  letter-spacing: 3px;
}
.logo-text.sm { font-size: 14px; }

.sidebar-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.welcome-logo-svg { filter: drop-shadow(0 0 16px rgba(0,212,255,0.4)); }

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: 260px; min-width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform 0.25s ease;
  position: relative; z-index: 100;
}
.sidebar.collapsed { transform: translateX(-100%); width: 0; min-width: 0; }

.sidebar-header {
  display: flex; align-items: center; justify-content: center;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}

.new-chat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.new-chat-btn:hover { 
  background: var(--bg3); 
  border-color: var(--cyan);
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 8px;
  background: none; border: none;
  color: var(--text2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  text-align: left; width: 100%;
  margin: 0;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item svg { opacity: 0.7; flex-shrink: 0; }

.chat-list-label {
  padding: 16px 16px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px;
}

.chat-list { 
  flex: 1; 
  overflow-y: auto; 
  padding: 4px 12px; 
}
.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb { 
  background: var(--scrollbar); 
  border-radius: 4px; 
}
.chat-list::-webkit-scrollbar-thumb:hover { 
  background: var(--text3); 
}

.no-chats { padding: 12px; font-size: 12px; color: var(--text3); }

.chat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text2);
  transition: background 0.12s, color 0.12s;
  margin-bottom: 4px;
}
.chat-item:hover { background: var(--bg3); color: var(--text); }
.chat-item.active { background: var(--bg3); color: var(--text); border-left: 2px solid var(--cyan); }
.chat-item-icon { font-size: 15px; flex-shrink: 0; opacity: 0.7; }
.chat-item-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-delete {
  display: none; background: none; border: none;
  color: var(--text3); cursor: pointer; padding: 3px 6px;
  border-radius: 5px; font-size: 13px;
}
.chat-item:hover .chat-item-delete { display: block; }
.chat-item-delete:hover { color: #ff5555; background: rgba(255,85,85,0.1); }

/* Sidebar footer */
.sidebar-footer { 
  border-top: 1px solid var(--border); 
  padding: 12px; 
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  transition: background 0.12s;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #000;
  flex-shrink: 0; overflow: hidden;
  text-transform: uppercase;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-details { flex: 1; overflow: hidden; }
.user-name-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
.user-name  { 
  font-size: 13px; font-weight: 600; 
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
  color: var(--text);
}
.user-plan {
  font-size: 11px;
  color: var(--text3);
}

.credits-badge-small {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px; font-weight: 600; color: var(--text2);
}
.credits-badge-small svg {
  opacity: 0.7;
}

.logout-btn { 
  color: var(--text3) !important; 
  flex-shrink: 0;
}
.logout-btn:hover { 
  color: #ff5555 !important; 
  background: rgba(255,85,85,0.08) !important; 
}

.sidebar-close { display: none; position: absolute; top: 14px; right: 12px; background: none; border: none; color: var(--text2); font-size: 17px; cursor: pointer; }

/* ── Main ──────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.topbar {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  height: 56px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-toggle {
  color: var(--text2) !important;
}

.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Global Usage Display */
.global-usage-display {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.15s;
  cursor: help;
}
.global-usage-display:hover {
  background: var(--bg3);
  border-color: var(--border2);
}
.global-usage-display svg {
  color: var(--text3);
  opacity: 0.7;
}
#globalUsageCount {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.usage-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}

/* Credits Display */
.credits-display {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.15s;
}
.credits-display:hover {
  background: var(--bg4);
}

.credits-info {
  display: flex; align-items: center; gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.credits-info svg {
  color: var(--cyan);
}
.credits-label {
  font-size: 12px;
  color: var(--text3);
  font-weight: 400;
}

.buy-credits-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  background: var(--grad);
  border: none;
  border-radius: 6px;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.buy-credits-btn:hover {
  opacity: 0.85;
}

.help-btn {
  color: var(--text3) !important;
}
.help-btn:hover {
  color: var(--text) !important;
  background: var(--bg3) !important;
}


/* ── Messages ──────────────────────────────── */
.messages { 
  flex: 1; 
  overflow-y: auto; 
  padding: 32px 0; 
  scroll-behavior: smooth; 
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { 
  background: var(--scrollbar); 
  border-radius: 10px; 
}
.messages::-webkit-scrollbar-thumb:hover { 
  background: var(--text3); 
}

/* Welcome */
.welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 32px;
  text-align: center; padding: 40px;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-robot {
  filter: drop-shadow(0 4px 12px rgba(223, 255, 0, 0.3));
}

.welcome h2 { 
  font-size: 32px; font-weight: 300; color: var(--text); 
  letter-spacing: -0.8px;
}
.welcome h2 span { font-weight: 500; }

.welcome-subtitle {
  font-size: 16px;
  color: var(--text2);
  font-weight: 400;
}

.welcome-suggestions {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 280px;
}

.suggestion-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text2); font-size: 14px;
  cursor: pointer; transition: all 0.15s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion-item:hover { 
  background: var(--bg3); 
  border-color: var(--cyan); 
  color: var(--text); 
}
.suggestion-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* Message rows */
.message-row {
  display: flex; padding: 20px 0;
  max-width: 900px; margin: 0 auto;
  width: 100%; padding-left: 24px; padding-right: 24px;
  animation: fadeUp 0.3s ease-out;
}
@keyframes fadeUp { 
  from { 
    opacity: 0; 
    transform: translateY(12px); 
  } 
  to { 
    opacity: 1; 
    transform: translateY(0); 
  } 
}

.message-row.user { justify-content: flex-end; }
.message-row.ai   { justify-content: flex-start; }

.bubble {
  max-width: 85%; padding: 16px 20px;
  border-radius: 14px; font-size: 15px; line-height: 1.7;
}
.message-row.user .bubble {
  background: var(--user-bubble);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
  color: var(--text);
  padding: 12px 16px;
}
.message-row.ai .bubble {
  background: transparent;
  border-bottom-left-radius: 4px;
  padding-left: 0;
}

.ai-avatar {
  width: 32px; height: 32px; min-width: 32px;
  background: var(--grad);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #000;
  margin-right: 12px; margin-top: 2px; flex-shrink: 0;
}

/* Markdown - Enhanced AI Response Formatting */
.bubble p { 
  margin-bottom: 14px; 
  line-height: 1.7;
}
.bubble p:last-child { margin-bottom: 0; }

/* Headings with better spacing */
.bubble h1 { 
  font-size: 22px;
  font-weight: 700;
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border2);
  color: var(--text);
}
.bubble h2 { 
  font-size: 18px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: var(--text);
}
.bubble h3 { 
  font-size: 16px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
}
.bubble h4 { 
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: var(--text2);
}

/* First heading shouldn't have top margin */
.bubble h1:first-child,
.bubble h2:first-child,
.bubble h3:first-child,
.bubble h4:first-child { 
  margin-top: 0; 
}

/* Lists with better spacing */
.bubble ul, .bubble ol { 
  padding-left: 28px; 
  margin: 12px 0 16px;
  line-height: 1.7;
}
.bubble li { 
  margin-bottom: 8px; 
  line-height: 1.7;
}
.bubble li:last-child { 
  margin-bottom: 0; 
}

/* Nested lists */
.bubble ul ul, .bubble ol ol, .bubble ul ol, .bubble ol ul {
  margin: 6px 0;
  padding-left: 24px;
}

/* Inline code */
.bubble code { 
  background: var(--bg3); 
  padding: 3px 8px; 
  border-radius: 5px; 
  font-size: 13.5px; 
  font-family: 'SF Mono','Fira Code','Consolas',monospace; 
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Code blocks */
.bubble pre { 
  background: var(--bg3); 
  border: 1px solid var(--border); 
  padding: 16px; 
  border-radius: 10px; 
  overflow-x: auto; 
  margin: 14px 0; 
  line-height: 1.5;
}
.bubble pre code { 
  background: none; 
  padding: 0; 
  color: var(--text); 
  font-size: 13.5px;
  border: none;
}

/* Strong/Bold text */
.bubble strong { 
  font-weight: 600;
  color: var(--text);
}

/* Links */
.bubble a { 
  color: var(--accent); 
  text-decoration: none;
  transition: opacity 0.15s;
  font-weight: 500;
}
.bubble a:hover { 
  opacity: 0.8;
  text-decoration: underline;
}

/* Blockquotes */
.bubble blockquote { 
  border-left: 3px solid var(--accent); 
  padding: 12px 16px; 
  background: var(--bg3);
  color: var(--text2); 
  margin: 14px 0; 
  border-radius: 6px;
  font-style: italic;
}

/* Horizontal rules */
.bubble hr {
  border: none;
  border-top: 1px solid var(--border2);
  margin: 20px 0;
}

/* Tables */
.bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
}
.bubble table th,
.bubble table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.bubble table th {
  background: var(--bg3);
  font-weight: 600;
  color: var(--text);
}
.bubble table tr:nth-child(even) {
  background: var(--bg2);
}

/* Better spacing between different elements */
.bubble > *:first-child {
  margin-top: 0 !important;
}
.bubble > *:last-child {
  margin-bottom: 0 !important;
}

.err-msg { color: #ff6b6b; }

/* Copy button */
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; padding: 6px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text3); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
  font-weight: 500;
}
.copy-btn:hover { 
  color: var(--text); 
  border-color: var(--border2); 
  background: var(--bg4); 
}
.copy-btn.copied { 
  color: var(--cyan); 
  border-color: rgba(0,212,255,0.4); 
  background: var(--cyan-dim);
}

/* Chat image */
.chat-image { max-width: 250px; max-height: 250px; border-radius: 10px; object-fit: cover; display: block; margin-bottom: 6px; }

/* File chip */
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg3); border: 1px solid var(--border2); border-radius: 7px; font-size: 13px; color: var(--text2); margin-bottom: 5px; }

/* Typing */
.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 8px 0; }
.typing-indicator span { width: 6px; height: 6px; background: var(--cyan); border-radius: 50%; animation: bounce 1.2s infinite; opacity: 0.7; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-6px); } }

.typing-cursor::after { content:'▋'; animation: blink 0.7s infinite; color: var(--cyan); }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }

/* ── File preview ──────────────────────────── */
.file-preview-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 22px; border-top: 1px solid var(--border);
  max-width: 800px; margin: 0 auto; width: 100%;
}
.file-preview-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 11px; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: 7px;
  font-size: 13px; color: var(--text2); flex: 1; overflow: hidden;
}
.file-preview-item img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }

/* ── Input ─────────────────────────────────── */
.input-area { 
  padding: 16px 20px 20px; 
  background: var(--bg); 
}

.input-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px; padding: 8px 12px;
  max-width: 760px; margin: 0 auto;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within {
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.08);
}

.add-btn, .ai-btn, .mic-btn {
  flex-shrink: 0;
  padding: 6px;
  border-radius: 6px;
}

.add-btn:hover, .mic-btn:hover {
  color: var(--text) !important;
  background: var(--bg3) !important;
}

.ai-btn {
  cursor: default;
  opacity: 0.9;
}

textarea#messageInput {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; resize: none;
  max-height: 200px; line-height: 1.5; font-family: inherit;
}
textarea#messageInput::placeholder { color: var(--text3); }

.send-btn {
  background: var(--grad); 
  border: none;
  border-radius: 8px; 
  color: #000;
  width: 32px; 
  height: 32px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer; 
  transition: all 0.15s;
  flex-shrink: 0;
}
.send-btn:hover { 
  opacity: 0.85;
}
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.icon-btn {
  background: none; border: none; color: var(--text2);
  cursor: pointer; padding: 7px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }

.admin-btn {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  border: 1px solid var(--border2);
}
.admin-btn:hover {
  background: var(--accent-glow) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}



/* Theme icons */
[data-theme="dark"]  .sun-icon  { display: block; }
[data-theme="dark"]  .moon-icon { display: none; }
[data-theme="light"] .sun-icon  { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* ── Responsive ────────────────────────────── */
/* History Sidebar */
.history-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,0.5);
}

.history-sidebar.open {
  transform: translateX(0);
}

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.history-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

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

.history-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.new-chat-btn-history {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 16px;
  padding: 10px 16px;
  background: var(--grad);
  border: none;
  color: #000;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}

.new-chat-btn-history:hover {
  opacity: 0.85;
}

.history-sidebar .chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

@media (max-width: 768px) {
  .sidebar { 
    position: fixed; 
    top: 0; 
    left: 0; 
    bottom: 0; 
    transform: translateX(-100%); 
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { 
    display: block; 
    position: absolute; 
    top: 16px; 
    right: 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .sidebar-close:hover {
    background: var(--bg4);
    color: var(--text);
  }
  .message-row { padding-left: 16px; padding-right: 16px; }
  .bubble { max-width: 85%; }
  .input-area { padding: 12px 16px 16px; }
  .topbar-center {
    position: static;
    transform: none;
  }
  .topbar {
    justify-content: space-between;
  }
  .global-usage-display {
    display: none;
  }
  .credits-display {
    display: none;
  }
}

@media (min-width: 769px) { 
  .sidebar-close { display: none; }
  .sidebar-toggle { display: none; }
}

/* ── Ad Modal ──────────────────────────────── */
.ad-modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.ad-modal {
  background: #0d0d0d;
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 16px;
  width: 100%; max-width: 420px;
  margin: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  overflow: hidden;
}

.ad-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px; font-weight: 600; color: var(--text);
}

.ad-modal-body { padding: 20px 18px; }

.ad-placeholder {
  background: #111;
  border: 1px dashed rgba(0,212,255,0.2);
  border-radius: 10px;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.ad-placeholder-inner { text-align: center; color: var(--text3); }
.ad-placeholder-inner p { margin-top: 10px; font-size: 13px; }
.ad-placeholder-inner .ad-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

.ad-timer-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.ad-timer-bar {
  flex: 1; height: 4px; background: var(--bg3); border-radius: 4px; overflow: hidden;
}
.ad-timer-fill {
  height: 100%; width: 0%;
  background: var(--grad);
  border-radius: 4px;
  transition: width 0.1s linear;
}
#adTimerText { font-size: 12px; color: var(--text2); min-width: 24px; text-align: right; }

.btn-claim {
  width: 100%; padding: 12px;
  background: var(--grad);
  border: none; border-radius: 10px;
  color: #000; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-claim:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-claim:not(:disabled):hover { opacity: 0.85; }

.btn-delete {
  padding: 10px 24px; border-radius: 8px; border: none;
  background: #e53935; color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-delete:hover { opacity: 0.85; }
.btn-cancel {
  padding: 10px 24px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--bg4); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-cancel:hover { opacity: 0.75; }

/* Ad banner top */
.ad-banner-top {
  width: 100%; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  text-align: center; min-height: 60px;
}

/* Owner badge */
.owner-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  background: linear-gradient(135deg, #f7c948, #e6a817);
  color: #000;
  padding: 1px 7px; border-radius: 20px;
  margin-left: 5px; vertical-align: middle;
  letter-spacing: 0.5px;
}

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: #1a1a1a; border: 1px solid rgba(0,212,255,0.25);
  color: var(--text); padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 500; z-index: 9999;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Settings Screen ───────────────────────── */
.settings-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
  animation: slideIn 0.2s ease;
}

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

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.settings-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.15s;
}

.setting-item:hover {
  background: var(--bg3);
  border-color: var(--border2);
}

.setting-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.setting-info svg {
  color: var(--cyan);
  flex-shrink: 0;
}

.setting-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.setting-info p {
  font-size: 13px;
  color: var(--text3);
}

.setting-select {
  padding: 8px 12px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}

.setting-select:hover {
  border-color: var(--cyan);
}

.setting-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

.setting-btn {
  padding: 8px 16px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.setting-btn:hover {
  background: var(--cyan-dim);
  border-color: rgba(0,212,255,0.3);
  color: var(--cyan);
}

.setting-btn.danger {
  color: #ff5555;
}

.setting-btn.danger:hover {
  background: rgba(255,85,85,0.1);
  border-color: rgba(255,85,85,0.3);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg4);
  border: 1px solid var(--border2);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text3);
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--cyan);
  border-color: var(--cyan);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background: #000;
}

/* Help Modal */
.help-modal {
  max-width: 600px;
}

.help-modal-body {
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.help-section {
  margin-bottom: 24px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.help-section p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

.help-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-list li {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.8;
  padding-left: 20px;
  position: relative;
  margin-bottom: 8px;
}

.help-list li:before {
  content: "•";
  color: var(--cyan);
  font-weight: bold;
  position: absolute;
  left: 0;
}

.help-list li strong {
  color: var(--text);
  font-weight: 600;
}


/* ── Font Size Variations ──────────────────── */
body[data-font-size="small"] {
  font-size: 13px;
}
body[data-font-size="small"] .bubble {
  font-size: 13px;
}
body[data-font-size="small"] .welcome h2 {
  font-size: 24px;
}

body[data-font-size="large"] {
  font-size: 16px;
}
body[data-font-size="large"] .bubble {
  font-size: 16px;
}
body[data-font-size="large"] .welcome h2 {
  font-size: 32px;
}

/* ── Chat Style Variations ─────────────────── */
body[data-chat-style="compact"] .message-row {
  padding: 3px 0;
}
body[data-chat-style="compact"] .bubble {
  padding: 8px 12px;
  font-size: 13px;
}

body[data-chat-style="spacious"] .message-row {
  padding: 12px 0;
}
body[data-chat-style="spacious"] .bubble {
  padding: 16px 20px;
  font-size: 15px;
  line-height: 1.8;
}


/* ── Light Theme ───────────────────────────── */
[data-theme="light"] {
  --bg:         #ffffff;
  --bg2:        #f5f5f5;
  --bg3:        #ebebeb;
  --bg4:        #e0e0e0;
  --border:     rgba(0,0,0,0.08);
  --border2:    rgba(0,0,0,0.12);
  --text:       #1a1a1a;
  --text2:      #5a5a5a;
  --text3:      #8a8a8a;
  --accent:     #DFFF00;
  --accent-dim: rgba(223,255,0,0.1);
  --accent-glow:rgba(223,255,0,0.3);
  --user-bubble:#f0f0f0;
  --scrollbar:  #c0c0c0;
  --cyan:       #00a8cc;
}

/* ── Message Actions ───────────────────────── */
.message-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message-row:hover .message-actions {
  opacity: 1;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text3);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}

.action-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.action-btn svg {
  width: 12px;
  height: 12px;
}

/* ── Voice Controls ────────────────────────── */
.mic-btn.recording {
  background: #ff5555 !important;
  color: #fff !important;
  animation: pulse 1.5s infinite;
}

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

.voice-indicator {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
}

.voice-wave span {
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1s infinite ease-in-out;
}

.voice-wave span:nth-child(2) { animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; }

@keyframes wave {
  0%, 100% { height: 16px; }
  50% { height: 8px; }
}

/* ── Search Bar ────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 20px;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
}

.search-bar input::placeholder {
  color: var(--text3);
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  margin: 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg3);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-role {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.search-result-content {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Pinned Messages ───────────────────────── */
.pinned-banner {
  background: var(--accent-dim);
  border-bottom: 1px solid var(--accent);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
}

.pinned-banner:hover {
  background: var(--accent-glow);
}

.pinned-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.pinned-banner-text {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.pinned-count {
  background: var(--accent);
  color: #000;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Folders & Tags ────────────────────────── */
.folder-section {
  margin-bottom: 16px;
}

.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 8px;
}

.folder-header:hover {
  background: var(--bg3);
}

.folder-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.folder-count {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg4);
  padding: 2px 6px;
  border-radius: 8px;
}

.folder-items {
  padding-left: 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-chip:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

.tag-chip .remove {
  cursor: pointer;
  opacity: 0.6;
}

.tag-chip .remove:hover {
  opacity: 1;
}

/* ── Share Modal ───────────────────────────── */
.share-modal {
  max-width: 480px;
}

.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 12px 0;
}

.share-link-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.share-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.share-option-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* ── Export Menu ───────────────────────────── */
.export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000; /* Higher than sidebar (100) */
}

.export-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--text2);
}

.export-item:hover {
  background: var(--bg3);
  color: var(--text);
}

/* ── Code Syntax Highlighting ──────────────── */
.code-block-wrapper {
  position: relative;
  margin: 12px 0;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.code-language {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  font-weight: 600;
}

.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text3);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.code-copy-btn:hover {
  background: var(--bg2);
  color: var(--text);
}

.code-copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Multi-File Upload ─────────────────────── */
.file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px;
  border-top: 1px solid var(--border);
}

.file-preview-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text2);
}

.file-preview-chip .remove {
  cursor: pointer;
  color: var(--text3);
  transition: color 0.15s;
}

.file-preview-chip .remove:hover {
  color: #ff5555;
}

/* ── Private Mode Badge ────────────────────── */
.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: rgba(255,85,85,0.1);
  border: 1px solid rgba(255,85,85,0.3);
  border-radius: 8px;
  font-size: 10px;
  color: #ff5555;
  font-weight: 600;
  margin-left: 6px;
}

/* ── 2FA Setup ─────────────────────────────── */
.qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px 0;
}

.qr-code-container img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
}

.secret-code {
  font-family: monospace;
  font-size: 14px;
  color: var(--text);
  background: var(--bg4);
  padding: 8px 12px;
  border-radius: 6px;
  user-select: all;
}

.verification-input {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.verification-input input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.verification-input input:focus {
  border-color: var(--accent);
}

/* ── Stop Generation Button ────────────────── */
.stop-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #ff5555;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  box-shadow: 0 4px 12px rgba(255,85,85,0.4);
}

.stop-btn:hover {
  opacity: 0.85;
}

/* ── Keyboard Shortcuts Help ──────────────── */
.shortcuts-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.shortcut-action {
  font-size: 13px;
  color: var(--text2);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

.key {
  padding: 3px 8px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text);
  font-weight: 600;
}

/* ── Avatar Upload ─────────────────────────── */
.avatar-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px 0;
}

.avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #000;
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-btn {
  padding: 8px 16px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.avatar-upload-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

/* ── Context Memory Indicator ──────────────── */
.context-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text);
  margin-bottom: 8px;
}

/* ── Loading States ────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive Updates ────────────────────── */
@media (max-width: 768px) {
  .shortcuts-list {
    grid-template-columns: 1fr;
  }
  
  .message-actions {
    opacity: 1;
  }
  
  .search-bar {
    margin: 12px 16px;
  }
  
  .search-results {
    margin: 0 16px;
  }
}

/* ── Accessibility ─────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ── Image Generation ─────────── */
#imageGenBtn:hover {
  color: var(--text) !important;
  background: var(--bg3) !important;
}

#imageGenBtn.active {
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

.web-search-result {
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.web-search-result:hover {
  background: var(--bg4);
  border-color: var(--border2);
}

.web-search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.web-search-result-link {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

.web-search-result-snippet {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

.generated-image-container {
  position: relative;
  margin: 12px 0;
}

.generated-image-container img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.image-gen-prompt {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  font-style: italic;
}

/* Loading skeleton animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  animation: shimmer 2s infinite;
  background: linear-gradient(
    to right,
    var(--bg3) 0%,
    var(--bg4) 20%,
    var(--bg3) 40%,
    var(--bg3) 100%
  );
  background-size: 1000px 100%;
}

/* Search result highlighting */
.search-highlight {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Image generation status */
.image-gen-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.image-gen-status svg {
  animation: spin 1s linear infinite;
}

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

/* ── Enhanced AI Response Sections ─────────── */
/* Numbered sections for step-by-step responses */
.bubble ol {
  counter-reset: item;
  list-style: none;
  padding-left: 0;
}

.bubble ol > li {
  counter-increment: item;
  position: relative;
  padding-left: 40px;
  margin-bottom: 16px;
}

.bubble ol > li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* Nested ordered lists use default style */
.bubble ol ol {
  list-style: decimal;
  padding-left: 24px;
  margin-top: 8px;
}

.bubble ol ol > li {
  padding-left: 0;
}

.bubble ol ol > li::before {
  display: none;
}

/* Unordered lists with custom bullets */
.bubble ul {
  list-style: none;
  padding-left: 0;
}

.bubble ul > li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
}

.bubble ul > li::before {
  content: "●";
  position: absolute;
  left: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: bold;
}

/* Nested unordered lists */
.bubble ul ul {
  padding-left: 24px;
  margin-top: 6px;
}

.bubble ul ul > li::before {
  content: "○";
  font-size: 10px;
}

/* Info boxes for important notes */
.bubble .info-box {
  background: var(--accent-dim);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: 6px;
  margin: 14px 0;
}

.bubble .warning-box {
  background: rgba(255, 165, 0, 0.1);
  border-left: 4px solid #ffa500;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 14px 0;
}

.bubble .error-box {
  background: rgba(255, 85, 85, 0.1);
  border-left: 4px solid #ff5555;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 14px 0;
}

/* Better code block styling */
.bubble pre {
  position: relative;
  background: #1e1e1e;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 14px 0;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Inline code with better contrast */
.bubble code {
  background: var(--bg3);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--accent);
  border: 1px solid var(--border);
  font-weight: 500;
}

.bubble pre code {
  background: none;
  padding: 0;
  border: none;
  color: #d4d4d4;
  font-weight: 400;
}

/* Dividers between sections */
.bubble .section-divider {
  border: none;
  border-top: 2px solid var(--border2);
  margin: 24px 0;
  position: relative;
}

.bubble .section-divider::after {
  content: "●";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 12px;
  color: var(--accent);
  font-size: 10px;
}

/* Better paragraph spacing in AI responses */
.message-row.ai .bubble > p + p {
  margin-top: 14px;
}

/* Highlight important text */
.bubble mark {
  background: var(--accent-dim);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}

/* Better spacing for mixed content */
.bubble p + ul,
.bubble p + ol,
.bubble p + pre,
.bubble p + blockquote {
  margin-top: 12px;
}

.bubble ul + p,
.bubble ol + p,
.bubble pre + p,
.bubble blockquote + p {
  margin-top: 14px;
}
