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

html, body {
  height: 100vh;
  height: -webkit-fill-available;
  overflow: hidden;
}

/* Enhanced Header Fixes for Mobile Keyboard */
.chats-header {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(40, 167, 86, 0.1);
  display: flex;
  align-items: center;
  padding: 16px 20px;
  position: fixed !important;
  width: 100% !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  
  /* Critical fixes for mobile keyboard */
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0) !important;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  
  /* Prevent header from moving when keyboard opens */
  position: -webkit-sticky !important;
  position: sticky !important;
  
  /* Force hardware acceleration */
  -webkit-perspective: 1000;
  perspective: 1000;
  
  /* Ensure it stays above everything */
  isolation: isolate;
}

.chat-messages {
    scroll-behavior: smooth;
}
/* Prevent body scroll and maintain header position */
body.typing {
  position: fixed !important;
  width: 100% !important;
  height: 100vh !important;
  overflow: hidden !important;
  
  /* Keep the header visible */
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Force header to stay at top even with keyboard */
body.typing .chats-header {
  position: fixed !important;
  top: 0 !important;
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
}

/* Ensure chat messages container accounts for fixed header */
body.typing #chat-messages {
  position: fixed !important;
  top: 80px !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 200px !important;
  height: auto !important;
  overflow-y: auto !important;
  padding: 20px !important;
  margin: 0 !important;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  .chats-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
  }
  
  /* iOS Safari viewport height fix */
  body {
    height: 100vh;
    height: -webkit-fill-available;
  }
  
  /* Prevent iOS Safari from hiding header when keyboard opens */
  body.typing {
    height: 100vh !important;
    height: -webkit-fill-available !important;
    position: fixed !important;
    overflow: hidden !important;
  }
  
  body.typing .chats-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
  }
}

/* Android Chrome specific fixes */
@media screen and (max-width: 768px) {
  .chats-header {
    position: fixed !important;
    top: 0 !important;
    z-index: 9999 !important;
    transform: translateZ(0) !important;
  }
  
  /* When keyboard is active on Android */
  body.typing .chats-header {
    position: fixed !important;
    top: 0 !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
  }
}

/* Alternative method using viewport units that don't change with keyboard */
@media (max-width: 768px) {
  .chats-header {
    /* Use viewport units that ignore keyboard */
    position: fixed !important;
    top: 0 !important;
    height: 80px !important;
    z-index: 9999 !important;
  }
  
  /* Ensure the header height is consistent */
  body.typing .chats-header {
    height: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;
  }
}

/* Fallback for older browsers */
.chats-header {
  min-height: 80px;
  max-height: 80px;
}

/* Ensure dropdown doesn't get affected */
body.typing .dropdown-menu {
  position: absolute !important;
  z-index: 10000 !important;
}

.chats-header {
  position: fixed !important;
  top: 0 !important;
  z-index: 9999 !important;
}

body {
  font-family: 'Inter', sans-serif;
  color: #1a202c;
  height: 100vh;
  overflow: hidden;

  /* --- Added Salmart chat background --- */
  background-image: url('./chat-bg.png'); /* ✅ correct syntax */
  background-repeat: repeat; 
  background-size: 120px; 
  background-attachment: fixed; 
  background-blend-mode: soft-light;
}

#chat-messages {
  /* Background base */
  position: relative;
  overflow-y: auto;
  height: calc(100vh - 120px);
  padding: 10px;
}

#chat-messages::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('./chat-bg.png');
  background-color: rgba(248, 250, 248, 0.8); /* Light greenish tint */
  background-repeat: repeat;
  background-size: 120px;
  background-blend-mode: soft-light;
  pointer-events: none;
  z-index: 0;
  filter: saturate(0.1) brightness(1.3);
  opacity: 0.2;
}
/* Header Styles */
.chats-header {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(40, 167, 86, 0.1);
  display: flex;
  align-items: center;
  padding: 16px 20px;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  /* Add these lines: */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* Prevent body scroll when typing on mobile */
body.typing {
  position: fixed;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Force header to stay fixed on iOS */
@supports (-webkit-touch-callout: none) {
  .chats-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
  }
}

.user-profile {
  display: flex;
  align-items: center;
  flex: 1;
}

.chats-header img {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  margin-right: 12px;
  border: 1px solid #28a756;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.chats-header img:hover {
  transform: scale(1.05);
}

.user-info {
  flex: 1;
}

#chats-userName {
  font-weight: 600;
  font-size: 16px;
  color: #1a202c;
  margin-bottom: 2px;
}

