.chatPage {
  display: flex;
  height: calc(100vh - 3rem);
}

/* Back button styling */
.backButton {
  display: none;
  margin-bottom: 1rem;
}

.ConversationContainer {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Mobile styles */
@media (max-width: 768px) {
  .chatPage {
    flex-direction: column;
  }

  /* Hide the contacts list when a contact is selected */
  .hiddenOnMobile {
    display: none;
  }

  /* Show back button in conversation view on mobile */
  .conversation {
    flex: none;
  }

  .backButton {
    display: block;
  }
}

/* Contact item style for demonstration */
.contactItem {
  height: 4rem;
  width: 100%;
  cursor: pointer;
  display: flex;
}

.contactPhotoBox {
  height: 100%;
  width: 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.contactPhotoContainer {
  height: 80%;
  width: 80%;
  border-radius: 50%;
  box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.1);
}

.contactPhoto {
  height: 100%;
  width: 100%;
  border-radius: 50%;
}

.contactInitials {
  border-radius: 50%;
  color: white;
  font: bold 15px / 13px Helvetica, Verdana, Tahoma;
  height: 100%;
  width: 100%;
  padding: 20px 3px 0 3px;
  text-align: center;
  font-size: 2rem;
}

.onlineStatus {
  background-color: var(--online);
  height: 0.7rem;
  width: 0.7rem;
  border-radius: 50%;
  position: absolute;
  bottom: 8px;
  right: 8px;
  border: 2px solid var(--bg-color);
  background-color: #35d063;
}

.contactBodyContainer {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.contactNameContainer {
  height: 50%;
  display: flex;
  align-items: flex-end;
  flex: 4;
}

.contactPreviewContainer {
  height: 50%;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  flex: 5;
}

.contactContentContainer {
  display: inline-block;
  /* shrink-wrap instead of full-width */
  max-width: 100%;
  /* never go wider than its container */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  /* just in case you ever add padding/borders */
}

.contactContentContainer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.contactPreviewMediaIcon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.9;
}

.contactPreviewText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contactTimeContainer {
  margin-right: 8px;
  white-space: nowrap;
  font-style: italic;
  color: gray;
}

.contactItem:hover {
  background: #e0e0e0;
  background: var(--contact-bg-hover);
}

.contactPinStatus {
  font-size: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px;
  color: #ddd
}

/* Back button styling */
.backButton {
  display: none;
  margin-bottom: 1rem;
}

.new {
  font-weight: bold;
}

/* Mobile styles */
@media (max-width: 768px) {
  .chatPage {
    flex-direction: column;
  }

  /* Hide the contacts list when a contact is selected */
  .hiddenOnMobile {
    display: none;
  }

  /* Show back button in conversation view on mobile */
  .conversation {
    flex: none;
  }

  .backButton {
    display: block;
  }
}

.contactList {
  width: 100%;
  flex: 1;
  overflow-y: auto;
}

.loadingContainer {
  padding: 1rem;
  width: 100%;
  min-height: 1rem;
  height: fit-content;
  display: flex;
  justify-content: center;
  align-items: center;
}

.contacts {
  flex: 1;
  height: 100%;
  border-right: 2px solid #1c1c1c;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .contacts {
    width: 100%;
  }

  .hiddenOnMobile {
    display: none;
  }
}

