/* =============================================
   DPC Chat Plugin — Style v3.0
   RTL | Mobile-First | Modern Design
   ============================================= */

:root {
  --dpc-primary:       #0d6efd;
  --dpc-primary-dark:  #0a58ca;
  --dpc-primary-light: #e4b7f1;
  --dpc-bg:            #f0f2f5;
  --dpc-white:         #ddecb9;
  --dpc-surface:       #ffffff;
  --dpc-border:        #e4e6ea;
  --dpc-text:          #1c1e21;
  --dpc-text-muted:    #67656b;
  --dpc-me-bg:         #610952;
  --dpc-me-text:       #ffffff;
  --dpc-other-bg:      #ffffff;
  --dpc-other-text:    #1c1e21;
  --dpc-radius:        25px;
  --dpc-radius-sm:     4px;
  --dpc-shadow:        0 2px 16px rgba(0,0,0,.10);
  --dpc-shadow-sm:     0 1px 4px  rgba(0,0,0,.08);
  --dpc-font:          'Vazirmatn', 'IRANSans', Tahoma, sans-serif;
  --dpc-transition:    .22s ease;
}

/* ── Reset ─────────────────────────────────── */
.dpc-chat-wrap *,
.dpc-inbox-wrap * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   INBOX (dashboard.php)
   ============================================ */
.dpc-inbox-wrap {
  max-width: 680px;
  margin: 0 auto;
  font-family: var(--dpc-font);
  direction: rtl;
}

/* هدر inbox */
.dpc-inbox-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 20px 18px;
  background: linear-gradient(135deg, #072627, #91e5d0);
  border-bottom: 2px solid var(--dpc-primary-light);
  border-radius: var(--dpc-radius) var(--dpc-radius) 0 0;
  box-shadow: var(--dpc-shadow-sm);
}

.dpc-inbox-header-icon {
  font-size: 2rem;
  background: var(--dpc-primary-light);
  border-radius: 50%;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.dpc-inbox-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dpc-text);
}

.dpc-inbox-sub {
  font-size: .82rem;
  color: var(--dpc-text-muted);
  margin-top: 2px;
}

/* لیست مخاطبان */
.dpc-contact-list {
  list-style: none;
  background: var(--dpc-white);
  border-radius: 0 0 var(--dpc-radius) var(--dpc-radius);
  overflow: hidden;
  box-shadow: var(--dpc-shadow);
}

.dpc-contact-item {
  border-bottom: 1px solid var(--dpc-border);
  transition: background var(--dpc-transition);
}

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

.dpc-contact-item:hover,
.dpc-contact-item.has-unread {
  background: var(--dpc-primary-light);
}

.dpc-contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
}

/* آواتار در inbox */
.dpc-contact-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.dpc-contact-avatar-img {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--dpc-border);
}

.dpc-unread-badge {
  position: absolute;
  top: -3px; left: -3px;
  min-width: 20px; height: 20px;
  background: #e53935;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--dpc-white);
}

/* جزئیات مخاطب */
.dpc-contact-details {
  flex: 1;
  min-width: 0;
}