.typing-indicator {
  font-size: 12px;
  color: #28a756;
  font-weight: 500;
}

/* Chat Options */
.chat-options {
  position: relative;
}

#ellipsis-btn {
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding:8px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#ellipsis-btn:hover {
  background: rgba(40, 167, 86, 0.2);
  color: #28a756;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 2000;
  min-width: 150px;
  overflow: hidden;
}

.dropdown-item {
  padding: 12px 16px;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: #f8fafc;
  color: #28a756;
}

/* Chat Messages */
#chat-messages {
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - 200px);
  margin-top: 80px;
  scroll-behavior: smooth;
  margin-bottom: 220px; /* Increased from 180px to 220px */
  padding-bottom: 20px; /* Added extra padding at bottom */
}

/* Alternative solution - add padding bottom to ensure last message is visible */
#chat-messages::after {
  content: '';
  display: block;
  height: 40px; /* Extra space after last message */
  width: 100%;
}

/* On mobile, increase the bottom margin even more due to virtual keyboard */
@media (max-width: 768px) {
  #chat-messages {
    margin-bottom: 240px; /* Even more space on mobile */
    padding-bottom: 30px;
  }
  
  #chat-messages::after {
    height: 50px; /* More space on mobile */
  }
}

/* When typing (mobile keyboard open), adjust spacing */
body.typing #chat-messages {
  margin-bottom: 280px;
  padding-bottom: 40px;
}

.message {
  max-width: 70%;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 18px;
  position: relative;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.3s ease;
}

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

@media (min-width: 768px) {
  .message {
    max-width: 45%;
  }
  
  #chat-messages {
    padding: 30px;
  }
}

.quoted-reply {
  background: #f0f0f0;
  border-left: 4px solid #34b7f1;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  color: #555;
}

.quoted-line {
  font-weight: bold;
  color: #075e54;
}

.quoted-text {
  padding-left: 6px;
}

.chat-message {
  background: #dcf8c6;
  padding: 10px;
  border-radius: 8px;
  margin: 8px 0;
  max-width: 80%;
  word-wrap: break-word;
}

.message-meta {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}

.message-text {
  font-size: 14px;
}

.sent {
  background: linear-gradient(135deg, #28a756 0%, #22c55e 100%);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  color: white;
  font-size: 14px;
  display: block;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(40, 167, 86, 0.3);
}

.received {
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-bottom-left-radius: 4px;
  font-size: 14px;
  display: block;
  margin-bottom: 12px;
  color: #2d3748;
}

.message-timestamp {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 6px;
  text-align: right;
}

.received .message-timestamp {
  color: #a0aec0;
}

.system-message {
  text-align: center;
  margin: 16px auto;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  background: rgba(40, 167, 86, 0.1);
  border-radius: 12px;
  max-width: 80%;
  padding: 8px 16px;
  width: fit-content;
}

/* Quoted Messages */
.quoted-message {
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  max-width: 100%;
}

.quote-bar {
  width: 3px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  margin-right: 10px;
  flex-shrink: 0;
}

.received .quote-bar {
  background: #28a756;
}

.quote-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.quote-author {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  margin-bottom: 2px;
}

.received .quote-author {
  color: #28a756;
}

.quote-text {
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.received .quote-text {
  color: #718096;
}

#chat-messages img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}

.image-message img {
  max-width: 250px; 
  height: auto;
}

.receipt-image {
  max-width: 100px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* Message Input */
.message-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #fff;
  box-shadow: 0 0 10px #ddd;
  z-index: 999;
  padding: 5px;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
}

.input-section {
  max-width: 800px;
  margin: 0 auto;
}

#type-section {
  width: 100%;
  min-height: 10px;
  max-height: 200px;
  padding: 10px 16px;
  border: 1px solid #fff;
  border-radius: 30px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  box-shadow: 0 0 10 #ddd;
  outline: none;
  background: #fafafa;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

#type-section:focus {
  border-color: #fff;
  background: white;
  box-shadow: 0 0 10px #ddd;
  border-top: 1px solid #28a745;
}

#type-section::placeholder {
  color: #9ca3af;
  font-size: 16px;
}