.contactsHeader {
  width: 100%;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.conversation {
  height: 100%;
  flex: 2;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .hiddenOnMobile {
    display: none;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .chatPage {
    flex-direction: column;
  }

  /* Hide the contacts list when a contact is selected */
  .hiddenOnMobile {
    display: none;
  }

  /* Show back button in conversation view on mobile */

  .backButton {
    display: block;
  }
}

.conversationBody {
  border-radius: 5px;
  flex: 1;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

/* Locked media overlay */
.lockedOverlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  gap: 8px;
  border-radius: 6px;
}

.lockedBadge {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-weight: 600;
}

.revealButton {
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  background: #ff8a00;
  color: #1d1d1d;
  cursor: pointer;
}

/* Locked placeholder content */
.lockedPlaceholder {
  background: #222;
  color: #fff;
  border-radius: 6px;
}

.unlockButton {
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.messageRow {
  display: flex;
  margin: 0.25rem 0;
  color: black;
}

.outgoingMessage {
  background-color: var(--my-messages);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  margin-left: auto;
  margin-right: 5px;
  max-width: 80%;
}

.requestMessage {
  background-color: var(--request-messages);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  margin-left: auto;
  margin-right: 5px;
  max-width: 80%;
}

.incomingMessage {
  background-color: var(--their-messages);
  ;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  margin-right: auto;
  margin-left: 5px;
  max-width: 80%;
}

.conversationHeader {
  height: 5rem;
  width: 100%;
  display: flex;
}

.backButton {
  height: 100%;
  width: 5rem;
  background-color: red;
}

.headerBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  width: 100%;
  padding: 0 5px;
  border-bottom: 3px solid #1c1c1c;
}

/* Chat header (selected user) */
.chatHeaderLeft {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Back arrow in chat header (CSS-driven visibility) */
.chatHeaderLeft .backButton {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0 6px 0 0;
  width: auto;
  height: auto;
  line-height: 0;
  cursor: pointer;
}

@media (max-width: 768px) {
  .chatHeaderLeft .backButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.chatHeaderAvatarWrap {
  width: 62px;
  height: 62px;
  position: relative;
  overflow: visible;
  text-decoration: none;
}

.chatHeaderAvatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creatorLink{
  color: white;
}

.chatHeaderOnlineStatus {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #35d063;
  border: 2px solid var(--bg-color);
}

.chatHeaderAvatarImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatHeaderAvatarInitials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #111;
}

.chatHeaderRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Verified icon (match creator page vibe) */
.chatHeaderLeft h2 {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.chatHeaderLeft h2 .verifiedIcon {
  width: 26px;
  height: 26px;
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  margin-top: 6px; /* TODO Peut faire mieux */
}

.contactNameContainer {
  gap: 2px;
}

.contactNameContainer .verifiedIcon {
  width: 16px;
  height: 16px;
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  margin-bottom: 0.5px;
}

/* Tip messages */
.tipMessage {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.10), rgba(255, 215, 0, 0.02));
  color: #f5f5f5;
  max-width: 280px;
}

.tipMessage .tipTitle {
  font-size: 12px;
  opacity: 0.85;
}

.tipMessage .tipAmount {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

@media (min-width: 768px) {
  .backButton {
    display: none;
  }
}

.messageInput {
  min-height: 3rem;
  height: fit-content;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
  margin: 7px;
  background-color: #1e1e1e;
  border-radius: 5px;
  align-items: center;
}

.cameraButton {
  height: 3rem;
  width: 3rem;
  background-color: green;
}

.messageZone {
  flex: 1;
  height: fit-content;
}

.textArea {
  min-height: 100%;
  max-height: 10rem;
  height: fit-content;
  width: 100%;
  font-size: 1.3rem;
  resize: none;
  background-color: #1e1e1e;
  border: none;
  color: white;
  margin-top: 4px;
}

.textArea:focus {
  outline: none;
}

.audioButton {
  height: 3rem;
  width: 3rem;
  background-color: rgb(255, 238, 0);
}

.visualButton {
  height: 44px;
  width: 44px;
  min-width: 44px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, opacity 120ms ease;
}

.visualButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
}

.visualButton:active {
  transform: translateY(0px) scale(0.98);
}

.visualButton:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 8px 18px rgba(0, 0, 0, 0.35);
}

.mediaIcon {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  pointer-events: none;
}

.mediaCountBadge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.priceInput {
  width: 2rem;
  background-color: #1e1e1e;
  border: none;
  color: white;
}

.priceInput:focus {
  outline: none;
}

.sendButton {
  height: 44px;
  width: 44px;
  min-width: 44px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(135deg, hsl(243deg 61.99% 46%), rgb(124 56 246 / 66%));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, opacity 120ms ease;
}

.sendButton:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
  background: linear-gradient(135deg, var(--primary-hover, #1e40af), rgba(255, 255, 255, 0.10));
}

.sendButton:active:not(:disabled) {
  transform: translateY(0px) scale(0.98);
}

.sendButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.sendButton:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35);
}

.sendIcon {
  width: 25px;
  height: 25px;
  display: block;
  filter: invert(1);
  opacity: 0.95;
  pointer-events: none;
}

.messageMenu {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 5rem;
  width: 5rem;
  background-color: rgb(51, 51, 51);
}

/* This has to be centered in the middle of the container*/
.messageUpdateBox {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 5rem;
  width: 5rem;
  background-color: rgb(51, 51, 51);
}