/* Chat pro — warm SaaS layout (Human Design.ai inspired) */

@import url('/css/tokens.css');
@import url('/shared/css/tokens-brand-vinar.css');

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

:root {
  --accent: var(--brand-primary, #7C5CFF);
  --accent2: #9B84FF;
  --text: var(--text-1, #1A1A2E);
  --muted: var(--text-2, #5C5C7A);
  --bubble-ai: var(--s2, #F5F2EC);
  --bubble-user: linear-gradient(135deg, #7C5CFF, #6B4FE0);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Sora', 'Mitr', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

.bg-stars { display: none !important; }

#chat-topbar {
  flex-shrink: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--s1);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.topbar-logo { display: flex; align-items: center; gap: 0.55rem; }

.topbar-logo .v-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar-logo span {
  font-family: 'Mitr', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-1);
}

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.mode-picker {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--s2);
}

.mode-btn {
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.66rem;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  font-weight: 600;
}

.mode-btn:hover { color: var(--text-1); background: var(--brand-primary-dim); }
.mode-btn.active { color: var(--brand-primary); background: var(--brand-primary-dim); }

#topbar-user-badge {
  font-size: 0.72rem;
  color: var(--text-2);
  background: var(--s2);
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

#chat-layout-pro {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

#chat-layout-pro > #chat-main {
  flex: 1;
  min-width: 0;
}

#chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  height: calc(100dvh - 52px);
  background: var(--bg);
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 4px; }

#prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem 1rem 0.25rem;
}

.chip {
  border: 1px solid var(--border-md);
  background: var(--s1);
  color: var(--text-2);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  font-family: inherit;
}

.chip:hover {
  background: var(--brand-primary-dim);
  border-color: var(--brand-primary);
  color: var(--text-1);
}

#greeting-card {
  margin: 0.75rem 1rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 20px);
  box-shadow: var(--shadow-sm);
}

#greeting-card h3 {
  font-family: 'Mitr', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 0.3rem;
}

#greeting-card p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.msg-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.msg-row.user { flex-direction: row-reverse; }

.bubble {
  max-width: min(75%, 520px);
  padding: 0.65rem 0.9rem;
  font-size: 0.83rem;
  line-height: 1.6;
  border-radius: 1rem;
  word-break: break-word;
}

.bubble.ai {
  background: var(--bubble-ai);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.bubble.user {
  background: var(--bubble-user);
  border-bottom-right-radius: 4px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.bubble.thinking { color: var(--muted); font-style: italic; }

.intent-cta-card {
  max-width: min(78%, 560px);
  padding: 0.72rem 0.85rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-md);
  background: var(--s1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.intent-cta-title {
  font-size: 0.76rem;
  color: var(--text-1);
  font-weight: 600;
}

.intent-cta-sub {
  font-size: 0.72rem;
  color: var(--text-2);
  line-height: 1.45;
}

.intent-cta-btn {
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

.intent-cta-btn:hover { opacity: 0.9; }

.upgrade-card {
  max-width: min(88%, 500px);
  background: linear-gradient(135deg, var(--brand-primary-dim), var(--s2));
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upgrade-card-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.upgrade-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.35;
}

.upgrade-card-sub {
  font-size: 0.74rem;
  color: var(--text-2);
  line-height: 1.5;
}

.upgrade-card-btn {
  align-self: flex-start;
  margin-top: 2px;
  background: var(--brand-primary);
  border: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 6px 14px;
  cursor: pointer;
}

.upgrade-card-dismiss {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.7rem;
  cursor: pointer;
  align-self: flex-start;
  padding: 0;
}

#q-counter-bar {
  padding: 0.35rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--s2);
}

#q-counter-bar.hidden { display: none; }

.q-bar-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.q-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

#q-upgrade-cta {
  cursor: pointer;
  color: var(--brand-primary);
  text-decoration: underline;
  white-space: nowrap;
}

#input-wrap {
  padding: 0.75rem 1rem 1rem;
  background: var(--s1);
  border-top: 1px solid var(--border);
}

#chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border-md);
  border-radius: 1.1rem;
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  box-shadow: var(--shadow-sm);
}

#chat-form:focus-within { border-color: var(--brand-primary); }

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  resize: none;
  line-height: 1.5;
  max-height: 140px;
  min-height: 22px;
  overflow-y: auto;
}

#chat-input::placeholder { color: var(--muted); }

#send-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-ink, #1A1A2E);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background .18s, transform .12s;
}

#send-btn:hover { opacity: 0.9; }
#send-btn:active { transform: scale(0.93); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#hd-context-strip {
  display: none;
  padding: 0.4rem 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--brand-primary-dim);
}

#hd-context-strip.visible { display: flex; }

.hd-tag {
  font-size: 0.68rem;
  border: 1px solid var(--border);
  background: var(--s1);
  color: var(--text-2);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

#chat-sidebar-pro {
  display: none;
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--s2);
  flex-direction: column;
  overflow: hidden;
}

#chat-context-pro {
  display: none;
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--s1);
  overflow-y: auto;
  padding: 16px;
}

@media (min-width: 1024px) {
  body.chat-pro-layout { flex-direction: column; }
  #chat-sidebar-pro,
  #chat-context-pro { display: flex; }
  body.chat-pro-layout #chat-topbar { height: 56px; padding: 0 16px; }
}

@media (max-width: 680px) {
  .mode-picker { display: none !important; }
}

.chat-pro-context-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-2);
}

.chat-pro-context-card strong {
  display: block;
  color: var(--text-1);
  margin-bottom: 6px;
  font-size: 13px;
}

#chat-sidebar-pro .session-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

#chat-sidebar-pro .session-item.active,
#chat-sidebar-pro .session-item:hover {
  background: var(--s1);
  border-color: var(--border);
  color: var(--text-1);
}
