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

:root {
  --bg: #05070b;
  --sidebar: #0f1115;
  --panel: #11141a;
  --panel-soft: #161a22;
  --border: #1f222b;
  --pill: #1c1f27;
  --text: #f5f6f7;
  --muted: #a3a8b3;
  --accent-start: #d256ff;
  --accent-end: #5ac8fa;
  --accent: linear-gradient(120deg, var(--accent-start), var(--accent-end));
  --brand: #ff6ad5;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.muted { color: var(--muted); }

/* Landing -------------------------------------------------- */
.landing-page {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(210, 86, 255, 0.3), transparent 35%),
              radial-gradient(circle at 80% 30%, rgba(90, 200, 250, 0.25), transparent 38%),
              linear-gradient(145deg, #1c1a3a, #0d0c1d 50%, #0b0a17);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 32px clamp(18px, 4vw, 48px);
  overflow: hidden;
}

.landing-page::before,
.landing-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.45), transparent),
                    radial-gradient(1.2px 1.2px at 30% 70%, rgba(255,255,255,0.35), transparent),
                    radial-gradient(1px 1px at 80% 40%, rgba(255,255,255,0.4), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.landing-page.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.landing-top {
  width: min(1100px, 96vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f5f6f7;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.landing-logo-text {
  font-size: 18px;
}

.landing-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #05070b;
  box-shadow: 0 10px 28px rgba(90, 200, 250, 0.35);
  font-weight: 800;
}

.landing-hero {
  width: min(1100px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #d7dcff;
  border: 1px solid rgba(255,255,255,0.16);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.landing-title {
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.5px;
}

.landing-title .accent {
  background: linear-gradient(120deg, #f975ff, #6fd0ff);
  -webkit-background-clip: text;
  color: transparent;
}

.landing-subtitle {
  max-width: 760px;
  font-size: clamp(17px, 2vw, 21px);
  color: #d3d7e2;
  line-height: 1.6;
}

.landing-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.cta-primary,
.cta-secondary {
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cta-primary {
  background: var(--accent);
  color: #05070b;
  box-shadow: 0 10px 30px rgba(242, 91, 255, 0.35);
}

.cta-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(90,200,250,0.4); }

.cta-secondary {
  background: #0c0e12;
  color: #f5f6f7;
}

.cta-secondary:hover { border-color: rgba(255,255,255,0.25); transform: translateY(-2px); }

.feature-row {
  width: min(1100px, 96vw);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 10px;
  z-index: 1;
}

.feature-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  color: #d7dbea;
  box-shadow: var(--shadow);
}

.feature-card h3 {
  color: #f5f6f7;
  font-size: 17px;
  margin-bottom: 6px;
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  color: #f5f6f7;
}

.landing-footer {
  z-index: 1;
  color: #d7dcff;
  font-size: 13px;
}

/* App shell --------------------------------------------- */
.app-container {
  position: relative;
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}

.app-container.visible {
  animation: fade-in 0.4s ease;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* =========================================
   SIDEBAR LOGO FIX (Force Override)
   ========================================= */

/* 1. Target the Link Wrapper */
.sidebar-header .sidebar-logo {
  display: flex !important;
  align-items: center;
  gap: 12px;
  
  /* FORCE remove underline */
  text-decoration: none !important;
  border: none !important;
  
  cursor: pointer;
  width: fit-content;
}

/* 2. Target the 'O' Icon Box */
.sidebar-header .sidebar-logo .logo-icon {
  /* Force dimensions so it doesn't collapse */
  display: flex !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px; /* Prevents squishing */
  
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  
  /* Colors */
  background-color: #3b82f6; /* bright blue fallback */
  background: var(--accent, #3b82f6);
  color: #000 !important; /* Force black text inside the box */
  font-weight: 800;
  
  /* Animation setup */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 3. Target the 'OverLap' Text */
.sidebar-header .sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  
  /* Force white text so it's visible */
  color: #fff !important; 
  
  /* Animation setup */
  transition: transform 0.3s ease;
}

/* =========================================
   HOVER EFFECTS
   ========================================= */

/* Rotate Icon on Hover */
.sidebar-header .sidebar-logo:hover .logo-icon {
  transform: rotate(-12deg) scale(1.1);
}

/* Slide Text on Hover */
.sidebar-header .sidebar-logo:hover .logo-text {
  transform: translateX(4px);
}

.sidebar-close-btn,
.mobile-menu-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.sidebar-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-footer {
  padding: 16px 18px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.new-conversation-btn,
.sidebar-action-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #181b22;
  color: #f5f6f7;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.new-conversation-btn {
  background: #f5f6f7;
  color: #0f1115;
  font-weight: 700;
}

.new-conversation-btn:hover { transform: translateY(-1px); }
.sidebar-action-btn:hover { background: #1c2028; border-color: rgba(255,255,255,0.14); }
.sidebar-action-btn.destructive { color: var(--danger); border-color: rgba(239,68,68,0.4); }

/* Settings block */
.settings-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #181b22;
}
.settings-panel.has-key .settings-indicator {
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.settings-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.settings-toggle-content { display: flex; align-items: center; gap: 10px; }
.settings-indicator { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.settings-content { padding: 0 14px 14px; }
.settings-field { display: flex; flex-direction: column; gap: 8px; }
.api-key-input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1115;
}

.settings-actions { display: flex; gap: 10px; }
.save-api-key-btn,
.clear-api-key-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #181b22;
  cursor: pointer;
}
.save-api-key-btn { background: var(--accent); border-color: transparent; color: #05070b; font-weight: 700; }

.api-key-status { font-size: 12px; min-height: 16px; color: var(--muted); }
.api-key-status.success { color: var(--success); }
.api-key-status.error { color: var(--danger); }

/* New settings drawer */
.settings-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 60;
}
.settings-drawer.open { opacity: 1; pointer-events: auto; }
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.settings-panel-card {
  position: relative;
  width: min(960px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #0c0f15;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
  z-index: 1;
  display: flex;
  flex-direction: column;
}
.settings-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px 18px 4px;
}
.settings-tab {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1115;
  color: #f5f6f7;
  cursor: pointer;
  font-weight: 700;
  transition: border 0.2s ease, transform 0.2s ease;
}
.settings-tab.active {
  border-color: rgba(90,200,250,0.5);
  box-shadow: 0 12px 30px rgba(90,200,250,0.15);
  transform: translateY(-1px);
}
.settings-body {
  padding: 6px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-section { display: none; gap: 14px; flex-direction: column; }
.settings-section.active { display: flex; }
.settings-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #10151d;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.field-label {
  font-size: 13px;
  color: #d4d8e1;
}
.field-input,
.field-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1115;
  color: #f5f6f7;
}
.field-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #f5f6f7 50%), linear-gradient(135deg, #f5f6f7 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #0f1115;
  color: #f5f6f7;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}
.pill-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }
.pill-btn.primary { background: var(--accent); color: #05070b; border-color: transparent; box-shadow: 0 12px 32px rgba(90,200,250,0.28); }
.pill-btn.success { background: rgba(34,197,94,0.12); color: #d9ffe8; border-color: rgba(34,197,94,0.4); }
.pill-btn.ghost { background: #121722; }
.pill-btn.small { padding: 8px 10px; font-size: 13px; }
.pill-btn.wide { width: 100%; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; }
.pill.subtle { background: #0f1115; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.6px; font-size: 12px; color: var(--muted); }
.subhead { color: #cad0dc; font-size: 14px; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e131c;
}
.switch {
  position: relative;
  width: 50px;
  height: 28px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #1a1f27;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.slider:before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #f5f6f7;
  transition: transform 0.2s ease;
}
.switch input:checked + .slider { background: linear-gradient(120deg, #f975ff, #6fd0ff); }
.switch input:checked + .slider:before { transform: translateX(22px); }
.team-select-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.team-meta { color: var(--muted); font-size: 13px; min-height: 18px; }
.team-actions-inline { display: flex; flex-direction: column; gap: 8px; }
.team-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.team-gallery .team-card {
  background: #0d121a;
  border: 1px solid var(--border);
}
.team-gallery .team-card .team-select-btn { background: #0f1115; }
.team-status.compact { min-height: 14px; }
.team-status.error { color: var(--danger); }
.team-status.success { color: var(--success); }

/* Conversation list */
.conversation-list-items { display: flex; flex-direction: column; gap: 10px; }
.no-convos {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.convo {
  padding: 12px;
  border-radius: 12px;
  background: #181b22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.convo:hover {
  background: #1c2029;
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

/* Teams section */
.teams-section {
  padding: 14px 18px 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #10131a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.chip-button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #181b22;
  color: #f5f6f7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}
.chip-button:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-1px); }

.team-list { display: flex; flex-direction: column; gap: 8px; }
.no-teams {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
}
.team-card {
  padding: 12px;
  border-radius: 12px;
  background: #141820;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.team-card:hover {
  border-color: rgba(90,200,250,0.3);
  transform: translateY(-1px);
}
.team-card.active {
  border-color: rgba(90,200,250,0.6);
  box-shadow: 0 10px 26px rgba(90,200,250,0.12);
}
.team-info { display: flex; flex-direction: column; gap: 4px; }
.team-name { font-weight: 700; }
.team-meta { font-size: 12px; color: var(--muted); }
.team-select-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1115;
  color: #f5f6f7;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border 0.2s ease;
}
.team-select-btn:hover { background: #1a1e26; border-color: rgba(255,255,255,0.16); transform: translateY(-1px); }
.team-actions { display: flex; flex-direction: column; gap: 8px; }
.team-status { min-height: 18px; font-size: 12px; color: var(--muted); }
.team-status.success { color: var(--success); }
.team-status.error { color: var(--danger); }
.team-status.info { color: var(--muted); }
.sidebar-action-btn.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #d9ffe8;
}
.sidebar-action-btn.success:hover { background: rgba(34, 197, 94, 0.2); transform: translateY(-1px); }
.sidebar-action-btn.joined {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.6);
  color: #eafff2;
}

/* Team modal */
.team-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.team-modal.active { display: flex; }
.team-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}
.team-modal-panel {
  position: relative;
  width: min(440px, 92vw);
  background: #0f1115;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1;
}
.team-modal-header h3 { margin-bottom: 4px; }
.team-modal-header p { margin: 0; color: var(--muted); font-size: 14px; }
.team-modal-body { display: flex; flex-direction: column; gap: 10px; }
.team-modal-body label { font-size: 13px; color: #e6e7ec; }
.team-modal-body input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b0d13;
  color: var(--text);
}
.team-modal-error { color: var(--danger); min-height: 16px; font-size: 12px; }
.team-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ghost-btn,
.primary-btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 700;
}
.ghost-btn { background: #181b22; color: #f5f6f7; }
.primary-btn {
  background: var(--accent);
  border-color: transparent;
  color: #05070b;
  box-shadow: 0 10px 26px rgba(90,200,250,0.3);
}
.ghost-btn:hover,
.primary-btn:hover { transform: translateY(-1px); }

.convo.active {
  border-color: rgba(90,200,250,0.6);
  box-shadow: 0 8px 26px rgba(90,200,250,0.25);
}

.convo .left { display: flex; align-items: center; gap: 10px; }
.convo-title { font-size: 14px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f5f6f7; }
.convo i { color: var(--muted); cursor: pointer; transition: color 0.2s ease; }
.convo i:hover { color: #f5f6f7; }

/* Spinner */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  margin: 18px auto;
  animation: none;
  display: none;
}

/* Chat area --------------------------------------------- */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Pushes items to left/center/right */
  height: 60px;
  padding: 0 16px;
  background-color: var(--bg-secondary, #1a1a1a); /* Dark background */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

.chat-header-left,
.chat-header-right {
  flex: 1;
  display: flex;
  align-items: center;
}

.chat-header-right {
  justify-content: flex-end;
  gap: 12px;
}

.chat-header-center {
  flex: 2;
  display: flex;
  justify-content: center;
}

.team-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: rgba(255, 255, 255, 0.05); /* Subtle bubble background */
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
  max-width: 200px;
}

.team-chip:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
}

.team-chip-icon {
  font-size: 14px;
  color: #888;
}

.team-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.team-chip-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #666;
  font-weight: 600;
}

.team-chip-name {
  font-size: 13px;
  font-weight: 500;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Buttons & Pills --- */
.icon-button {
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: color 0.2s;
}

.icon-button:hover {
  color: #fff;
  background-color: rgba(255,255,255,0.05);
}

.message-count {
  font-size: 12px;
  color: #666;
  margin-right: 8px;
}

.user-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3b82f6; /* Blue circle */
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #11141a;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}
.icon-button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.16); }
.icon-button.ghost { background: #0c0f15; }

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px max(20px, calc((100% - 840px)/2));
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
}

.messages-container:empty::before {
  content: "No conversations yet — click \"New Conversation\" to start.";
  display: block;
  text-align: center;
  color: var(--muted);
  margin-top: 48px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 820px;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message .avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #13161d;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  overflow: hidden;
}
.message .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
/* Sidebar Home/Close Button */
a.sidebar-logo {
  text-decoration: none !important; /* Removes underline */
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}

/* Hover State */
.sidebar-logo:hover {
  background-color: rgba(255, 255, 255, 0.1); /* Subtle background highlight */
  color: #fff; /* Brighten the icon if it's gray */
  transform: scale(1.05); /* Slight pop effect */
  cursor: pointer;
}


.message .content {
  padding: 14px 16px;
  border-radius: 16px;
  background: #11141a;
  border: 1px solid var(--border);
  word-wrap: break-word;
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
  color: #e6e8ed;
}

.message.assistant .content {
  background: #0d1015;
  border-color: #2a2e38;
}

.message.user .content {
  background: #f5f6f7;
  color: #0b0c0f;
  border-color: #e0e3e8;
}

.message .content pre {
  background: #242a36;
  border-radius: 12px;
  padding: 12px;
  color: #e8edf8;
  overflow-x: auto;
}

.message .content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.message .content .cursor {
  animation: blink 1s step-start infinite;
  color: var(--muted);
}

/* Input */
.input-area {
  padding: 16px 20px 22px;
  border-top: 1px solid var(--border);
  background: #0c0e12;
}

.input-container {
  max-width: 880px;
  margin: 0 auto;
  position: relative;
}

.message-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f5f6f7;
  padding: 16px 58px 16px 16px;
  min-height: 60px;
  color: #0b0c0f;
  resize: none;
}

.message-input:focus {
  outline: 2px solid rgba(90,200,250,0.4);
  box-shadow: 0 10px 28px rgba(90,200,250,0.25);
}

.send-button {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #05070b;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(90,200,250,0.35);
}

/* Stop generating */
.stop-generating {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
}

.stop-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0c0e12;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

/* Scrollbars */
.messages-container::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
  width: 8px;
}
.messages-container::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.14);
  border-radius: 4px;
}

/* Compact mode */
body.compact-mode .sidebar-content { padding: 10px 14px; }
body.compact-mode .messages-container { padding: 16px 22px; }
body.compact-mode .input-container { padding: 14px; }
body.compact-mode .conversation-list-items { gap: 8px; }

/* Code highlighting */
.hljs {
  background: #242a36 !important;
  padding: 16px;
  border-radius: 12px;
}

/* Mobile */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay.active { display: block; }
  .chat-header { padding-left: 14px; padding-right: 14px; }
  .messages-container { padding: 20px; }
  .control-panel, .input-area { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 640px) {
  .landing-top { flex-direction: column; gap: 12px; }
  .landing-hero { align-items: flex-start; text-align: left; }
  .landing-ctas { width: 100%; }
  .cta-primary, .cta-secondary { flex: 1; text-align: center; justify-content: center; }
  .chat-title { display: none; }
  .chat-header-center { display: none; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

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

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

.landing-top {
  display: flex;
  justify-content: space-between; /* Pushes logo left, auth btn right */
  align-items: center;
  padding: 20px 40px;
}

.auth-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.auth-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}