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

:root {
  --whatsapp-green: #25D366;
  --whatsapp-teal: #075E54;
  --whatsapp-light-green: #DCF8C6;
  --whatsapp-gray: #E5DDD5;
  --whatsapp-dark: #128C7E;
  --bg-color: #ECE5DD;
  --header-bg: #075E54;
  --input-bg: #F0F0F0;
  --message-bg: #FFFFFF;
  --my-message-bg: #DCF8C6;
  --text-color: #303030;
  --text-secondary: #667781;
  --border-color: #D1D7DB;
}

html {
  height: 100%;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.whatsapp-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--bg-color);
}

.chat-header {
  background-color: var(--header-bg);
  color: white;
  padding: 10px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-info h1 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
}

.status {
  font-size: 13px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #25D366;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: #E5DDD5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.welcome-message {
  margin: 50px auto;
  text-align: center;
  max-width: 350px;
  background: rgba(255, 255, 255, 0.9);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.welcome-message h3 {
  color: var(--text-color);
  margin-bottom: 10px;
  font-size: 18px;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.small-text {
  font-size: 12px !important;
  opacity: 0.8;
}

.message-bubble {
  max-width: 65%;
  padding: 8px 12px;
  border-radius: 8px;
  position: relative;
  word-wrap: break-word;
  animation: messageSlideIn 0.2s ease-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-bubble.received {
  background-color: var(--message-bg);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.message-bubble.sent {
  background-color: var(--my-message-bg);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.message-content {
  color: var(--text-color);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.copy-btn-small {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.copy-btn-small:hover {
  opacity: 1;
}

.file-message {
  background-color: var(--message-bg);
  padding: 0;
  overflow: hidden;
}

.file-message.sent {
  background-color: var(--my-message-bg);
}

.image-content {
  max-width: 300px;
  width: 100%;
}

.image-content img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px 8px 0 0;
}

.file-info-box {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: inherit;
}

.file-icon-box {
  width: 48px;
  height: 48px;
  background: var(--whatsapp-teal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
  flex-shrink: 0;
}

.file-details-box {
  flex: 1;
  min-width: 0;
}

.file-name-text {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  justify-content: flex-end;
}

.action-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  color: var(--whatsapp-teal);
  font-weight: 500;
  transition: all 0.2s;
}

.action-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.input-area {
  background-color: #F0F0F0;
  padding: 8px 16px;
  border-top: 1px solid #D1D7DB;
  flex-shrink: 0;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: white;
  border-radius: 24px;
  padding: 8px 12px;
}

.attach-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  flex-shrink: 0;
}

.attach-btn:hover {
  color: var(--text-color);
}

.text-input-wrapper {
  flex: 1;
  max-height: 150px;
  overflow-y: auto;
}

#messageInput {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 20px;
  max-height: 100px;
  background: transparent;
  color: var(--text-color);
  padding: 4px 0;
}

.send-btn {
  background: none;
  border: none;
  color: var(--whatsapp-dark);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.1);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.messages-area::-webkit-scrollbar {
  width: 6px;
}

.messages-area::-webkit-scrollbar-track {
  background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

body.drag-over .messages-area {
  background-color: rgba(37, 211, 102, 0.1);
  border: 3px dashed var(--whatsapp-green);
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 1000;
  animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 768px) {
  body {
    height: 100dvh;
    position: fixed;
    width: 100%;
  }

  .whatsapp-container {
    height: 100dvh;
  }

  .message-bubble {
    max-width: 80%;
  }

  .image-content {
    max-width: 250px;
  }

  .input-area {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  #messageInput {
    font-size: 16px;
  }
}