.dpc-contact-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.dpc-contact-name {
  font-weight: 600;
  font-size: .97rem;
  color: var(--dpc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dpc-contact-time {
  font-size: .75rem;
  color: var(--dpc-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.dpc-contact-preview {
  font-size: .85rem;
  color: var(--dpc-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dpc-contact-item.has-unread .dpc-contact-name,
.dpc-contact-item.has-unread .dpc-contact-preview {
  font-weight: 700;
  color: var(--dpc-text);
}

/* حالت خالی */
.dpc-empty-state {
  text-align: center;
  padding: 52px 20px;
  background: var(--dpc-white);
  border-radius: 0 0 var(--dpc-radius) var(--dpc-radius);
}

.dpc-empty-icon {
  font-size: 3.2rem;
  margin-bottom: 12px;
}

.dpc-empty-state p {
  font-size: 1rem;
  color: var(--dpc-text);
  font-weight: 600;
  margin-bottom: 6px;
}

.dpc-empty-state small {
  font-size: .83rem;
  color: var(--dpc-text-muted);
}

/* ============================================
   CHAT BOX (chat-box.php)
   ============================================ */
.dpc-chat-wrap {
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--dpc-font);
  direction: rtl;
  display: flex;
  flex-direction: column;
  height: clamp(520px, 80vh, 820px);
  background: var(--dpc-bg);
  border-radius: var(--dpc-radius);
  box-shadow: var(--dpc-shadow);
  overflow: hidden;
}

/* ── هدر چت ────────────────────────────────── */
.dpc-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #072627, #91e5d0);
  border-bottom: 1px solid var(--dpc-border);
  flex-shrink: 0;
  box-shadow: var(--dpc-shadow-sm);
  z-index: 2;
}

.dpc-chat-header-avatar {
  position: relative;
  flex-shrink: 0;
}

.dpc-chat-header-avatar img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--dpc-primary-light);
}

.dpc-status-dot {
  position: absolute;
  bottom: 2px; left: 2px;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--dpc-white);
}

.dpc-chat-header-info {
  flex: 1;
  min-width: 0;
}

.dpc-chat-header-info strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dpc-text);
}

.dpc-typing-indicator {
  font-size: .78rem;
  color: var(--dpc-primary);
}

.dpc-back-btn {
  font-size: 1.3rem;
  color: var(--dpc-text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--dpc-radius-sm);
  transition: background var(--dpc-transition);
  line-height: 1;
}

.dpc-back-btn:hover {
  background: var(--dpc-primary-light);
  color: var(--dpc-primary);
}

/* ── ناحیه پیام‌ها ───────────────────────────── */
.dpc-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

/* اسکرول‌بار سفارشی */
.dpc-messages-area::-webkit-scrollbar { width: 5px; }
.dpc-messages-area::-webkit-scrollbar-track { background: transparent; }
.dpc-messages-area::-webkit-scrollbar-thumb {
  background: var(--dpc-border);
  border-radius: 99px;
}

/* تقسیم‌کننده تاریخ */
.dpc-date-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.dpc-date-divider::before,
.dpc-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--dpc-border);
}

.dpc-date-divider span {
  font-size: .75rem;
  color: var(--dpc-text-muted);
  white-space: nowrap;
  background: var(--dpc-bg);
  padding: 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--dpc-border);
}

/* ── ردیف پیام ──────────────────────────────── */
.dpc-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  animation: dpc-fadeIn .25s ease;
}

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

.dpc-msg-me    { flex-direction: row-reverse; }
.dpc-msg-other { flex-direction: row; }

.dpc-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* ── حباب پیام ──────────────────────────────── */
.dpc-bubble {
  max-width: min(68%, 480px);

  padding: 6px 10px; /* قبلاً 10px 14px */

  border-radius: 18px;

  position: relative;
  box-shadow: var(--dpc-shadow-sm);
  word-break: break-word;
}

.dpc-msg-me .dpc-bubble {
  background: var(--dpc-me-bg);
  color: var(--dpc-me-text);
  border-bottom-right-radius: 4px;
}

.dpc-msg-other .dpc-bubble {
  background: var(--dpc-other-bg);
  color: var(--dpc-other-text);
  border-bottom-left-radius: 4px;
}

/* متن پیام */
.dpc-bubble-text {
  font-size: .88rem;   /* کمی کوچکتر */
  line-height: 1.45;   /* فشرده‌تر */
  font-weight: 400;    /* نازک‌تر */
}

.dpc-bubble-time {
  display: block;

  font-size: .63rem;

  margin-top: 3px;

  text-align: left;

  opacity: .62;

  font-weight: 300;
}

.dpc-msg-me    .dpc-bubble-time { color: rgba(255,255,255,.8); }
.dpc-msg-other .dpc-bubble-time { color: var(--dpc-text-muted); }

/* تصویر داخل حباب */
.dpc-msg-img {
  max-width: 220px;
  max-height: 200px;
  border-radius: var(--dpc-radius-sm);
  display: block;
  margin-top: 6px;
  cursor: zoom-in;
  object-fit: cover;
}

