/* ========================================
   Pidgey Assist — Forest / Leaf Theme
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap');

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

:root {
  --forest-dark: #1e3a8a;
  --forest-mid: #2563eb;
  --forest-light: #3b82f6;
  --leaf-green: #60a5fa;
  --leaf-accent: #93c5fd;
  --bark-brown: #92400e;
  --warm-cream: #fefce8;
  --gold: #f59e0b;
  --bg: #eff6ff;
  --msg-bot: #dbeafe;
  --msg-user: #1d4ed8;
  --text: #1e3a8a;
  --text-light: #6b7280;
  --radius: 16px;
}

.dark-mode {
  --forest-dark: #0f172a;
  --forest-mid: #1e293b;
  --forest-light: #334155;
  --leaf-green: #3b82f6;
  --leaf-accent: #60a5fa;
  --bark-brown: #451a03;
  --warm-cream: #0f172a;
  --gold: #f59e0b;
  --bg: #020617;
  --msg-bot: #1e293b;
  --msg-user: #2563eb;
  --text: #f1f5f9;
  --text-light: #94a3b8;
}

.dark-mode .settings-panel,
.dark-mode .input-area,
.dark-mode #chat-input-wrap {
  background: #0f172a !important;
  color: #f1f5f9 !important;
}

.dark-mode .settings-panel select,
.dark-mode .settings-panel input,
.dark-mode #chat-input {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

.dark-mode .message.bot .message-bubble {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

.dark-mode .message.user .message-bubble {
  background: #2563eb;
  color: white;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Subtle leaf pattern background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(96, 165, 250, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(147, 197, 253, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hidden {
  display: none !important;
}

/* ======== SETUP OVERLAY ======== */
.setup-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--forest-dark) 0%, #1e3a2f 50%, var(--forest-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.setup-content {
  text-align: center;
  color: white;
  max-width: 340px;
}

.setup-mascot {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.setup-content h2 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.setup-content p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
  line-height: 1.5;
}

.setup-link {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--leaf-accent);
  padding: 10px 20px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.setup-link:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.setup-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.setup-input-row input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.setup-input-row input:focus {
  border-color: var(--leaf-green);
}

.setup-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.btn-primary {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--leaf-green) 0%, #22c55e 100%);
  color: var(--forest-dark);
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.3);
}

.setup-hint {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.35) !important;
}

/* ======== MAIN APP ======== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ======== DRAG & DROP OVERLAY ======== */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 58, 138, 0.85);
  /* forest-dark translucent */
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px dashed var(--leaf-accent);
  border-radius: 12px;
  margin: 12px;
  animation: pulse-drop 2s infinite;
}

@keyframes pulse-drop {
  0% {
    border-color: rgba(147, 197, 253, 0.5);
  }

  50% {
    border-color: var(--leaf-accent);
  }

  100% {
    border-color: rgba(147, 197, 253, 0.5);
  }
}

.drop-content {
  text-align: center;
  color: white;
}

.drop-content span {
  font-size: 64px;
  display: block;
  margin-bottom: 12px;
}

.drop-content p {
  font-size: 16px;
  font-weight: 900;
}

/* ======== HEADER ======== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-mid) 100%);
  color: white;
  flex-shrink: 0;
  border-bottom: 2px solid var(--leaf-green);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mascot-badge {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.4s ease;
}

/* Phoenix Mode: blue glow on the icon when activated */
.mascot-badge.phoenix-active {
  background: rgba(37, 99, 235, 0.25);
  border-color: #60a5fa;
  box-shadow:
    0 0 8px 2px rgba(96, 165, 250, 0.6),
    0 0 20px 4px rgba(37, 99, 235, 0.35),
    0 0 40px 8px rgba(59, 130, 246, 0.15);
  animation: phoenix-pulse 2.5s ease-in-out infinite;
}

@keyframes phoenix-pulse {

  0%,
  100% {
    box-shadow:
      0 0 8px 2px rgba(96, 165, 250, 0.6),
      0 0 20px 4px rgba(37, 99, 235, 0.35),
      0 0 40px 8px rgba(59, 130, 246, 0.15);
  }

  50% {
    box-shadow:
      0 0 14px 4px rgba(96, 165, 250, 0.9),
      0 0 32px 8px rgba(37, 99, 235, 0.55),
      0 0 60px 16px rgba(59, 130, 246, 0.25);
  }
}



.header-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.header-status {
  font-size: 10px;
  color: var(--leaf-accent);
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

/* ======== SETTINGS ======== */
.settings-panel {
  padding: 16px;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  flex-shrink: 0;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.settings-panel label {
  display: block;
  font-size: 11.5px;
  font-weight: 900;
  color: var(--forest-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 10px;
}

.settings-panel label:first-child {
  margin-top: 0;
}

.settings-key-row {
  display: flex;
  gap: 8px;
}

.settings-panel input,
.settings-panel select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.settings-panel input:focus,
.settings-panel select:focus {
  border-color: var(--leaf-green);
}

.btn-small {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--forest-mid);
  color: white;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--forest-dark);
}

.settings-saved {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--leaf-green);
}

