body { overflow: hidden; height: 100vh; }

#chat-app {
  display: flex; height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ── */
.sidebar {
  width: 260px; min-width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 16px;
}

.sidebar-logo {
  font-family: 'Playfair Display', serif;
  font-size: 16px; color: var(--accent);
  margin-bottom: 32px; padding: 0 8px;
}
.sidebar-logo span { color: var(--text); }

.char-select-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); padding: 0 8px; margin-bottom: 12px;
}

.char-list { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.char-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px;
  cursor: pointer; transition: background .15s;
}
.char-item:hover { background: var(--bg3); }
.char-item.active { background: var(--bg3); }

.ci-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px; color: #fff; flex-shrink: 0;
}

.ci-name { font-size: 14px; font-weight: 500; }
.ci-vibe { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ci-online { margin-left: auto; color: #4ade80; font-size: 12px; }

.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border); }
.back-link {
  display: block; color: var(--muted); text-decoration: none;
  font-size: 13px; padding: 8px;
  transition: color .2s;
}
.back-link:hover { color: var(--text); }

/* ── Chat Main ── */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}

.chat-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(8px);
}

.topbar-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #ff4d8d, #c44fff);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 20px; color: #fff;
  transition: background .3s;
}

.topbar-name { font-weight: 600; font-size: 16px; }
.topbar-status { font-size: 12px; color: #4ade80; }

/* ── Messages ── */
.messages-area {
  flex: 1; overflow-y: auto;
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) transparent;
}

.day-label {
  text-align: center; font-size: 11px;
  color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase; margin: 8px 0;
}

.msg-row {
  display: flex;
  animation: fadeUp .25s ease;
}
.msg-row.ai { justify-content: flex-start; }
.msg-row.user { justify-content: flex-end; }

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

.msg-bubble {
  max-width: 65%; padding: 14px 18px;
  border-radius: 20px; font-size: 15px; line-height: 1.55;
  word-break: break-word;
}

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

.msg-bubble.user {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-bottom-right-radius: 4px;
  color: #fff;
}

.msg-bubble.typing {
  background: var(--bg3);
  border-bottom-left-radius: 4px;
  letter-spacing: 4px; font-size: 18px;
  padding: 14px 20px; color: var(--muted);
}

/* ── Input ── */
.input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

.input-bar {
  display: flex; align-items: flex-end; gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 16px;
  transition: border-color .2s;
}
.input-bar:focus-within { border-color: rgba(255,77,141,0.4); }

#msg-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'Inter', sans-serif;
  font-size: 15px; line-height: 1.5; resize: none;
  max-height: 120px; overflow-y: auto;
}
#msg-input::placeholder { color: var(--muted); }

#send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 10px;
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  transition: opacity .2s, transform .15s;
}
#send-btn:hover { opacity: 0.85; transform: scale(1.05); }

.input-disclaimer {
  text-align: center; font-size: 11px;
  color: var(--muted); margin-top: 10px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .sidebar { display: none; }
  .msg-bubble { max-width: 85%; }
}