.dpc-file-link {
  display: inline-block;
  margin-top: 6px;
  font-size: .85rem;
  color: inherit;
  opacity: .85;
  text-decoration: underline dotted;
}

/* حالت خالی چت */
.dpc-empty-chat {
  margin: auto;
  text-align: center;
  color: var(--dpc-text-muted);
}

.dpc-empty-chat span { font-size: 2.8rem; }
.dpc-empty-chat p { margin-top: 8px; font-size: .9rem; }

/* ── ناحیه ورودی ────────────────────────────── */
.dpc-chat-input-area {
  padding: 10px 12px 12px;
  background: linear-gradient(135deg, #072627, #91e5d0);
  border-top: 1px solid var(--dpc-border);
  flex-shrink: 0;
}

/* پیش‌نمایش فایل */
.dpc-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--dpc-primary-light);
  border-radius: var(--dpc-radius-sm);
  margin-bottom: 8px;
  font-size: .82rem;
  color: var(--dpc-primary-dark);
}

.dpc-file-preview span { flex: 1; font-weight: 600; }

#dpc-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #e53935;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}

/* ردیف ورودی */
.dpc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--dpc-bg);
  border: 1.5px solid var(--dpc-border);
  border-radius: calc(var(--dpc-radius) + 4px);
  padding: 6px 8px;
  transition: border-color var(--dpc-transition);
}

.dpc-input-row:focus-within {
  border-color: var(--dpc-primary);
  background: var(--dpc-white);
}

.dpc-attach-btn {
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px 6px;
  border-radius: var(--dpc-radius-sm);
  transition: background var(--dpc-transition);
  flex-shrink: 0;
  line-height: 1;
}

.dpc-attach-btn:hover { background: var(--dpc-primary-light); }

.dpc-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--dpc-font);
  font-size: .93rem;
  color: var(--dpc-text);
  resize: none;
  max-height: 120px;
  min-height: 26px;
  line-height: 1.6;
  padding: 2px 4px;
  direction: rtl;
}

