/* ── Chat Page ── */
.chat-page {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: calc(100vh - 73px);
  padding: 0;
}

.chat-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 73px);
}

/* Header bar */
.chat-header-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-dot.idle {
  animation: none;
  background: var(--text-muted);
}

.status-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Messages */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}

.messages-area::-webkit-scrollbar {
  width: 6px;
}
.messages-area::-webkit-scrollbar-track {
  background: transparent;
}
.messages-area::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 3px;
}

.message {
  max-width: 85%;
  animation: fadeUp 0.3s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-control {
  align-self: flex-start;
}

.message-user {
  align-self: flex-end;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
}

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

.message-user .message-bubble {
  background: var(--accent-dim);
  border: 1px solid rgba(232, 160, 64, 0.15);
  border-bottom-right-radius: 4px;
  color: var(--accent);
  font-weight: 500;
}

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

.message-control .message-time { text-align: left; }
.message-user .message-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 6px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 85%;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* Input area */
.input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-input-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

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

.chat-input:focus {
  border-color: rgba(232, 160, 64, 0.4);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.send-btn:hover { opacity: 0.85; }
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.new-checkin-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  align-self: center;
}

.new-checkin-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tone selector */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tone-selector {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tone-btn {
  padding: 6px 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
}

.tone-btn:last-child { border-right: none; }

.tone-btn:hover { color: var(--text); }

.tone-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-state h2 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 360px;
}

/* Responsive */
@media (max-width: 600px) {
  .chat-container { max-width: 100%; }
  .messages-area { padding: 16px; }
  .input-area { padding: 12px 16px 20px; }
  .message { max-width: 90%; }
  .tone-btn { padding: 5px 10px; font-size: 12px; }
}
