/* Import theme system */
@import url('theme.css');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

:root {
  --primary-green: #2e7d32;
  --light-green: #4caf50;
  --dark-green: #2e7d32;
  --accent-green: #4caf50;
  --bg-primary: #f0f4f7;
  --bg-secondary: #ffffff;
  --text-primary: #333;
  --text-secondary: #616161;
  --border-light: #e0e0e0;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body {
  background-color: var(--bg-secondary, #f0f4f7);
  color: var(--text-primary, #333);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
}

header {
  background: linear-gradient(to right, #2e7d32, #4caf50);
  color: white;
  padding: 1.5rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo i {
  font-size: 2rem;
  color: white;
  animation: gentle-bounce 3s ease-in-out infinite;
}

@keyframes gentle-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: white;
}

.nav-back {
  color: white;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-back:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

#chat-container {
  background-color: var(--bg-primary, #fff);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  overflow: hidden;
  position: relative;
}

.chat-header {
  padding: 1.2rem;
  background-color: var(--bg-secondary, #e8f5e9);
  border-bottom: 1px solid #c8e6c9;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.chat-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary-green),
    var(--light-green),
    var(--primary-green)
  );
}

.chat-header i {
  color: #4caf50;
  font-size: 1.4rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.chat-header h2 {
  font-size: 1.3rem;
  color: #2e7d32;
  font-weight: 600;
}

#chat-window {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background-color: var(--bg-secondary, #fafafa);
  position: relative;
}

#chat-window::-webkit-scrollbar {
  width: 6px;
}

#chat-window::-webkit-scrollbar-track {
  background: transparent;
}

#chat-window::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

#chat-window::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.message {
  max-width: 80%;
  padding: 1rem 1.2rem;
  border-radius: 18px;
  line-height: 1.5;
  position: relative;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user {
  background: linear-gradient(to right, #4caf50, #2e7d32);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bot {
  background-color: var(--bg-primary, white);
  border: 1px solid #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  color: var(--text-primary, #333);
}

.bot::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid white;
}

.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.user .message-header {
  color: rgba(255, 255, 255, 0.9);
}

.bot .message-header {
  color: #4caf50;
}

.message-header i {
  margin-right: 10px;
  font-size: 1.1rem;
}

.timestamp {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 6px;
  text-align: right;
}

#chat-form {
  display: flex;
  padding: 1.2rem;
  background-color: var(--bg-primary, white);
  border-top: 1px solid #eeeeee;
}

.input-container {
  display: flex;
  flex: 1;
  background: #f5f5f5;
  border-radius: 30px;
  padding: 0 15px;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 0.9rem 0.5rem;
  font-size: 1rem;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
}

#chat-input::placeholder {
  color: var(--text-secondary);
}

#send-button {
  background: linear-gradient(to right, #4caf50, #2e7d32);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 0.9rem 1.8rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

#send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#send-button:active {
  transform: translateY(0);
}

#send-button:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: white;
  border-radius: 18px;
  align-self: flex-start;
  border: 1px solid #e0e0e0;
  margin-top: 8px;
  gap: 6px;
}

.typing-indicator div {
  color: #4caf50;
  font-weight: 500;
  font-size: 0.9rem;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: #9e9e9e;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

.typing-indicator span:nth-child(4) {
  animation-delay: 0.6s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

.welcome-message {
  text-align: center;
  padding: 2rem;
  color: #616161;
}

.welcome-message h3 {
  color: #4caf50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.welcome-message h3 i {
  animation: gentle-bounce 3s ease-in-out infinite;
}

.welcome-message p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
  opacity: 0.8;
  color: var(--primary-green);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.welcome-message h3 i {
  color: var(--accent-green);
  animation: gentle-bounce 3s ease-in-out infinite;
}

.welcome-message p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
  opacity: 0.8;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1.5rem;
}

.suggestion {
  background-color: #e8f5e9;
  color: #2e7d32;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #c8e6c9;
}

.suggestion:hover {
  background-color: #c8e6c9;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
    padding: 0 1rem;
  }

  .logo h1 {
    font-size: 1.6rem;
  }

  main {
    padding: 1rem;
  }

  #chat-container {
    height: calc(100vh - 160px);
    border-radius: 16px;
  }

  .chat-header {
    padding: 1.2rem 1rem;
  }

  .chat-header h2 {
    font-size: 1.1rem;
  }

  #chat-window {
    padding: 1rem;
  }

  .message {
    max-width: 90%;
    padding: 1rem;
  }

  #chat-form {
    padding: 1rem;
    gap: 8px;
  }

  .input-container {
    padding: 0 15px;
  }

  #send-button {
    padding: 0.8rem 1.2rem;
    min-width: 80px;
  }

  .suggestions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .suggestion {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }

  .welcome-message {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .logo i {
    font-size: 1.8rem;
  }

  .logo h1 {
    font-size: 1.4rem;
  }

  .nav-back {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  #chat-form {
    flex-direction: row;
    gap: 8px;
  }

  #send-button {
    align-self: flex-end;
    width: auto;
  }
}

.message-text {
  animation: fadeInText 0.5s ease 0.2s both;
}

@keyframes fadeInText {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.suggestion:focus,
#chat-input:focus,
#send-button:focus,
.nav-back:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
  border-radius: 30px;
}
