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

/* ---- Base ---- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  background-attachment: fixed;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-name {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}

.header-title {
  font-size: 12px;
  color: #64748b;
}

.header-links {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}

.header-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}

.header-links a:hover {
  color: #f1f5f9;
}

/* ---- Main ---- */
main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---- Intro ---- */
.intro p {
  font-size: 15px;
  line-height: 1.7;
  color: #94a3b8;
}

/* ---- Chat Section ---- */
.chat-section {
  flex: 1;
}

.chat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat card header bar */
.chat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.powered-by {
  font-size: 11px;
  color: #475569;
  letter-spacing: 0.3px;
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  max-height: calc(100vh - 380px);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Message rows */
.message {
  display: flex;
  max-width: 82%;
}

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

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

/* Bubbles */
.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.message.assistant .bubble {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
  color: #e2e8f0;
}

.message.user .bubble {
  background: #3b82f6;
  border-bottom-right-radius: 4px;
  color: #fff;
}

/* Loading dots */
.bubble.loading {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.bubble.loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  animation: bounce 1.2s infinite ease-in-out;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* Suggested questions */
.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 16px;
}

.sq-btn {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.sq-btn:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.5);
  color: #bfdbfe;
}

/* Input area */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

#chatInput {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  overflow-y: hidden;
}

#chatInput::placeholder {
  color: #475569;
}

#chatInput:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

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

.send-btn:hover {
  background: #2563eb;
}

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

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #334155;
}

footer a {
  color: #475569;
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: #94a3b8;
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
  .header-title {
    display: none;
  }

  .header-links {
    gap: 14px;
  }

  main {
    padding: 24px 14px 24px;
    gap: 20px;
  }

  .chat-messages {
    max-height: calc(100vh - 340px);
    min-height: 240px;
  }

  .message {
    max-width: 92%;
  }

  .suggested-questions {
    gap: 6px;
  }
}