/* ======== MESSAGES ======== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: msgIn 0.3s ease-out;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.bot {
  align-self: flex-start;
}

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

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 500;
}

.message.bot .message-bubble {
  background: var(--msg-bot);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid #bfdbfe;
}

.message.user .message-bubble {
  background: var(--leaf-accent);
  color: var(--forest-dark);
  font-weight: 700;
  border-bottom-right-radius: 4px;
}

/* Thinking indicator */
.thinking {
  display: flex;
  gap: 6px;
  padding: 14px 18px;
}

.thinking span {
  width: 8px;
  height: 8px;
  background: var(--leaf-green);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

.thinking span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ======== LEAF DECORATION ======== */
.leaf-decoration {
  display: flex;
  justify-content: space-around;
  padding: 4px 16px;
  opacity: 0.4;
  flex-shrink: 0;
}

.leaf {
  font-size: 16px;
  animation: sway 4s ease-in-out infinite;
}

.l1 {
  animation-delay: 0s;
}

.l2 {
  animation-delay: 0.5s;
}

.l3 {
  animation-delay: 1s;
}

.l4 {
  animation-delay: 1.5s;
}

.l5 {
  animation-delay: 2s;
}

@keyframes sway {

  0%,
  100% {
    transform: rotate(-5deg);
  }

  50% {
    transform: rotate(5deg);
  }
}

/* ======== PRESET BUTTONS ======== */
.preset-buttons {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px 16px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  /* Firefox */
  flex-shrink: 0;
}

.preset-buttons::-webkit-scrollbar {
  display: none;
}

/* Chrome */

.preset-btn {
  background: #f8fafc;
  border: 1.5px solid #bfdbfe;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.preset-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.preset-btn:active {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e3a8a;
  transform: translateY(0);
}

/* ======== INPUT AREA ======== */
.input-area {
  padding: 12px 16px 16px;
  background: white;
  border-top: 1px solid #dbeafe;
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 8px;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  border-radius: 14px;
  padding: 4px;
  transition: border-color 0.2s;
}

.input-row:focus-within {
  border-color: var(--leaf-green);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* Quick Menu Styles */
.btn-quick-menu {
  border: none;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 4px 0 4px 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-quick-menu:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}
.btn-quick-menu svg {
  width: 16px;
  height: 16px;
  fill: white;
}
.quick-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.quick-menu-item:hover {
  background: #f1f5f9;
}
.quick-menu-item span:first-child {
  font-size: 16px;
}
.qm-label {
  flex: 1;
  text-align: left;
  font-weight: 600;
  color: #334155;
  font-size: 13px;
}
.qm-cmd {
  font-size: 11px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.quick-menu-item.phoenix-locked {
  opacity: 0.7;
}
.quick-menu-item.phoenix-locked:hover {
  background: #fef2f2;
}

#chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: #020617;
  /* High contrast black/navy */
  outline: none;
}

#chat-input::placeholder {
  color: #3b82f6;
  font-weight: 600;
}

.btn-mic,
.btn-vision {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #3b82f6;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-mic:hover,
.btn-vision:hover {
  background: #bfdbfe;
  color: #1e3a8a;
}

.btn-vision.active {
  background: var(--leaf-green);
  color: var(--forest-dark);
}

.btn-mic.recording {
  background: #ef4444;
  /* red */
  color: white;
  animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.btn-send {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, var(--forest-mid) 0%, var(--forest-light) 100%);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(45, 74, 45, 0.3);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ======== SCROLLBAR ======== */
.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: #bfdbfe;
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: var(--leaf-green);
}

/* ======== LINKS IN MESSAGES ======== */
.message-bubble a {
  color: var(--forest-light);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message.user .message-bubble a {
  color: var(--leaf-accent);
}

/* ======== ERROR STATE ======== */
.message.error .message-bubble {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ======== DARK MODE ======== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --text: #f8fafc;
    --msg-bot: #1e293b;
    --msg-user: #2563eb;
  }

  .settings-panel,
  .input-area {
    background: #0f172a;
    border-color: #334155;
  }

  .settings-panel input,
  .settings-panel select,
  .preset-btn {
    background: #1e293b;
    color: white;
    border-color: #475569;
  }

  .input-row {
    background: #1e293b;
    border-color: #475569;
  }

  #chat-input {
    background: transparent;
    color: white;
  }

  .preset-btn:hover {
    background: #334155;
    border-color: #60a5fa;
    color: #eff6ff;
  }

  .preset-btn:active {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #dbeafe;
  }

  .message.bot .message-bubble {
    border-color: #334155;
  }

  body::before {
    opacity: 0.1;
  }

  /* Quick Menu Dark Mode */
  #quick-menu {
    background: #1e293b !important;
    border-color: #334155 !important;
  }
  .quick-menu-item:hover {
    background: #334155;
  }
  .qm-label {
    color: #f8fafc;
  }
  .qm-cmd {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
  }
  .quick-menu-item.phoenix-locked:hover {
    background: #451a1a;
  }
}

