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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #e5ddd5;
  height: 100vh;
  overflow: hidden;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  background-color: #e5ddd5;
  position: relative;
}

/* Updated background image styling for better visibility */
.chat-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  /* Increased opacity for better visibility */
  opacity: 1;
}

/* Header */
.chat-header {
  background-color: #075e54;
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  z-index: 10;
  /* Added relative positioning to stay above background */
  position: relative;
}

.back-button {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: white;
}

.back-button svg {
  display: block;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  overflow: hidden;
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.header-info {
  flex: 1;
  min-width: 0;
  /* Removed overflow hidden to show verification badge */
}

/* Fixed verified badge to be inline with name */
.contact-name {
  font-size: 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
  /* Prevent text wrapping to keep name and badge on one line */
  white-space: nowrap;
  max-width: 100%;
}

.verified-badge {
  display: inline-flex;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  /* Ensure badge stays inline and doesn't wrap */
  vertical-align: middle;
  /* Image-specific properties for crisp rendering */
  object-fit: contain;
}

/* Fixed container for phone number and typing status toggle */
.contact-subtitle {
  position: relative;
  height: 18px;
  overflow: hidden;
  margin-top: 2px;
}

.contact-number {
  font-size: 13px;
  opacity: 0.8;
  /* Prevent phone number from being clickable on iOS */
  pointer-events: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.2s ease;
}

.contact-number.hidden {
  opacity: 0;
  visibility: hidden;
}

.typing-status {
  font-size: 13px;
  color: #d9fdd3;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.typing-status.active {
  opacity: 1;
  visibility: visible;
}

.header-icons {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-icons svg {
  cursor: pointer;
  color: white;
  display: block;
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 120px 16px; /* Increased bottom padding to 120px */
  /* Removed background-image CSS, using img element instead */
  background-color: transparent;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  scroll-behavior: smooth; /* Added smooth scrolling behavior */
  -webkit-overflow-scrolling: touch;
}

/* Added preview content section styles */
.preview-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeIn 0.5s ease;
}

.preview-content.hidden {
  display: none;
}

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

/* Info Banners - Changed to transparent background with icons inline */
.info-banner {
  background-color: transparent;
  color: #54656f;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
}

.banner-icon {
  flex-shrink: 0;
  color: #f39c12;
  font-size: 16px;
  margin-top: 1px;
}

.ad-banner .banner-icon {
  color: #667781;
}

.banner-text {
  flex: 1;
  color: #54656f;
  text-align: center;
}

.banner-highlight {
  color: #f39c12;
  font-weight: 500;
}

.banner-link {
  color: #0088cc;
  text-decoration: none;
  font-weight: 500;
}

.banner-link:hover {
  text-decoration: underline;
}

/* Business Profile Card - Changed to transparent background */
.business-profile {
  background-color: transparent;
  padding: 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.business-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: bold;
  color: white;
  margin-bottom: 8px;
  overflow: hidden;
}

.business-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.business-name {
  font-size: 18px;
  font-weight: 600;
  color: #111;
  text-align: center;
}

.business-info {
  font-size: 13px;
  color: #667781;
  text-align: center;
}

.business-followers {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #667781;
  margin-top: 4px;
}

.business-followers svg {
  color: #667781;
}

/* Updated initial message with transparent background */
.initial-message {
  text-align: center;
  color: #667781;
  padding: 30px 20px;
  position: absolute;
  /* Moved initial message down to avoid blocking preview content */
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  max-width: 320px;
  transition: all 0.3s ease;
  background-color: transparent;
  border-radius: 16px;
  z-index: 5;
}

.initial-message.hidden {
  opacity: 0;
  pointer-events: none;
}

.initial-message-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.initial-message-title {
  font-size: 18px;
  font-weight: 600;
  color: #075e54;
  margin-bottom: 8px;
}

.initial-message-text {
  font-size: 14px;
  color: #667781;
  line-height: 1.5;
}

/* Date separator styling for "Today" label */
.date-separator {
  text-align: center;
  margin: 16px 0;
  position: relative;
}

.date-label {
  display: inline-block;
  background-color: rgba(225, 245, 254, 0.92);
  color: #667781;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.message {
  display: flex;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    display: none;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.customer-service {
  justify-content: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.message-content {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 8px;
  position: relative;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.message.customer-service .message-content {
  background-color: white;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
  background-color: #d9fdd3;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-emoji {
  font-size: 16px;
  margin-right: 6px;
}

.message-text {
  font-size: 14.5px;
  line-height: 1.4;
  color: #111;
}

.message-text {
  font-size: 14.5px;
  line-height: 1.4;
  color: #111;
  display: block;
  position: relative;
}

.message-text::after {
  content: "";
  float: right;
  width: 60px;
  height: 20px;
  shape-outside: inset(0 0 0 0);
}

.message-time {
  font-size: 11px;
  color: #667781;
  margin-top: 0;
  text-align: right;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  position: absolute;
  right: 8px;
  bottom: 2px;
}

/* Bot message timestamp - appears above divider and button */
.message.customer-service .message-time {
  position: static;
  margin-top: 8px;
  margin-bottom: 0;
}

.double-checkmark {
  margin-left: 4px;
  vertical-align: middle;
  transform: translateY(1px);
  display: inline-block;
}
.typing-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background-color: white;
  border-radius: 8px;
  max-width: 75px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator.active {
  display: flex;
  animation: slideIn 0.3s ease;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #90949c;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Improved input area for better Android compatibility */
.chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #f0f0f0;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-height: 64px;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: 24px;
  padding: 8px 12px;
  gap: 8px;
  min-width: 0;
  max-width: calc(100% - 64px);
}

.emoji-button,
.attach-button,
.camera-button {
  cursor: pointer;
  color: #667781;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.emoji-button svg,
.attach-button svg,
.camera-button svg {
  display: block;
}

#messageInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  min-width: 0;
}

.camera-button {
  font-size: 24px;
  cursor: pointer;
  color: #667781;
  flex-shrink: 0;
}

/* Enhanced send button for Android with better visibility and touch targets */
.send-button {
  min-width: 48px;
  min-height: 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #25d366 !important;
  color: white !important;
  border: none;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 1001;
  padding: 0;
  outline: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.send-button:hover {
  background-color: #20bd5a !important;
}

.send-button:active {
  transform: scale(0.95);
  background-color: #1da851 !important;
}

.send-button.voice-mode {
  background-color: #25d366 !important;
}

.send-button.voice-mode:hover {
  background-color: #20bd5a !important;
}

.send-button .mic-icon,
.send-button .send-icon {
  pointer-events: none;
  display: block;
}

.send-button.voice-mode .mic-icon {
  display: block;
}

.send-button.voice-mode .send-icon {
  display: none;
}

.send-button:not(.voice-mode) .mic-icon {
  display: none;
}

.send-button:not(.voice-mode) .send-icon {
  display: block;
}

.send-button.voice-mode {
  background-color: #667781 !important;
  font-size: 20px;
}

.send-button.voice-mode:hover {
  background-color: #54656f !important;
}

.send-button svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
  display: block;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

/* Responsive */
@media (min-width: 768px) {
  .chat-container {
    max-width: 500px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  }

  /* Added max-width for background on larger screens */
  .chat-background {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
  }

  .chat-input {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Enhanced Android-specific fixes for better mobile compatibility */
@media (max-width: 767px) {
  .chat-header {
    padding: 8px 12px;
  }

  .profile-pic {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .contact-name {
    font-size: 15px;
    gap: 4px;
  }

  .verified-badge {
    width: 14px;
    height: 14px;
  }

  .contact-number,
  .typing-status {
    font-size: 12px;
  }

  .header-icons {
    gap: 16px;
  }

  .header-icons svg {
    width: 22px;
    height: 22px;
  }

  .chat-messages {
    padding: 20px 16px 140px 16px; /* Increased bottom padding for mobile devices to 140px */
  }

  .chat-input {
    padding: 6px 8px;
  }

  .send-button {
    min-width: 48px !important;
    min-height: 48px !important;
    width: 48px !important;
    height: 48px !important;
  }

  .send-button svg {
    width: 22px;
    height: 22px;
  }

  .input-wrapper {
    max-width: calc(100% - 60px);
  }

  .register-button {
    padding: 13px 18px;
    font-size: 14.5px;
  }

  /* Added mobile-friendly preview content styling */
  .info-banner {
    padding: 6px 10px;
    font-size: 11px;
    gap: 6px;
  }

  .banner-icon {
    font-size: 14px;
  }

  .business-profile {
    padding: 16px;
  }

  .business-avatar {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }

  .business-name {
    font-size: 16px;
  }

  .business-info,
  .business-followers {
    font-size: 12px;
  }

  .emoji-button,
  .attach-button,
  .camera-button {
    width: 24px;
    height: 24px;
  }

  .emoji-button svg,
  .attach-button svg,
  .camera-button svg {
    width: 24px;
    height: 24px;
  }
}

/* Added extra small device support for compact Android phones */
@media (max-width: 360px) {
  .chat-header {
    padding: 8px 10px;
    gap: 10px;
  }

  .back-button {
    width: 20px;
    height: 20px;
  }

  .back-button svg {
    width: 20px;
    height: 20px;
  }

  .profile-pic {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .contact-name {
    font-size: 14px;
    gap: 3px;
  }

  .verified-badge {
    width: 13px;
    height: 13px;
  }

  .contact-number,
  .typing-status {
    font-size: 11px;
  }

  .header-icons {
    gap: 12px;
  }

  .header-icons svg {
    width: 20px;
    height: 20px;
  }

  .chat-messages {
    padding: 16px 12px 150px 12px; /* Increased bottom padding for extra small devices to 150px */
  }

  .input-wrapper {
    padding: 6px 10px;
  }

  #messageInput {
    font-size: 14px;
  }

  .emoji-button,
  .attach-button,
  .camera-button {
    width: 22px;
    height: 22px;
  }

  .emoji-button svg,
  .attach-button svg,
  .camera-button svg {
    width: 22px;
    height: 22px;
  }

  /* Added extra small device preview content styling */
  .info-banner {
    padding: 6px 8px;
    font-size: 10.5px;
    gap: 6px;
  }

  .banner-icon {
    font-size: 13px;
  }

  .business-profile {
    padding: 14px;
    gap: 8px;
  }

  .business-avatar {
    width: 64px;
    height: 64px;
    font-size: 28px;
    margin-bottom: 6px;
  }

  .business-name {
    font-size: 15px;
  }

  .business-info,
  .business-followers {
    font-size: 11.5px;
  }
}

/* Full-width inline button bar (WhatsApp style) */
.register-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% + 24px);
  margin: 0 -12px;
  background-color: #ffffff !important;
  color: #45cafa !important;
  padding: 12px 0;
  border: none;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.2s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.register-button svg {
  flex-shrink: 0;
}

.message-image-link {
  display: block;
  text-decoration: none;
}

.message-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 8px;
  box-shadow: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.double-checkmark {
  margin-left: 4px;
  vertical-align: middle;
  transform: translateY(1px);
  display: inline-block;
}

.double-checkmark path {
  stroke: #34B7F1; /* WhatsApp blue */
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
