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

body {
  margin: 0;
  padding: 10px 0;
  background: #d4d6d9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-wrapper {
  width: 375px;
  max-width: 100%;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  overflow: hidden;
  position: relative;
  height: 100%;
}

/* Header Styles */
.chat-header {
  background: #008069;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 65px;
  color: white;
}

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

.back-arrow {
  font-size: 28px;
  margin-right: 8px;
  font-weight: 300;
  cursor: pointer;
  height: 24px;
  line-height: 20px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  position: relative;
  color: #90949c;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 2px;
}

.user-status {
  font-size: 13px;
  opacity: 0.9;
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-right: 4px;
}

.header-icon {
  cursor: pointer;
}

.phone-icon {
  margin-right: -6px;
}

/* Chat Area Styles */
.chat-area {
  height: 300px; /* Reduced height to ensure CTA is visible */
  padding: 10px 12px;
  background-color: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23CCCCCC' fill-opacity='0.2'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1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-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  overflow-y: auto;
  position: relative;
}

.date-divider {
  text-align: center;
  color: #54656f;
  font-size: 12.5px;
  margin: 8px 0 15px;
  position: relative;
  z-index: 1;
}

.date-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: rgba(0,0,0,0.08);
  z-index: -1;
}

.date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 35%;
  right: 35%;
  height: 1px;
  background-color: #e5ddd5;
  z-index: -1;
}

/* Message Styles */
.message {
  max-width: 85%;
  margin: 2px 0 8px;
  padding: 6px 10px 8px;
  border-radius: 8px;
  position: relative;
  font-size: 14.5px;
  line-height: 19px;
  clear: both;
  word-break: break-word;
}

.emoji {
  font-size: 16px;
}

.received {
  background: white;
  float: left;
  border-top-left-radius: 0;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  margin-left: 0; /* Removed extra left margin to fix symmetry */
}

.received::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  width: 8px;
  height: 13px;
  background: white;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.sent {
  background: #d9fdd3;
  float: right;
  border-top-right-radius: 0;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  margin-right: 0; /* Removed extra right margin to fix symmetry */
}

.sent::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 0;
  width: 8px;
  height: 13px;
  background: inherit;
  clip-path: polygon(0 0, 0 100%, 100% 0);
}

.message-content {
  position: relative;
  padding-right: 5px; /* Added padding for better text alignment */
}

.message-time {
  font-size: 11px;
  color: #667781;
  margin-left: 4px;
  white-space: nowrap;
  position: relative;
  float: right;
  margin-top: 3px;
  margin-bottom: -5px;
  margin-right: 0;
}

.read-status {
  color: #53bdeb;
  letter-spacing: -2px; /* Make blue ticks closer together */
  font-size: 12px;
}

/* CTA Section */
.cta-container {
  padding: 16px;
  background: #f0f2f5;
  text-align: center;
  border-top: 1px solid #e9edef;
}

.headline {
  color: #111b21;
  font-size: 18px;
  margin: 0 0 14px 0;
  line-height: 1.3;
  font-weight: 600;
}

.btn-whatsapp {
  background: #00a884;
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
  transition: transform 0.2s, background-color 0.2s;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(0,168,132,0.25);
}

.btn-whatsapp:hover {
  background: #009d79;
  transform: scale(1.02);
}

.disclaimer {
  color: #667781;
  font-size: 12px;
  margin: 12px 0 0 0;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chat-wrapper {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    max-width: none;
  }
  
  body {
    padding: 0;
  }
  
  .chat-area {
    height: calc(100vh - 65px - 140px); /* Viewport height minus header and CTA */
  }
}

/* iPhone-specific Adjustments */
@media only screen and (min-device-width: 390px) and (max-device-width: 932px) and (-webkit-min-device-pixel-ratio: 3) {
  body {
    padding: 0;
  }
  
  .chat-wrapper {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  
  .chat-area {
    height: calc(100vh - 65px - 140px); /* Adjusted for iPhone 16, making CTA more visible */
  }
  
  .chat-header {
    padding-top: 15px; /* For the iPhone notch */
  }
}

/* Better forms for iPhone status bar */
@media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) {
  body {
    padding-top: 20px; /* Reduced padding to help CTA visibility */
  }
  
  .chat-header {
    padding-top: 15px;
  }
}