/* ── Follow-up suggestion chips ── */
.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding: 0 2px;
}

.followup-chip {
  background: #eff6ff;
  border: 1.5px solid #93c5fd;
  color: #1d4ed8;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.3;
}

.followup-chip:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

/* ── Focus mode pills ── */
.focus-btn {
  border: 1.5px solid #bfdbfe;
  background: transparent;
  color: #3b82f6;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}

.focus-btn:hover,
.focus-btn.active {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  border-color: transparent;
}

/* == Phoenix Mode Blue Glow == */
body.phoenix-mode {
  background: linear-gradient(160deg, #eff6ff 0%, #e0f2fe 100%);
}

body.phoenix-mode .header {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8, #0369a1);
  box-shadow: 0 2px 20px rgba(59, 130, 246, 0.4);
}

body.phoenix-mode .message.bot .message-bubble {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border: 1.5px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
  color: #1e3a8a;
}

body.phoenix-mode .input-area {
  border-top: 2px solid rgba(59, 130, 246, 0.3);
  background: rgba(219, 234, 254, 0.5);
  box-shadow: 0 -4px 20px rgba(59, 130, 246, 0.1);
}

body.phoenix-mode #chat-input {
  border: 1.5px solid #93c5fd;
  background: #f0f9ff;
  color: #020617;
  /* Override dark mode white text since bg is light */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

body.phoenix-mode .mascot-badge {
  border-radius: 10px;
  animation: phoenix-pulse 2s ease-in-out infinite;
}

@keyframes phoenix-pulse {

  0%,
  100% {
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.5), 0 0 24px rgba(59, 130, 246, 0.2);
  }

  50% {
    box-shadow: 0 0 22px rgba(6, 182, 212, 0.9), 0 0 44px rgba(59, 130, 246, 0.5);
  }
}

/* ── Upgrade Button CTA ── */
.btn-upgrade-cta {
  background: linear-gradient(135deg, #f59e0b, #f97316) !important;
  border-color: #fbbf24 !important;
  color: white !important;
  font-weight: 900 !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
  animation: upgrade-pulse 3s ease-in-out infinite;
}

.btn-upgrade-cta:hover {
  background: linear-gradient(135deg, #fbbf24, #f97316) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5) !important;
  border-color: #f59e0b !important;
  color: white !important;
}

@keyframes upgrade-pulse {

  0%,
  100% {
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
  }

  50% {
    box-shadow: 0 2px 18px rgba(245, 158, 11, 0.65);
  }
}

/* Hide upgrade button once Phoenix is active */
body.phoenix-mode #btn-upgrade {
  display: none !important;
}

/* Blue glow on ALL chat bubbles when upgraded (phoenix-mode) */
body.phoenix-mode .message-bubble {
  box-shadow: 0 0 0 1.5px rgba(59, 130, 246, 0.35), 0 2px 12px rgba(6, 182, 212, 0.18);
  transition: box-shadow 0.4s ease;
}

body.phoenix-mode .message.bot .message-bubble {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
}

body.phoenix-mode .message.user .message-bubble {
  box-shadow: 0 0 0 1.5px rgba(6, 182, 212, 0.4), 0 2px 16px rgba(59, 130, 246, 0.25);
}
/* ======== NEW APP LAYOUT ======== */
.app-layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  height: 100%;
}

/* Fix panels to overlay properly */
.settings-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: white;
  max-height: 100%;
  border-bottom: none;
}
.dark-mode .settings-panel { background: #0f172a; }

/* Let messages flow normally */
.messages {
  flex: 1;
}

/* ======== SIDEBAR TOOLBELT ======== */
.sidebar-toolbelt {
  width: 56px;
  background: white;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 50;
  flex-shrink: 0;
  box-shadow: -2px 0 10px rgba(0,0,0,0.02);
}
.dark-mode .sidebar-toolbelt {
  background: #0f172a;
  border-left-color: #334155;
}

.sidebar-top, .sidebar-middle, .sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.sidebar-middle-divider {
  width: 24px;
  height: 2px;
  background: #f1f5f9;
  margin: 8px 0;
  border-radius: 2px;
}
.dark-mode .sidebar-middle-divider { background: #334155; }

.sidebar-middle {
  flex: 1; /* Push bottom icons down */
}

.sidebar-btn {
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.dark-mode .sidebar-btn { color: #94a3b8; }

.sidebar-btn:hover {
  background: #f1f5f9;
  color: #1e3a8a;
}
.dark-mode .sidebar-btn:hover { background: #1e293b; color: white; }

.sidebar-btn.active {
  background: #eff6ff;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(37,99,235,0.15);
}
.dark-mode .sidebar-btn.active { background: #1e293b; color: #60a5fa; }

.sidebar-btn .icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.sidebar-btn .label {
  font-size: 8.5px;
  font-weight: 700;
  opacity: 0.8;
}

.sidebar-bottom .label {
  display: none;
}
.sidebar-bottom .sidebar-btn {
  height: 36px;
}