.action-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.left-buttons {
  display: flex;
  gap: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  background: #f1f5f9;
  color: #64748b;
}

.action-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.action-btn.primary {
  background: linear-gradient(135deg, #28a756 0%, #22c55e 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(40, 167, 86, 0.3);
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(40, 167, 86, 0.4);
}

.action-btn:disabled {
  background: #f1f5f9;
  color: #cbd5e0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#bargain-btn:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

#bargain-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Product Preview */
.product-photo-preview {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.product-photo-preview:hover {
  transform: scale(1.02);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  max-width: 500px;
  width: 90%;
  margin: 0 auto;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-bottom: 16px;
  color: #1a202c;
  font-weight: 600;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  margin: 4px;
}

.btn-primary {
  background: #28a756;
  color: white;
}

.btn-primary:hover {
  background: #22c55e;
  transform: translateY(-1px);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

/* Toast Notifications */
.toast-message {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #28a756 0%, #22c55e 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(40, 167, 86, 0.3);
  opacity: 1;
  transition: all 0.3s ease;
  z-index: 4000;
  max-width: 80%;
}

.toast-message.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.toast-message.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast-message.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f4f6;
  border-top: 3px solid #28a756;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .chats-header {
    padding: 12px 16px;
  }
  
  .message-container {
    padding: 12px 16px;
  }
  
  #chat-messages {
    padding: 16px;
  }
  
  .modal-content {
    margin: 20px;
    width: calc(100% - 40px);
  }
}

/* Hide scrollbar for mobile */
@media (max-width: 768px) {
  #chat-messages::-webkit-scrollbar {
    display: none;
  }
}

/* Emoji Picker Styles */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 320px;
  max-height: 300px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 1001;
  overflow: hidden;
}

.emoji-categories {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.emoji-category {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: none;
  font-size: 18px;
}

.emoji-category:hover {
  background: #e2e8f0;
}

.emoji-category.active {
  background: #28a756;
  color: white;
}

.emoji-grid {
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
}

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 5px;
}

.emoji-item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  font-size: 18px;
  transition: all 0.2s ease;
  border: none;
  background: none;
}

.emoji-item:hover {
  background: #f0f0f0;
  transform: scale(1.2);
}

.emoji-grid::-webkit-scrollbar {
  width: 4px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
}

/* Message emoji styling */
.message {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
}

/* Make emojis larger in messages */
.emoji-large {
  font-size: 2.5em;
  line-height: 1;
}

.message.emoji-only {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 8px;
}

.sent.emoji-only {
  background: transparent !important;
}

@media (max-width: 768px) {
  .emoji-picker {
    width: calc(100vw - 40px);
    left: 50%;
    transform: translateX(-50%);
  }
  
  .emoji-item {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}
/* Image Preview Container (for selected image before sending) */
#image-preview-container {
    display: flex; /* Hidden by default, shown by JS */
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background-color: #f0f2f5;
    border-top: 1px solid #e0e0e0;
    position: relative;
    overflow: hidden;
    max-height: 150px; /* Adjust as needed */
}

#image-preview-container #image-preview {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
}

#image-preview-container .preview-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.view-once-label {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #555;
    white-space: nowrap;
}

.view-once-label input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
    accent-color: #007bff; /* Highlight checkbox */
}

.close-preview-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.close-preview-btn:hover {
    color: #333;
}

/* --- URL Photo Preview (for predefined product messages) --- */
.url-photo-preview {
    background-color: #e6f7ff; /* Light blue background */
    border: 1px solid #b3e0ff;
    border-radius: 12px;
    padding: 15px;
    margin: 15px auto; /* Center with margin */
    max-width: 400px; /* Max width for the preview card */
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.url-photo-preview .url-preview-content {
    width: 100%;
}

.url-photo-preview .url-preview-message {
    font-size: 0.95em;
    color: #333;
    margin-bottom: 10px;
    font-style: italic;
}

.url-photo-preview .url-preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.url-photo-preview .url-preview-product-name {
    font-weight: bold;
    color: #0056b3;
    font-size: 1em;
    margin-top: 5px;
}

/* --- One-Time View Image Styles --- */
.view-once-photo-container {
    position: relative;
    width: 200px; /* Fixed width for better control */
    height: 200px; /* Fixed height for better control */
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex; /* To center content */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.view-once-photo-container .view-once-blurred-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(5px) brightness(0.8); /* Slightly blur and dim */
    transition: filter 0.3s ease;
    border-radius: 12px; /* Ensure blur respects border-radius */
}

.view-once-photo-container .view-once-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Darker overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    font-weight: bold;
    font-size: 0.9em;
    border-radius: 12px;
    transition: background-color 0.3s ease;
}

