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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #faf9f7;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: #2c2c2c;
}

.header {
  background: #faf9f7;
  color: #2c2c2c;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e8e6e3;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}

.profile-container {
  position: relative;
  display: inline-block;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8e6e3 0%, #d4d0c8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.profile-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-dot {
  position: absolute;
  top: 2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid #faf9f7;
}

.lang-dropdown {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lang-dropdown select {
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #2c2c2c;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232c2c2c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.lang-dropdown select:hover {
  border-color: #c4c0ba;
}

.lang-dropdown select:focus {
  border-color: #2c2c2c;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 80%;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messageIn 0.3s ease-out;
  transform-origin: bottom left;
}

.message.user {
  background: #213013;
  color: #faf9f7;
  align-self: flex-end;
  border-radius: 20px 20px 4px 20px;
  transform-origin: bottom right;
}

.message.assistant {
  background: #F4F3ED;
  color: #2c2c2c;
  align-self: flex-start;
  border-radius: 20px 20px 20px 4px;
}

.message.typing {
  color: #8a8680;
}

.message.system {
  background: #BFE4ED;
  color: #2c2c2c;
  align-self: center;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  max-width: none;
}

.message a {
  color: #5a7a5a;
  text-decoration: underline;
}

.message a:hover {
  color: #3d5a3d;
}

.message .inline-image {
  display: block;
  max-width: 200px;
  max-height: 200px;
  border-radius: 12px;
  margin: 8px 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.message .inline-image:hover {
  transform: scale(1.05);
}

@keyframes messageIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #8a8680;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

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

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

.input-container {
  padding: 16px;
  background: #faf9f7;
  border-top: 1px solid #e8e6e3;
  display: flex;
  gap: 12px;
}

.input-container input {
  flex: 1;
  padding: 14px 20px;
  border: 1px solid #e8e6e3;
  border-radius: 28px;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}

.input-container input:focus {
  border-color: #c4c0ba;
}

.input-container input::placeholder {
  color: #b5b0a8;
}

.input-container button {
  background: #213013;
  color: #faf9f7;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.input-container button:hover {
  background: #2a3f1a;
}

.input-container button:disabled {
  background: #c4c0ba;
  cursor: not-allowed;
}

.input-container button svg {
  width: 18px;
  height: 18px;
}

.input-container .upload-btn {
  background: transparent;
  border: 1px solid #e8e6e3;
  color: #8a8680;
}

.input-container .upload-btn:hover {
  background: #f0eeeb;
  border-color: #c4c0ba;
  color: #2c2c2c;
}

.message img {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 8px;
}

.message.user img {
  margin-top: 0;
}

.image-preview {
  position: relative;
  display: inline-block;
}

.image-preview img {
  max-height: 150px;
  border-radius: 12px;
}

#imagePreviewContainer {
  padding: 8px 16px;
  background: #faf9f7;
  display: none;
}

#imagePreviewContainer.active {
  display: block;
}

.remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #2c2c2c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* Language Selection Screen */
.language-select-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #faf9f7;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lang-select-content {
  text-align: center;
  padding: 24px;
  max-width: 400px;
  width: 100%;
}

.welcome-avatar {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.welcome-avatar .profile-pic {
  width: 64px;
  height: 64px;
}

.welcome-avatar .online-dot {
  top: 4px;
  right: 0;
  width: 14px;
  height: 14px;
  border-width: 3px;
}

.lang-prompt {
  font-size: 14px;
  color: #8a8680;
  margin-bottom: 16px;
}

.lang-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e8e6e3;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.lang-btn:hover {
  background: #f5f4f0;
  border-color: #d4d0c8;
  transform: translateY(-2px);
}

.lang-btn:active {
  transform: translateY(0);
}

.lang-btn .flag {
  font-size: 24px;
  line-height: 1;
}

.lang-btn .lang-name {
  font-size: 15px;
  font-weight: 500;
  color: #2c2c2c;
}

/* Chat wrapper */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
