/* General layout */
body {
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #dff2d8, #f3f8ee);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.chat-container {
  width: 100%;
  max-width: 600px;
  background: #ffffffcc;
  backdrop-filter: blur(6px);
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Homepage */
.home {
  max-width: 560px;
  margin: 1rem;
  padding: 2.5rem 2rem;
  background: #ffffffcc;
  backdrop-filter: blur(6px);
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.home h1 {
  color: #2e7d32;
  font-size: 2.4rem;
  margin: 0 0 1.5rem;
}

.home .pitch {
  color: #1b3d1f;
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0;
}

.home .translation {
  color: #5f7a62;
  font-size: 1rem;
  font-style: italic;
  margin-top: 0.75rem;
}

.home .contact {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #c5e1a5;
}

.home .contact p {
  color: #5f7a62;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.home .contact a {
  display: inline-block;
  background: #2e7d32;
  color: white;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  overflow-wrap: anywhere;
  transition: background 0.3s;
}

.home .contact a:hover {
  background: #57a05d;
}

/* Header */
header {
  background: #2e7d32;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.4rem;
  margin: 0;
}

header button {
  background: #66bb6a;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s;
}

header button:hover {
  background: #57a05d;
}

/* Chat area */
.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
}

/* Messages */
.message {
  max-width: 80%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in;
}

.message.user {
  background: #e0f2f1;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.bot {
  background: #f1f8e9;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Sources below a reply */
.sources {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #c5e1a5;
  font-size: 0.85rem;
  white-space: normal;
}

.sources span {
  font-weight: 600;
  color: #2e7d32;
}

.sources ul {
  margin: 0.2rem 0 0;
  padding-left: 1.2rem;
}

.sources a {
  color: #2e7d32;
  overflow-wrap: anywhere;
}

/* Input form */
form {
  display: flex;
  border-top: 1px solid #dcdcdc;
  padding: 0.5rem;
}

form input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  outline: none;
}

form button {
  margin-left: 0.5rem;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s;
}

form button:hover {
  background: #3e8e41;
}

/* Loading animation (animated leaf) */
.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
}

.typing .leaf {
  width: 12px;
  height: 12px;
  background: #66bb6a;
  border-radius: 50% 50% 0 50%;
  transform: rotate(-45deg);
  animation: leafBounce 1s infinite ease-in-out;
}

.typing .leaf:nth-child(2) {
  animation-delay: 0.2s;
}

.typing .leaf:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes leafBounce {
  0%,
  80%,
  100% {
    transform: translateY(0) rotate(-45deg);
  }
  40% {
    transform: translateY(-8px) rotate(-45deg);
  }
}

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