@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

/* ═══════════════════════════════════
   NEURO CHATBOT — Neumorphism UI
   Light + Dark  ·  Purple Accent
═══════════════════════════════════ */

.neuro-app[data-theme="light"] {
  --bg:         #e8e6f0;
  --bg-d:       #dddae8;
  --bg-l:       #f2f0fa;
  --acc:        #7c5cbf;
  --acc2:       #a98eda;
  --acc-s:      rgba(124,92,191,0.12);
  --txt:        #3d3650;
  --txt2:       #7a7390;
  --txt3:       #b0aac4;
  --green:      #4caf8a;
  --sh-out:     6px 6px 14px #cbc9d8, -6px -6px 14px #ffffff;
  --sh-in:      inset 4px 4px 10px #cbc9d8, inset -4px -4px 10px #ffffff;
  --sh-sm:      3px 3px 8px #cbc9d8, -3px -3px 8px #ffffff;
  --sh-sm-in:   inset 2px 2px 6px #cbc9d8, inset -2px -2px 6px #ffffff;
  --sh-acc:     4px 4px 12px rgba(124,92,191,0.35), -2px -2px 8px #ffffff;
  --bdr:        rgba(255,255,255,0.55);
}

.neuro-app[data-theme="dark"] {
  --bg:         #1e1c28;
  --bg-d:       #171620;
  --bg-l:       #252333;
  --acc:        #9b7ee0;
  --acc2:       #c3a8f5;
  --acc-s:      rgba(155,126,224,0.14);
  --txt:        #e8e4f5;
  --txt2:       #9991bb;
  --txt3:       #5e5880;
  --green:      #4cba94;
  --sh-out:     6px 6px 14px #131221, -6px -6px 14px #292737;
  --sh-in:      inset 4px 4px 10px #131221, inset -4px -4px 10px #292737;
  --sh-sm:      3px 3px 8px #131221, -3px -3px 8px #292737;
  --sh-sm-in:   inset 2px 2px 6px #131221, inset -2px -2px 6px #292737;
  --sh-acc:     4px 4px 12px rgba(155,126,224,0.4), -2px -2px 8px #292737;
  --bdr:        rgba(255,255,255,0.06);
}

/* ── RESET ── */
.neuro-app *, .neuro-app *::before, .neuro-app *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── APP SHELL ── */
.neuro-app {
  font-family: 'DM Sans', system-ui, sans-serif;
  width: 100%;
  background: var(--bg);
  border-radius: 28px;
  box-shadow: var(--sh-out);
  display: grid;
  grid-template-columns: 200px 1fr 210px;
  height: 640px;
  overflow: hidden;
  transition: background 0.4s ease, box-shadow 0.4s ease;
  position: relative;
}

/* ── SIDEBAR ── */
.neuro-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--bdr);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.neuro-sidebar-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt3);
  padding: 0 8px;
  margin-bottom: 8px;
}

.neuro-chat-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--txt2);
  font-size: 13px;
  font-weight: 400;
}
.neuro-chat-item:hover { color: var(--txt); }
.neuro-chat-item.active {
  box-shadow: var(--sh-in);
  color: var(--acc);
  font-weight: 500;
}

.neuro-ci-icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  transition: all 0.25s;
}
.neuro-chat-item.active .neuro-ci-icon {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: var(--sh-acc);
}

.neuro-ci-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neuro-ci-arrow { font-size: 10px; color: var(--acc); }

.neuro-sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bg-d), transparent);
  margin: 8px 6px;
}

.neuro-new-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  border-radius: 14px;
  border: none;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  color: var(--acc);
  transition: all 0.2s;
  width: 100%;
  margin-top: auto;
}
.neuro-new-btn:hover { box-shadow: var(--sh-out); }
.neuro-new-btn:active { box-shadow: var(--sh-in); }

/* ── CHAT PANEL ── */
.neuro-chat-panel {
  display: flex;
  flex-direction: column;
}

.neuro-chat-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: center;
}

.neuro-hdr-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 18px;
  border-radius: 20px;
  box-shadow: var(--sh-in);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--acc);
}

.neuro-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: neuroPulse 2.4s ease-in-out infinite;
}
@keyframes neuroPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.3;transform:scale(.7)} }

/* Messages */
.neuro-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.neuro-messages::-webkit-scrollbar { width: 3px; }
.neuro-messages::-webkit-scrollbar-thumb { background: var(--bg-d); border-radius: 3px; }

