@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #000;
  --surface: #0f0f0f;
  --surface-2: #1a1a1a;
  --border: rgba(255,255,255,0.1);
  --text: #f5f5f5;
  --text-muted: rgba(255,255,255,0.45);
  --accent: #ffffff;
  --radius: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Count ── */
#count {
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
  margin-top: 12px;
  letter-spacing: 0.04em;
}

/* ── Logo ── */
img {
  display: block;
  margin: 40px auto 0;
  width: 90px;
  height: auto;
  opacity: 0.9;
}

/* ── Nav ── */
.nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 28px auto 0;
  flex-wrap: wrap;
  padding: 0 16px;
}

.nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.nav a:hover {
  color: var(--accent);
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.05);
  font-size: 13px;
}

/* ── ChatBot wrapper ── */
.chatBot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 40px auto;
  overflow: hidden;
  width: 500px;
  height: 600px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* ── Header ── */
header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 16px 20px;
  position: relative;
  flex-shrink: 0;
}

header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── Close button ── */
#cross {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  transition: color var(--transition);
}

#cross:hover {
  color: var(--accent);
}

/* ── Chatbox ── */
.chatbox {
  padding: 20px 16px;
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}

.chatbox::-webkit-scrollbar {
  width: 4px;
}

.chatbox::-webkit-scrollbar-track {
  background: transparent;
}

.chatbox::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 999px;
}

/* ── Messages ── */
.chat {
  display: flex;
  animation: fadeSlideIn 0.25s ease both;
}

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

.chat p {
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 75%;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-outgoing {
  justify-content: flex-end;
}

.chat-outgoing p {
  background: var(--accent);
  color: #000;
  font-weight: 500;
  border-radius: 8px 8px 2px 8px;
}

.chat-incoming p {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px 8px 8px 2px;
}

.chatbox .chat p.error {
  background: rgba(255, 55, 55, 0.15);
  border: 1px solid rgba(255, 55, 55, 0.3);
  color: #ff6b6b;
}

/* ── Input area ── */
.chat-input {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
  outline: none;
  overflow-y: auto;
  background: var(--surface-2);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  height: 64px;
  transition: border-color var(--transition);
  line-height: 1.5;
}

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

.chat-input textarea:focus {
  border-color: rgba(255,255,255,0.35);
}

#sendBTN {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

#sendBTN:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

#sendBTN:active {
  transform: translateY(0);
}

/* ── Last message ── */
.lastMessage {
  margin-top: 24px;
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  text-align: center;
  opacity: 0.7;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .chatBot {
    width: calc(100% - 32px);
    height: calc(100vh - 220px);
    margin: 24px 16px;
  }

  .chatbox {
    padding: 16px 12px;
  }

  .chat-input {
    padding: 12px;
  }

  .chat-input textarea {
    height: 56px;
  }

  .nav {
    gap: 8px;
  }

  img {
    width: 70px;
  }

  .lastMessage {
    font-size: 20px;
    margin-left: 0;
  }
}

@media (min-width: 600px) {
  .nav {
    gap: 12px;
  }

  .nav a {
    font-size: 14px;
  }
}
