@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 40 20% 96%;
    --foreground: 0 0% 12%;
    --card: 40 15% 93%;
    --card-foreground: 0 0% 12%;
    --popover: 40 20% 96%;
    --popover-foreground: 0 0% 12%;
    --primary: 0 0% 12%;
    --primary-foreground: 40 20% 96%;
    --secondary: 40 10% 88%;
    --secondary-foreground: 0 0% 20%;
    --muted: 40 8% 90%;
    --muted-foreground: 0 0% 45%;
    --accent: 350 40% 52%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 35 12% 82%;
    --input: 35 12% 82%;
    --ring: 0 0% 12%;
    --radius: 0.25rem;

    --chat-bot: 40 12% 90%;
    --chat-user: 0 0% 15%;
    --chat-user-text: 40 20% 96%;

    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
}

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

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background-color: hsl(40, 20%, 96%);
  color: hsl(0, 0%, 12%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  height: 85vh;
}

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 2rem;
  color: hsl(0, 0%, 12%);
  position: relative;
  padding-bottom: 1rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background-color: hsl(0, 0%, 12%);
}

#chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 0;
  scrollbar-width: none;
}

#chat::-webkit-scrollbar {
  display: none;
}

/* Message bubbles — add these classes via JS */
#chat div {
  max-width: 82%;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.65;
  letter-spacing: 0.01em;
  animation: fadeSlideIn 0.35s ease-out both;
}

/* Bot messages (left) */
#chat .bot-message {
  align-self: flex-start;
  background-color: hsl(40, 12%, 90%);
  border: 1px solid hsl(35, 12%, 82%);
  border-radius: 0 12px 12px 12px;
  color: hsl(0, 0%, 20%);
}

/* User messages (right) */
#chat .user-message {
  align-self: flex-end;
  background-color: hsl(0, 0%, 15%);
  color: hsl(40, 20%, 96%);
  border-radius: 12px 0 12px 12px;
}

/* Fallback styling if no class is set */
#chat div:not(.bot-message):not(.user-message) {
  align-self: flex-start;
  background-color: hsl(40, 12%, 90%);
  border: 1px solid hsl(35, 12%, 82%);
  border-radius: 0 12px 12px 12px;
  color: hsl(0, 0%, 20%);
}

.input-row {
  display: flex;
  gap: 0;
  border-top: 1px solid hsl(35, 12%, 82%);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}

.input-row input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.88rem;
  background: transparent;
  border: 1px solid hsl(35, 12%, 82%);
  border-right: none;
  color: hsl(0, 0%, 12%);
  outline: none;
  transition: border-color 0.2s ease;
  letter-spacing: 0.02em;
}

.input-row input::placeholder {
  color: hsl(0, 0%, 55%);
  font-style: italic;
}

.input-row input:focus {
  border-color: hsl(0, 0%, 30%);
}

.input-row button {
  padding: 0.75rem 1.5rem;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background-color: hsl(0, 0%, 12%);
  color: hsl(40, 20%, 96%);
  border: 1px solid hsl(0, 0%, 12%);
  cursor: pointer;
  transition: all 0.25s ease;
}

.input-row button:hover {
  background-color: transparent;
  color: hsl(0, 0%, 12%);
}

.input-row button:active {
  transform: scale(0.97);
}

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

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.85rem 1.1rem !important;
  align-self: flex-start;
  background-color: hsl(40, 12%, 90%);
  border: 1px solid hsl(35, 12%, 82%);
  border-radius: 0 12px 12px 12px;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: hsl(0, 0%, 45%);
  animation: blink 1.4s infinite both;
}

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

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@media (max-width: 600px) {
  body {
    padding: 1rem;
  }
  .container {
    height: 92vh;
  }
  h1 {
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
  }
}


#root {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
  filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  a:nth-of-type(2) .logo {
    animation: logo-spin infinite 20s linear;
  }
}

.card {
  padding: 2em;
}

.read-the-docs {
  color: #888;
}

