/* کانتینر اصلی چت */
.chat-wrapper {
  max-width: 420px;
  height: 100%;
  margin: 0;
  background: transparent;   /* ✅ */
  display: flex;
  flex-direction: column;
  font-family: IRANSans, Tahoma;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
/* ردیف پیام */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0;
  direction: rtl; /* خیلی مهم */
}

.msg-deleted {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;

  background: #f5f5f5;
  color: #888;

  font-style: italic;
  border: 1px dashed #ccc;

  display: flex;
  align-items: center;
  gap: 6px;
}

/* آیکن حذف */
.msg-deleted::before {
  content: "🗑️";
  font-size: 14px;
  opacity: 0.7;
}

/* پیام حذف شده کاربر */
.msg-row.me .msg-deleted {
  align-self: flex-start;   /* سمت راست در RTL */
}

/* پیام حذف شده طرف مقابل */
.msg-row.other .msg-deleted {
  align-self: flex-end;     /* سمت چپ در RTL */
}

/* پیام خود کاربر → راست */
.msg-row.me {
  justify-content: flex-start;
}

/* پیام طرف مقابل → چپ */
.msg-row.other {
  justify-content: flex-end;
}

/* باکس پیام */
.msg {
  max-width: 75%;
}

/* دکمه حذف */
.msg-delete {
  cursor: pointer;
  font-size: 14px;
  color: #bbb;
  opacity: 0;
  margin-top: 6px;
  transition: opacity .2s, color .2s;
}

/* نمایش ضربدر فقط برای پیام خود کاربر */
.msg-row.me:hover .msg-delete {
  opacity: 1;
}

.msg-delete:hover {
  color: #e74c3c;
}


.msg-row.me:hover .msg-delete {
  opacity: 1;
}

.msg-delete:hover {
  color: #e74c3c;
}
/* هدر چت */
.chat-header {
  background: #075e54;
  color: #fff;
  padding: 12px;
  font-weight: bold;
  text-align: center;
  flex-shrink: 0;
}

/* بدنه چت */
.chat-body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;  
  background-color: #ece5dd !important;
  background-image: radial-gradient(
    rgba(0,0,0,0.04) 1px,
    transparent 1px
  ) !important;
  background-size: 20px 20px !important;
}

/* پیام خوش‌آمدگویی */
.welcome-msg {
  text-align: center;
  background: #fff;
  color: #333;
  padding: 20px;
  margin: 20px;
  border-radius: 10px;
  font-family: IRANSans;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* استایل کلی پیام */
.msg {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.4;
}

/* پیام‌های کاربر (سمت راست) */
.msg.me {
  background-color: #dcf8c6;
  align-self: flex-start;
  border-bottom-right-radius: 0; /* ظاهر حباب پیام */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* پیام‌های دیگران (سمت چپ) */
.msg.other {
  background-color: #fff;
  align-self: flex-end;
  border-bottom-left-radius: 0; /* ظاهر حباب پیام */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* فوتر چت */
.chat-footer {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #f0f0f0;
  border-top: 1px solid #ddd;
  position: relative; /* برای موقعیت دهی پنل ایموجی */
}

/* باکس متن */
.chat-footer textarea {
  flex: 1;
  resize: none;
  border-radius: 20px;
  border: 1px solid #ddd;
  padding: 10px 15px;
  font-size: 14px;
  background: #fff;
  outline: none;
  margin-left: 10px;
}

/* دکمه‌های فوتر */
.chat-footer button {
  background: #128c7e;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

/* دکمه ارسال (بیضی شکل) */
#BTN_SEND {
  width: 50px;
  height: 35px;
  border-radius: 20px; /* شکل بیضی */
  font-size: 16px;
  margin-left: 8px;
}

#BTN_SEND:hover {
  background: #075e54;
}

/* دکمه میکروفون و ایموجی */
#BTN_RECORD, #BTN_EMOJI {
  width: 40px;
  height: 40px;
  border-radius: 50%; /* دایره */
  font-size: 18px;
  margin-left: 5px;
  background: transparent;
  color: #555;
}

#BTN_RECORD:hover, #BTN_EMOJI:hover {
  background: #e0e0e0;
}

/* وضعیت و زمان پیام */
.msg-status {
  display: inline-block;
  font-size: 11px;
  margin-right: 4px;
  vertical-align: middle;
}

.time {
  display: inline-block;
  font-size: 10px;
  color: #999;
  margin-top: 4px;
  vertical-align: middle;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.emoji-btn {
    font-size: 20px;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 5px;
}

.emoji-btn:hover {
    background-color: #f0f0f0;
}
/* =========================
   Floating Chat Button
   ========================= */
#chat-fab {
  position: fixed;
  right: 25px;
  bottom: 25px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #128c7e;
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  z-index: 9999;
}


#chat-fab:hover {
  background: #075e54;
}

#chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: red;
  color: #fff;
  font-size: 11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
}
 
/* =========================
   Floating Chat Panel
   ========================= */
#floating-chat-panel {
  position: fixed;
  right: 25px;
  bottom: 25px;               /* همون جای آیکن */
  width: 360px;
  height: 520px;
  background: transparent;
  z-index: 9998;

  /* انیمیشن */
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.2s ease;
  pointer-events: none;
}

/* حالت باز */
#floating-chat-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}



/* =========================
   Chat Wrapper (Full Height)
   ========================= */
.chat-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
}


/* =========================
   Header / Footer (Fixed)
   ========================= */
.chat-header {
  flex-shrink: 0;
}

.chat-footer {
  flex-shrink: 0;
}


.chat-close-btn {
  position: absolute;
  left: 12px;          /* چون RTL هست */
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  opacity: 0.9;
}

.chat-close-btn:hover {
  opacity: 1;
}
