:root {
  --navy: #1B1D37;
  --navy-light: #25284a;
  --navy-lighter: #2f3358;
  --orange: #FF3300;
  --orange-soft: #ff5630;
  --text: #e8e9f0;
  --text-dim: #9a9cb5;
  --border: rgba(255, 255, 255, 0.08);
  --bubble-me: #FF3300;
  --bubble-them: #2f3358;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--navy);
  color: var(--text);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
}

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

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

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 12px rgba(255, 51, 0, 0.6);
}

.logo-text {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--navy-light);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  transition: background 0.3s;
}

.status-dot.online {
  background: #00d97e;
  box-shadow: 0 0 8px rgba(0, 217, 126, 0.6);
}

/* Chat body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-body::-webkit-scrollbar {
  width: 8px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: var(--navy-lighter);
  border-radius: 4px;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* Message bubbles */
.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: pop 0.18s ease-out;
}

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

.msg.them {
  align-self: flex-start;
  background: var(--bubble-them);
  border-bottom-left-radius: 4px;
}

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

.msg-time {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.6;
}

/* Footer */
.chat-footer {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  background: var(--navy);
  border-top: 1px solid var(--border);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.2s;
}

.input-row:focus-within {
  border-color: var(--orange);
}

#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
}

#messageInput::placeholder {
  color: var(--text-dim);
}

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

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.footer-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  min-height: 14px;
  text-align: center;
}

.footer-hint.error {
  color: var(--orange-soft);
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