.view-once-photo-container .view-once-overlay:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.view-once-photo-container .view-once-text-overlay {
    position: absolute; /* Position text over the image */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    padding: 10px;
}

.view-once-photo-container .view-once-info-text {
    font-size: 0.8em;
    font-weight: normal;
    margin-bottom: 5px;
    opacity: 0.8;
}

.view-once-photo-container .view-once-icon {
    font-size: 2em;
    margin-bottom: 8px;
    color: #fff;
}

.view-once-photo-container .view-once-action-text {
    font-size: 1.1em;
    font-weight: bold;
}

/* Style for the actual image once viewed */
.viewed-image-container {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
}

.viewed-image-container .view-once-actual-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Ensure full image is visible */
    border-radius: 12px;
}

/* Style for deleted view-once images */
.view-once-deleted-container {
    width: 200px;
    height: 120px; /* Smaller height for deleted state */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 12px;
    text-align: center;
    color: #777;
    font-size: 0.9em;
    box-shadow: none; /* No shadow for deleted */
}

.view-once-deleted {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

.view-once-deleted .view-once-icon {
    font-size: 1.8em;
    color: #aaa;
    margin-bottom: 5px;
}

.view-once-deleted .view-once-text {
    font-size: 0.9em;
}

/* General image message styling */
.message.image-message {
    padding: 5px; /* Adjust padding for image messages */
    background: none; /* No background for the message div itself */
    box-shadow: none; /* No box shadow for the message div itself */
}

/* This is the container for normal (non-view-once) images within a message bubble */
.image-container {
    background-color: #ffffff; /* White background for the image bubble */
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 250px; /* Max width for image bubbles */
    overflow: hidden;
}

.message.sent .image-container {
    background-color: #28a745 ;/* Greenish for sent image bubble */
}

.message.received .image-container {
    background-color: #ffffff; /* White for received image bubble */
}

.image-container .chat-image {
    max-width: 100%;
    height: auto;
    display: block; /* Remove extra space below image */
    border-radius: 8px; /* Slightly smaller border-radius inside the bubble */
}

.image-message-text {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 8px;
    background-color: var(--chat-bubble-bg-color); /* Use your existing bubble color */
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.sent .image-message-text {
    background-color: #28a745;
    color: #fff;
}

.message.received .image-message-text {
    background-color: #ffffff;
    color: #333;
}


/* Specific styling for sent/received view-once containers */
.sent.view-once-image-container {
  background: #28a745;/* Lighter green for sent */
  border-color: #fff;
}

.received.view-once-image-container {
  background-color: #fff;
  border: solid 10px #fff;
  box-shadow: 0 0 10px #ddd;
}

.sent.viewed-image-container {
    background: #28a745;
    border-color: #1a6d32;
}

.received.viewed-image-container {
    background-color: #fff;
    border-color: #28a745;
}

/* General image styling for regular chat images (ensure this is compatible) */
.chat-image,  .product-photo-preview {
  max-width: 100%; /* Ensures images fit within their message bubble */
  height: auto;
  border-radius: 8px;
  margin-top: 5px; /* Spacing below text if text also present */
  cursor: pointer; /* Indicate it's clickable for enlargement */
}

/* Style for message types that might contain images */
.message.image-message {
    padding: 10px; /* Adjust padding for image messages */
    display: flex; /* Use flexbox for better image/text layout */
    flex-direction: column;
    align-items: flex-start; /* Align content to the start */
}

.message.image-message.sent {
    align-items: flex-end; /* Align sent image messages to the end */
}

.image-message-text {
    word-wrap: break-word;
    white-space: pre-wrap;
    margin-bottom: 5px; /* Space between text and image */
    max-width: 100%; /* Ensure text wraps within the bubble */
}

.message .image-container {
    max-width: 200px; /* Adjust max width for images inside bubbles */
    width: 100%;
}

.user-status {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.user-status.online {
  color: #28a745;
  font-weight: 500;
}

.user-status.online::before {
  content: '●';
  margin-right: 4px;
  color: #28a745;
}

.

