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

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f5f5f5;
  min-height: 100vh;
}

/* Chat layout: full height, flex column */
.chat-layout {
  display: flex;
  flex-direction: column;
  max-width: 36rem;
  margin: 0 auto;
  height: 100vh;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.chat-header {
  flex-shrink: 0;
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.chat-header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.chat-header .tagline {
  margin: 0 0 0.5rem;
  color: #555;
  font-size: 0.875rem;
}

.clear-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: #666;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.clear-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* Scrollable message area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.empty-hint {
  margin: 0;
  color: #888;
  font-size: 0.95rem;
}

/* Message bubbles */
.message {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  word-wrap: break-word;
}

.message__content {
  white-space: pre-wrap;
}

.message--user {
  align-self: flex-end;
  margin-left: auto;
  background: #0a7ea4;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message--assistant {
  align-self: flex-start;
  background: #e8e8e8;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.message--assistant.message--error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #b71c1c;
}

.message--thinking {
  font-style: italic;
  color: #666;
}

/* Input bar at bottom */
.chat-input-bar {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #eee;
  background: #fff;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.chat-input-bar input:focus {
  outline: none;
  border-color: #0a7ea4;
  box-shadow: 0 0 0 2px rgba(10, 126, 164, 0.2);
}

.chat-input-bar button {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: #0a7ea4;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.chat-input-bar button:hover:not(:disabled) {
  background: #086a8a;
}

.chat-input-bar button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (min-width: 480px) {
  .chat-header {
    padding: 1.25rem 1.25rem 0.75rem;
  }

  .chat-header h1 {
    font-size: 1.5rem;
  }

  .chat-messages {
    padding: 1.25rem;
  }

  .chat-input-bar {
    padding: 1rem 1.25rem;
  }
}
