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

:root {
  --bg: #0a0a0a;
  --bg2: #111;
  --bg3: #1a1a1a;
  --bg4: #222;
  --border: #2a2a2a;
  --border2: #333;
  --txt: #f0f0f0;
  --txt2: #aaa;
  --txt3: #555;
  --accent: #7F77DD;
  --accent2: #AFA9EC;
  --green: #1D9E75;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
}

/* ── NAV ── */
nav {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--txt);
  text-decoration: none;
}

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon i {
  font-size: 15px;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 24px;
}

.nav-links a {
  font-size: 13px;
  color: var(--txt2);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--txt);
  background: var(--bg3);
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-outline {
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 8px;
  border: 0.5px solid var(--border2);
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-outline:hover {
  background: var(--bg3);
  color: var(--txt);
}

.btn-primary {
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

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

/* ── LAYOUT ── */
#main {
  display: flex;
  height: calc(100vh - 56px);
}

/* ── SIDEBAR ── */
#sidebar {
  width: 230px;
  border-right: 0.5px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 2px;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 11px;
  color: var(--txt3);
  padding: 8px 10px 4px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--txt2);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item:hover {
  background: var(--bg3);
  color: var(--txt);
}

.sidebar-item.active {
  background: var(--bg4);
  color: var(--txt);
}

.sidebar-item i {
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-new {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 4px;
  transition: opacity 0.15s;
}

.sidebar-new:hover {
  opacity: 0.88;
}

.sidebar-new i {
  font-size: 15px;
}

.spacer {
  flex: 1;
}

/* ── CHAT AREA ── */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

#chat-header .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--txt);
}

#chat-header .meta {
  font-size: 12px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 5px;
}

#chat-header .meta::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ── MESSAGES ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#messages::-webkit-scrollbar {
  width: 4px;
}

#messages::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 72%;
}

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

.msg.ai {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg.ai .msg-avatar {
  background: var(--accent);
}

.msg.user .msg-avatar {
  background: var(--bg4);
  border: 0.5px solid var(--border2);
}

.msg-avatar i {
  font-size: 15px;
  color: #fff;
}

.msg.user .msg-avatar i {
  color: var(--txt2);
}

.bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.msg.ai .bubble {
  background: var(--bg3);
  color: var(--txt);
  border: 0.5px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.user .bubble {
  background: #534AB7;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── TYPING ── */
.typing-dot {
  display: flex;
  gap: 4px;
  padding: 12px 15px;
}

.typing-dot span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--txt3);
  animation: blink 1.2s infinite;
}

.typing-dot span:nth-child(2) { animation-delay: 0.2s; }
.typing-dot span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── SUGGESTIONS ── */
#suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 12px;
}

.sug {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
  color: var(--txt2);
  background: transparent;
  cursor: pointer;
  transition: all 0.12s;
}

.sug:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

/* ── INPUT ── */
#input-wrap {
  padding: 12px 20px;
  border-top: 0.5px solid var(--border);
  background: var(--bg2);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

#inp {
  flex: 1;
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 14px;
  font-family: inherit;
  color: var(--txt);
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

#inp:focus {
  border-color: var(--accent);
}

#inp::placeholder {
  color: var(--txt3);
}

#send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

#send-btn:hover { opacity: 0.85; }
#send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#send-btn i {
  font-size: 16px;
  color: #fff;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  #sidebar { display: none; }
  .nav-links { display: none; }
}