.dpc-input-field::placeholder { color: #adb5bd; }

.dpc-send-btn {
  width: 40px; height: 40px;
  background: var(--dpc-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--dpc-transition), transform var(--dpc-transition);
  box-shadow: 0 2px 8px rgba(13,110,253,.35);
}

.dpc-send-btn:hover {
  background: var(--dpc-primary-dark);
  transform: scale(1.07);
}

.dpc-send-btn svg {
  width: 18px; height: 18px;
}

/* ── صفحه بدون هدف ──────────────────────────── */
.dpc-no-target {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  color: var(--dpc-text-muted);
}

.dpc-no-target-icon { font-size: 3rem; margin-bottom: 14px; }

.dpc-no-target h3 {
  font-size: 1.2rem;
  color: var(--dpc-text);
  margin-bottom: 8px;
}

.dpc-no-target p { font-size: .9rem; margin-bottom: 18px; }

.dpc-btn-outline {
  display: inline-block;
  padding: 9px 22px;
  border: 2px solid var(--dpc-primary);
  color: var(--dpc-primary);
  border-radius: var(--dpc-radius-sm);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: background var(--dpc-transition), color var(--dpc-transition);
}

.dpc-btn-outline:hover {
  background: var(--dpc-primary);
  color: #fff;
}

/* ── Alert ─────────────────────────────────── */
.dpc-alert {
  padding: 14px 18px;
  border-radius: var(--dpc-radius-sm);
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dpc-alert-warn {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffe69c;
}

/* ============================================
   RESPONSIVE — Mobile First
   ============================================ */
@media (max-width: 600px) {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
  }

  body.dpc-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
  }

  .dpc-chat-wrap {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 2147483647 !important;
    background: var(--dpc-bg) !important;
    overflow: hidden !important;

    /* برای نوارهای موبایل */
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  .dpc-chat-wrap .dpc-messages-area {
    height: calc(100dvh - 130px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  }

  .dpc-chat-header {
    border-radius: 0 !important;
    padding: 12px 16px !important;
  }

  .dpc-back-btn {
    font-size: 28px !important;
    font-weight: normal !important;
    line-height: 1 !important;
  }

  .dpc-bubble {
    max-width: 85% !important;
  }
}

body.dpc-modal-open {
  position: fixed;
  width: 100%;
  height: 100%;
}
@media (max-width: 380px) {
  .dpc-bubble { max-width: 88%; }
  .dpc-msg-avatar { width: 26px; height: 26px; }
}




.dpc-inbox-header-icon img {
    width: 24px;
    height: 24px;
}

.dpc-no-target-icon img{
    width:100px;
    height:100px;
}

.dpc-empty-chat img{
    width: 80px;
    height:80px;
}





/* فقط ناحیه پیام‌ها پس‌زمینه داشته باشد */
.dpc-messages-area {
    position: relative;
    overflow-y: auto;

    background: linear-gradient(135deg, #072627, #91e5d0)

}


/* محتوا بالاتر از overlay */
.dpc-messages-area > * {
    position: relative;
    z-index: 1;
}





/* حباب پایه */
.dpc-bubble {
  max-width: min(68%, 480px);
  padding: 10px 14px;
  border-radius: 22px;
  position: relative;
  box-shadow: var(--dpc-shadow-sm);
  word-break: break-word;
}

/* پیام خودم */
.dpc-msg-me .dpc-bubble {
  background: var(--dpc-me-bg);
  color: var(--dpc-me-text);

  border-bottom-right-radius: 6px;
}

/* نیش سمت راست */
.dpc-msg-me .dpc-bubble::after {
  content: '';
  position: absolute;

  right: -7px;
  bottom: 0;

  width: 18px;
  height: 18px;

  background: var(--dpc-me-bg);

  clip-path: polygon(0 0, 100% 100%, 0 100%);

  border-bottom-left-radius: 4px;
}

/* پیام طرف مقابل */
.dpc-msg-other .dpc-bubble {
  background: var(--dpc-other-bg);
  color: var(--dpc-other-text);

  border-bottom-left-radius: 6px;
}

/* نیش سمت چپ */
.dpc-msg-other .dpc-bubble::after {
  content: '';
  position: absolute;

  left: -7px;
  bottom: 0;

  width: 18px;
  height: 18px;

  background: var(--dpc-other-bg);

  clip-path: polygon(100% 0, 100% 100%, 0 100%);

  border-bottom-right-radius: 4px;
}



/* =========================================
   استایل‌های دکمه‌های هدر (حذف مکالمه و گزارش)
========================================= */
.dpc-chat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto; /* هدایت دکمه‌ها به سمت چپ در حالت RTL */
}

.dpc-btn-action {
    background:none;
    border: 1px solid transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px !important;
    transition: all 0.2s ease-in-out;
    padding: 0 !important;
    color: #e4e6ea;
}

.dpc-btn-action:hover {
    transform: scale(1.05);
}

/* هاور دکمه حذف مکالمه (تم قرمز) */
.dktr-delete-conv:hover {
    background: #064f5c !important; /* پس‌زمینه قرمز روشن */
    border-color: #161313 !important;
}

/* هاور دکمه گزارش تخلف (تم زرد/نارنجی) */
.dktr-report-user:hover {
    background: #064f5c !important; /* پس‌زمینه زرد روشن */
    border-color: #161313 !important;
}


/* =========================================
   استایل‌های دکمه حذف پیام تکی
========================================= */
.dktr-delete-msg {
    position: absolute;
    top: -8px;
    left: -8px; /* قرارگیری در گوشه بالا سمت چپ پیام‌های من */
    cursor: pointer;
    font-size: 11px;
    background: #035c49;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(156, 116, 5, 0.15);
    z-index: 10;
    border: 1px solid #0d0e11;
    
    /* مخفی بودن در حالت عادی برای جلوگیری از شلوغی بصری */
    opacity: 0; 
    visibility: hidden;
    transition: all 0.2s ease;
}

/* نمایش دکمه حذف وقتی موس روی حباب پیام می‌رود */
.dpc-bubble:hover .dktr-delete-msg {
    opacity: 1;
    visibility: visible;
}

.dktr-delete-msg:hover {
    background: #8b0803;
    border-color: #bba3a3;
    transform: scale(1.1);
}