.neuro-msg-row {
  display: flex;
  gap: 9px;
  animation: neuroMsgIn 0.35s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes neuroMsgIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

.neuro-bot  { justify-content: flex-start; align-items: flex-end; }
.neuro-user { justify-content: flex-end; }

.neuro-bot-ava {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

.neuro-bubble {
  max-width: 72%;
  padding: 11px 15px;
  border-radius: 17px;
  font-size: 13.5px; line-height: 1.65;
  word-break: break-word;
}
.neuro-bot .neuro-bubble {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  color: var(--txt);
  border-bottom-left-radius: 4px;
}
.neuro-user .neuro-bubble {
  background: linear-gradient(135deg, var(--acc) 0%, var(--acc2) 100%);
  color: #fff;
  box-shadow: var(--sh-acc);
  border-bottom-right-radius: 4px;
}

.neuro-ts {
  font-size: 10px;
  color: var(--txt3);
  margin-top: 3px;
  padding: 0 3px;
}

/* Typing */
.neuro-typing-row {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 20px 6px;
}
.neuro-typing-bub {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  border-radius: 14px; border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex; gap: 4px; align-items: center;
}
.neuro-typing-bub span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--acc2);
  animation: neuroTd 1.3s ease-in-out infinite;
}
.neuro-typing-bub span:nth-child(2){animation-delay:.18s}
.neuro-typing-bub span:nth-child(3){animation-delay:.36s}
@keyframes neuroTd{0%,60%,100%{transform:translateY(0);opacity:.4}30%{transform:translateY(-5px);opacity:1}}

/* Chips */
.neuro-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 20px 10px;
}
.neuro-chip {
  padding: 7px 13px;
  border-radius: 20px; border: none;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--txt2);
  cursor: pointer;
  transition: all 0.2s;
}
.neuro-chip:hover { color: var(--acc); box-shadow: var(--sh-out); }
.neuro-chip:active { box-shadow: var(--sh-in); color: var(--acc); }

/* Input */
.neuro-input-area {
  display: flex; align-items: center; gap: 9px;
  padding: 0 18px 18px;
}
.neuro-input-wrap {
  flex: 1;
  background: var(--bg);
  box-shadow: var(--sh-in);
  border-radius: 14px;
  padding: 0 15px;
}
.neuro-input {
  width: 100%;
  background: transparent; border: none; outline: none;
  padding: 13px 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--txt);
}
.neuro-input::placeholder { color: var(--txt3); }

.neuro-send-btn {
  width: 46px; height: 46px;
  border-radius: 14px; border: none;
  background: linear-gradient(135deg, var(--acc) 0%, var(--acc2) 100%);
  box-shadow: var(--sh-acc);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(.34,1.5,.64,1);
}
.neuro-send-btn:hover { transform: scale(1.07) translateY(-2px); }
.neuro-send-btn:active { transform: scale(.93); box-shadow: var(--sh-in); }
.neuro-send-btn:disabled { opacity: .45; transform: none; cursor: not-allowed; }

/* ── CONTROL PANEL ── */
.neuro-control {
  border-left: 1px solid var(--bdr);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.neuro-control::-webkit-scrollbar { width: 3px; }
.neuro-control::-webkit-scrollbar-thumb { background: var(--bg-d); border-radius: 3px; }

.neuro-cp-section { display: flex; flex-direction: column; }

.neuro-cp-title {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--txt3); margin-bottom: 9px;
}

.neuro-status-card {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 500; color: var(--txt);
}

/* Toggle */
.neuro-toggle {
  width: 44px; height: 24px;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--sh-sm-in);
  position: relative; cursor: pointer;
  transition: all 0.3s;
}
.neuro-toggle.on {
  background: linear-gradient(135deg, var(--green), #6dd4a8);
  box-shadow: 2px 2px 6px rgba(76,175,138,.35), -1px -1px 4px var(--bg-l);
}
.neuro-toggle::after {
  content: '';
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-l);
  box-shadow: 2px 2px 5px rgba(0,0,0,.15);
  position: absolute; top: 3px; left: 3px;
  transition: transform 0.3s cubic-bezier(.34,1.5,.64,1);
}
.neuro-toggle.on::after { transform: translateX(20px); }

/* History */
.neuro-history-card {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  border-radius: 14px;
  overflow: hidden;
}
.neuro-hist-item {
  padding: 9px 13px;
  font-size: 11.5px; color: var(--txt2);
  border-bottom: 1px solid var(--bdr);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all 0.2s;
}
.neuro-hist-item:last-child { border-bottom: none; }
.neuro-hist-item:hover { color: var(--acc); padding-left: 17px; background: var(--bg-l); }

/* Tools grid */
.neuro-tools-grid {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.neuro-tool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px;
  border-radius: 11px;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.neuro-tool:hover { box-shadow: var(--sh-out); transform: translateY(-2px); }
.neuro-tool:active { box-shadow: var(--sh-in); transform: none; }
.neuro-tool-icon { font-size: 18px; }
.neuro-tool-label { font-size: 9.5px; font-weight: 500; color: var(--txt3); text-align: center; }

/* Theme btn */
.neuro-theme-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px;
  border-radius: 14px; border: none;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  color: var(--txt2); cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}
.neuro-theme-btn:hover { color: var(--acc); box-shadow: var(--sh-out); }
.neuro-theme-btn:active { box-shadow: var(--sh-in); }

/* Responsive */
@media (max-width: 780px) {
  .neuro-app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; height: auto; border-radius: 18px; }
  .neuro-sidebar, .neuro-control { display: none; }
  .neuro-chat-panel { height: 550px; }
}
