/* ─── Layout ─────────────────────────────────────────────── */
:root {
  --brand-green:     #43b02a;
  --brand-green-mid: #d4f0cc;   /* light green tint for AI bubbles */
  --brand-purple-bg: #7b4fa6;   /* user icon background */
  --brand-purple-mid:#ece5f5;   /* light purple tint for user bubbles */
  --topbar-height:   90px;
  --input-bar-height: 70px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f0f0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Top Bar ─────────────────────────────────────────────── */
#topbar {
  background-color: var(--brand-green);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  position: relative;
}

#topbar .logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 3px;
}

#topbar .logo-placeholder img {
  height: 20px;
  width: auto;
  filter: brightness(0) invert(1);
}

#topbar .logo-placeholder .logo-text {
  font-size: 10px;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#topbar .title-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

#topbar .title-block .line1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

#topbar .title-block .line2 {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.92);
  line-height: 1.2;
}

#topbar .title-block .line3 {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
  line-height: 1.2;
}

/* balance the logo on the right so title stays truly centered */
#topbar .logo-spacer {
  width: 56px;
  flex-shrink: 0;
}

/* ─── Chat Window ─────────────────────────────────────────── */
#chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f0f0f0;
}

#chat-window::-webkit-scrollbar { width: 6px; }
#chat-window::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ─── Message Row ─────────────────────────────────────────── */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 80%;
}

.message-row.user-row {
  align-self: flex-start;
}

.message-row.ai-row {
  align-self: flex-start;
}

/* ─── Avatar Icons ────────────────────────────────────────── */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar.user-avatar {
  background-color: var(--brand-purple-bg);
}

.avatar.ai-avatar {
  background-color: var(--brand-green);
}

.avatar svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

/* ─── Bubbles ─────────────────────────────────────────────── */
.bubble {
  padding: 10px 15px;
  border-radius: 18px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  word-break: break-word;
  white-space: pre-wrap;
}

/* iMessage-style tail — both left-aligned, tail on bottom-left */
.user-row .bubble {
  background-color: var(--brand-purple-mid);
  color: #1a0033;
  border-bottom-left-radius: 4px;
}

.ai-row .bubble {
  background-color: var(--brand-green-mid);
  color: #0a2200;
  border-bottom-left-radius: 4px;
}

/* ─── Typing Indicator ────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa;
  display: inline-block;
  animation: bounce 1.2s infinite ease-in-out;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1.1); opacity: 1; }
}

/* ─── Input Bar ───────────────────────────────────────────── */
#input-bar {
  height: var(--input-bar-height);
  background: #fff;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
}

#input-bar #message-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  resize: none;
  line-height: 1.4;
  transition: border-color 0.2s;
}

#input-bar #message-input:focus {
  border-color: var(--brand-green);
}

#input-bar #send-btn {
  background-color: var(--brand-green);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#input-bar #send-btn:hover {
  background-color: #379422;
}

#input-bar #send-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* ─── Autofill Button ─────────────────────────────────────── */
#autofill-btn {
  background: transparent;
  border: 1px solid var(--brand-purple-bg);
  color: var(--brand-purple-bg);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  padding: 0;
}

#autofill-btn:hover {
  background: var(--brand-purple-bg);
  color: #fff;
}

#autofill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Signup / Construction Pages ────────────────────────── */

/* Override body for pages without the chat layout */
body.signup-page {
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.signup-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: #f0f0f0;
}

.signup-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  padding: 36px 32px;
  width: 100%;
  max-width: 520px;
}

.signup-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 22px;
  text-align: center;
}

.signup-input {
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.signup-input:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(67,176,42,0.15);
  outline: none;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

.signup-btn {
  background-color: var(--brand-green);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  padding: 11px;
  transition: background 0.2s;
}

.signup-btn:hover {
  background-color: #379422;
  color: #fff;
}

/* Under Construction */
.construction-icon {
  font-size: 56px;
  line-height: 1;
}

.construction-msg {
  font-size: 16px;
  color: #555;
  margin-top: 10px;
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .signup-card {
    padding: 24px 18px;
  }
}
