/* app.css — app UI layer. Extends landing page design tokens.
   Design tokens are defined in the landing page CSS (public/css/).
   This file owns: nav, setup form, dashboard, chat interface. */

:root {
  --bg: #faf6f0;
  --bg-warm: #f3ede3;
  --fg: #1a1612;
  --fg-muted: #6b5e52;
  --accent: #0f6b5e;
  --accent-light: #e8f5f1;
  --accent-glow: #14917f;
  --sand: #d4c5a9;
  --sand-light: #ede6d8;
  --ocean: #1b4965;
  --coral: #e07a5f;
  --white: #ffffff;
  --radius: 12px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

/* ── Base ── */
.app-body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Shared buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-glow); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1.5px solid var(--sand);
}
.btn-ghost:hover { background: var(--bg-warm); }

/* ── Nav ── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 60px;
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sand-light);
}

.app-nav-brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-nav-link {
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.app-nav-link:hover { background: var(--bg-warm); color: var(--fg); }
.app-nav-link--active { color: var(--accent); background: var(--accent-light); }
.app-nav-link--cta {
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
}
.app-nav-link--cta:hover { background: var(--accent-glow); color: var(--white); }

/* ── Main content area ── */
.app-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ── Setup page ── */
.setup-page {}

.setup-header {
  margin-bottom: 40px;
}

.setup-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.setup-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--fg);
  margin-bottom: 10px;
}

.setup-sub {
  color: var(--fg-muted);
  font-size: 17px;
  max-width: 500px;
}

.setup-form {}

.form-section {
  background: var(--white);
  border: 1px solid var(--sand-light);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sand-light);
}

.form-row { display: flex; gap: 16px; }
.form-row--2 > .form-group { flex: 1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--sand);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--sand); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 8px;
}

.save-status { font-size: 14px; font-weight: 500; }
.save-status--ok { color: var(--accent); }
.save-status--err { color: var(--coral); }

/* ── Dashboard ── */
.dashboard-page {}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.dashboard-header h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 4px;
}

.dashboard-address {
  color: var(--fg-muted);
  font-size: 14px;
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

@media (max-width: 640px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--sand-light);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-card-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}

/* Conversations section */
.conversations-section {}

.conversations-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--fg);
}

.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversation-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--sand-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.conversation-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(15, 107, 94, 0.08);
  transform: translateY(-1px);
}

.conversation-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.conversation-guest {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guest-name {
  font-weight: 600;
  font-size: 15px;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--fg-muted);
}

.message-count {
  background: var(--bg-warm);
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 500;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--white);
  border: 1px dashed var(--sand);
  border-radius: var(--radius);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--fg-muted);
  margin-bottom: 24px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Chat interface ── */
.chat-page {
  max-width: 680px;
  margin: 0 auto;
}

.chat-start {
  text-align: center;
  padding: 60px 24px;
}

.chat-start-icon { font-size: 56px; margin-bottom: 20px; }

.chat-start h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 12px;
}

.chat-start p {
  color: var(--fg-muted);
  font-size: 16px;
  max-width: 440px;
  margin: 0 auto 32px;
}

.chat-start-form {
  display: flex;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}

.chat-start-form input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--sand);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg);
  background: var(--white);
  transition: border-color 0.15s;
}
.chat-start-form input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Chat container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 500px;
  background: var(--white);
  border: 1px solid var(--sand-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sand-light);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-guest-name { font-weight: 700; font-size: 16px; }
.chat-property-name { font-size: 13px; color: var(--fg-muted); }

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

.message {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.message--guest { align-items: flex-end; }
.message--ai { align-items: flex-start; }

.message-bubble {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.message--guest .message-bubble {
  background: var(--accent);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message--ai .message-bubble {
  background: var(--bg-warm);
  color: var(--fg);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--sand-light);
}

.message-time {
  font-size: 11px;
  color: var(--fg-muted);
  padding: 0 4px;
}

/* Typing indicator */
.message-bubble--thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.message-bubble--thinking span {
  width: 7px;
  height: 7px;
  background: var(--sand);
  border-radius: 50%;
  animation: thinking 1.2s infinite;
}
.message-bubble--thinking span:nth-child(2) { animation-delay: 0.2s; }
.message-bubble--thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

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

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--sand);
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg);
  background: var(--white);
  resize: none;
  min-height: 42px;
  max-height: 140px;
  transition: border-color 0.15s;
  line-height: 1.4;
}
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.suggestion-chip {
  padding: 6px 14px;
  background: var(--bg-warm);
  border: 1px solid var(--sand-light);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.suggestion-chip:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Conversation detail page ── */
.conversation-page {}

.conversation-page-header {
  margin-bottom: 28px;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.conversation-page-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.conversation-page-guest {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.conversation-page-date {
  font-size: 13px;
  color: var(--fg-muted);
}

.conversation-transcript {
  background: var(--white);
  border: 1px solid var(--sand-light);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  max-height: 600px;
  overflow-y: auto;
}

.conversation-page-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.conversation-stats {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .app-nav { padding: 0 16px; }
  .app-main { padding: 28px 16px 60px; }
  .form-row--2 { flex-direction: column; }
  .form-section { padding: 20px 16px; }
  .dashboard-header { flex-direction: column; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .chat-start-form { flex-direction: column; }
  .app-nav-links .app-nav-link:not(.app-nav-link--cta) { display: none; }
}
