/* ============================================================
   Personality-First Positioning Auditor — design system
   ============================================================ */

:root,
:root[data-theme="dark"] {
  --bg:            #1a1a1a;
  --surface:       #242424;
  --surface-2:     #2a2a2a;
  --border:        #333333;
  --border-light:  #3a3a3a;
  --text:          #ECECEC;
  --text-mid:      #9A9A9A;
  --text-dim:      #555555;
  --primary:       #D4782A;
  --primary-hover: #C06820;
  --primary-soft:  rgba(212, 120, 42, 0.18);
  --primary-tint:  rgba(212, 120, 42, 0.12);
  --white:         #FFFFFF;
  --font:          'Manrope', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm:     7px;
  --radius:        9px;
  --radius-lg:     14px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:            #FAFAFA;
  --surface:       #FFFFFF;
  --surface-2:     #F2F2F2;
  --border:        #E4E4E4;
  --border-light:  #DADADA;
  --text:          #1A1A1A;
  --text-mid:      #666666;
  --text-dim:      #A0A0A0;
  --primary:       #D4782A;
  --primary-hover: #B85F18;
  --primary-soft:  rgba(212, 120, 42, 0.22);
  --primary-tint:  rgba(212, 120, 42, 0.10);
  --white:         #FFFFFF;
  color-scheme: light;
}

html, body { background: var(--bg); color: var(--text); }

/* Base ---------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

button { font-family: inherit; cursor: pointer; }

/* Scrollbars --------------------------------------------- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

textarea::placeholder, input::placeholder { color: var(--text-dim); }

/* Animations --------------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1; }
}

.fade-up { animation: fadeUp 0.25s ease-out both; }
.fade-in { animation: fadeIn 0.25s ease-out both; }

/* ============================================================
   Logo mark
   ============================================================ */
.gp-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.gp-logo svg { display: block; }

/* ============================================================
   Auth screens (login / signup / forgot / reset)
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  animation: fadeUp 0.3s ease-out both;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  text-align: center;
}
.auth-brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-brand-tag {
  font-size: 13px;
  color: var(--text-mid);
}
.auth-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-mid);
}
.auth-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}
.auth-link-btn:hover { color: var(--primary-hover); }

.auth-footnote {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-mid);
}

.auth-error {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.5);
  color: #f4a39a;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.auth-success {
  background: var(--primary-tint);
  border: 1px solid rgba(212, 120, 42, 0.5);
  color: var(--primary);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}

/* Inputs -------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.01em;
}
.field-input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Buttons ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius);
  padding: 11px 18px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.05s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid transparent;
  padding: 7px 12px;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-block { width: 100%; }

/* Theme toggle (icon button) ---------------------------- */
.theme-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.theme-toggle:hover { background: var(--surface); color: var(--text); }
.theme-toggle svg { display: block; }

/* ============================================================
   App shell — sidebar + chat side-by-side
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* ============================================================
   Sidebar (conversation history, per user)
   ============================================================ */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width 0.2s ease, border-color 0.2s ease;
}
.sidebar.collapsed {
  width: 0;
  border-right-color: transparent;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-new {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sidebar-new:hover { background: var(--primary-hover); }
.sidebar-new svg { display: block; }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 14px;
}
.sidebar-empty {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
  padding: 18px 8px;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-mid);
  transition: background 0.1s ease, color 0.1s ease;
  user-select: none;
}
.convo-item:hover { background: var(--surface-2); color: var(--text); }
.convo-item.active {
  background: var(--primary-tint);
  color: var(--text);
}
.convo-title {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.convo-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.convo-item:hover .convo-actions,
.convo-item.active .convo-actions { opacity: 1; }
.convo-action {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.convo-action:hover { background: var(--surface); color: var(--text); }
.convo-action.convo-delete:hover { color: #C0392B; }
.convo-action svg { display: block; }

.convo-rename-input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 3px 6px;
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-soft);
  min-width: 0;
}
.convo-item.renaming { cursor: text; background: var(--surface-2); }

/* Sidebar toggle (icon button in chat header) */
.sidebar-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  margin-right: 4px;
}
.sidebar-toggle:hover { background: var(--surface); color: var(--text); }
.sidebar-toggle svg { display: block; }

/* ============================================================
   Chat screen
   ============================================================ */
.chat-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

.chat-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.chat-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.verify-banner {
  position: relative;
  background: var(--primary-tint);
  border-bottom: 1px solid rgba(212, 120, 42, 0.4);
  color: var(--primary);
  padding: 8px 44px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  flex-shrink: 0;
}
.verify-banner-text { display: inline; }
.verify-banner button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.verify-banner-close {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.12s ease;
}
.verify-banner-close:hover { background: var(--primary-soft); }

/* Messages area ----------------------------------------- */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 16px;
}
.chat-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.msg-row {
  display: flex;
  width: 100%;
  animation: fadeUp 0.25s ease-out both;
}
.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; align-items: flex-start; gap: 12px; }

.msg-assistant-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-bubble-user {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  max-width: 70%;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-assistant-text {
  flex: 1;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  padding-top: 1px;
}
.msg-assistant-text strong { color: var(--text); font-weight: 700; }
.msg-assistant-text em { color: var(--text); }
.msg-assistant-text code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg-assistant-text pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
}
.msg-assistant-text pre code { background: none; padding: 0; }
.msg-assistant-text a { color: var(--primary); text-decoration: underline; }
.msg-assistant-text ul, .msg-assistant-text ol { padding-left: 22px; margin: 6px 0; }
.msg-assistant-text li { margin: 3px 0; }
.msg-assistant-text h1, .msg-assistant-text h2, .msg-assistant-text h3 {
  margin: 10px 0 6px; font-weight: 700;
}
.msg-assistant-text h1 { font-size: 18px; }
.msg-assistant-text h2 { font-size: 16px; }
.msg-assistant-text h3 { font-size: 15px; }
.msg-assistant-text hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Typing indicator (three dots) ------------------------- */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-mid);
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Input bar --------------------------------------------- */
.input-wrap {
  flex-shrink: 0;
  padding: 12px 20px 14px;
  background: var(--bg);
}
.input-inner {
  max-width: 720px;
  margin: 0 auto;
}
.input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-box.focused {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  max-height: 200px;
  min-height: 22px;
  padding: 4px 0;
}
.send-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--white);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.send-btn:hover:not(:disabled) { background: var(--primary-hover); }
.send-btn:disabled {
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: not-allowed;
}
.input-hint {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: right;
}

/* Upsell strip (pinned) --------------------------------- */
.upsell-strip {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-mid);
}
.upsell-strip a {
  color: var(--primary);
  font-weight: 600;
  margin-left: 6px;
}
.upsell-strip a:hover { color: var(--primary-hover); }

/* Loading screen --------------------------------------- */
.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  font-size: 14px;
}
