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

:root {
  --bg: #0e0e11;
  --surface: #17171c;
  --border: #26262e;
  --accent: #7c6aff;
  --accent-dim: rgba(124,106,255,0.12);
  --accent-hover: #6a58ee;
  --text: #f0f0f5;
  --muted: #7a7a8c;
  --bubble-ai: #1e1e26;
  --bubble-user: #7c6aff;
  --danger: #e5484d;
  --success: #46a758;
  --font: 'Inter', system-ui, sans-serif;
  --radius: 18px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LANDING PAGE ─────────────────────────────────────────────────────────── */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-nav {
  padding: 20px 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: #fff;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.hero-section {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 40px;
}

.hero-text h1 {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.hero-text p {
  font-size: 17px;
  color: var(--muted);
  max-width: 420px;
  margin-bottom: 36px;
  line-height: 1.6;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
  margin-bottom: 12px;
}

.cta-btn:hover { opacity: 0.88; }

.small-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
}

/* Chat preview */
.hero-chat-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.chat-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.preview-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #fff;
}

.preview-name { font-weight: 600; font-size: 14px; }
.preview-status { font-size: 11px; color: var(--success); }

.chat-preview-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 85%;
}

.preview-bubble.ai {
  background: var(--bubble-ai);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.preview-bubble.user {
  background: var(--bubble-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Features */
.features-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.feature {
  background: var(--bg);
  padding: 36px 32px;
}

.feature-icon { font-size: 24px; margin-bottom: 12px; }
.feature h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.feature p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── APP PAGE ─────────────────────────────────────────────────────────────── */
.app-page {
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-avatar {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.app-name { font-weight: 700; font-size: 15px; }
.app-status { font-size: 12px; color: var(--success); }

.app-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-email { font-size: 12px; color: var(--muted); }

.logout-btn {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}

.logout-btn:hover { color: var(--text); border-color: var(--muted); }

/* Messages */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Welcome */
.welcome-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px 20px;
  gap: 12px;
}

.welcome-icon {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: #fff;
  margin-bottom: 8px;
}

.welcome-msg h2 { font-size: 22px; font-weight: 700; }
.welcome-msg p { font-size: 14px; color: var(--muted); max-width: 340px; }

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.chip {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font);
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Message rows */
.msg-row {
  display: flex;
  margin-bottom: 2px;
}

.msg-row.user { justify-content: flex-end; }
.msg-row.ai { justify-content: flex-start; }

.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

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

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

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

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

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

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Confirm bar */
.confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(229,72,77,0.08);
  border-top: 1px solid rgba(229,72,77,0.2);
  border-bottom: 1px solid rgba(229,72,77,0.2);
  flex-shrink: 0;
  gap: 12px;
}

.confirm-bar.hidden { display: none; }

.confirm-text {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.confirm-actions { display: flex; gap: 8px; flex-shrink: 0; }

.confirm-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity 0.15s;
}

.confirm-btn:hover { opacity: 0.85; }
.confirm-btn.yes { background: var(--danger); color: #fff; }
.confirm-btn.no { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* Input area */
.input-area {
  padding: 14px 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 10px 10px 16px;
  transition: border-color 0.15s;
}

.input-wrap:focus-within { border-color: var(--accent); }

textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

textarea::placeholder { color: var(--muted); }

.send-btn {
  width: 36px; height: 36px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}

.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-section {
    grid-template-columns: 1fr;
    padding: 40px 24px;
    gap: 40px;
  }

  .hero-text h1 { font-size: 36px; }
  .hero-chat-preview { display: none; }

  .features-section {
    grid-template-columns: 1fr 1fr;
  }

  .landing-nav { padding: 16px 24px; }
}
