/* ============================================================
   ظاهر تازه: شماره‌گرهای منو، گفتگو (زمان و تاریخ)، حرکت‌های نرم
   بعد از style.css و nav-badges.css لود می‌شود — فقط افزودنی است.
   ============================================================ */

/* ---------- ۱. شماره‌گرهای منو ---------- */
.nav-count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  font-size: 12px;
  background: linear-gradient(150deg, #f9705f 0%, #ef4136 48%, #cf2618 100%);
  box-shadow:
    0 1px 2px rgba(120, 20, 12, .38),
    0 5px 14px -4px rgba(217, 45, 32, .55),
    inset 0 1px 0 rgba(255, 255, 255, .34);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), box-shadow .2s ease, opacity .3s ease;
}
.nav-link:hover .nav-count { transform: scale(1.07); }

.nav-link.active .nav-count {
  background: #fff;
  color: var(--brand-dark, #1d4ed8);
  box-shadow: 0 3px 12px rgba(9, 17, 40, .38), inset 0 -1px 0 rgba(15, 23, 42, .08);
}

/* عدد تازه رسید: نبض + حلقه (در nav-badges.css) و یک درخشش کوتاه */
.nav-count.is-bump {
  animation: navCountBump .55s cubic-bezier(.22, 1, .36, 1), navCountGlow 1.4s ease-out;
}
@keyframes navCountGlow {
  0%   { box-shadow: 0 0 0 0 rgba(239, 65, 54, .55), 0 5px 14px -4px rgba(217, 45, 32, .55); }
  70%  { box-shadow: 0 0 0 10px rgba(239, 65, 54, 0), 0 5px 14px -4px rgba(217, 45, 32, .55); }
  100% { box-shadow: 0 1px 2px rgba(120, 20, 12, .38), 0 5px 14px -4px rgba(217, 45, 32, .55), inset 0 1px 0 rgba(255, 255, 255, .34); }
}

/* عدد کم شد (موردی دیده شد) */
.nav-count.is-drop { animation: navCountDrop .38s cubic-bezier(.22, 1, .36, 1); }
@keyframes navCountDrop {
  0%   { transform: translateY(-3px) scale(1.12); }
  100% { transform: none; }
}

/* به صفر رسید: نرم محو شود */
.nav-count.is-clear {
  opacity: 0;
  transform: scale(.6);
  transition: opacity .3s ease, transform .3s ease;
}

/* ---------- ۲. منوی کنار: حرکت نرم‌تر ---------- */
.nav-link {
  transition: background .18s ease, color .18s ease, transform .18s cubic-bezier(.22, 1, .36, 1);
}
.nav-link svg { transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
.nav-link:hover svg { transform: scale(1.08); }
.nav-link.active { position: relative; }
.nav-link.active::before {
  content: "";
  position: absolute;
  inset-inline-end: -14px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  transform: translateY(-50%);
  opacity: .9;
}

/* ---------- ۳. گفتگو: جداکنندهٔ روز ---------- */
.chat-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 2px 2px;
  color: var(--muted, #64748b);
  font-size: 11.5px;
  font-weight: 600;
}
.chat-day::before,
.chat-day::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20, 33, 58, .13), transparent);
}
.chat-day span {
  flex: 0 0 auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .07);
  color: #3b5b96;
  border: 1px solid rgba(37, 99, 235, .12);
}

/* ---------- ۴. گفتگو: نام و ساعت پیام ---------- */
.chat-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.chat-msg.is-me .chat-head { flex-direction: row-reverse; }
.chat-sender { margin-bottom: 0 !important; }

.chat-time {
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: .85;
}
.chat-msg:hover .chat-time { opacity: 1; }

/* ---------- ۵. گفتگو: حباب‌های خوش‌ظاهر ---------- */
.chat-bubble {
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  line-height: 1.85;
  box-shadow: 0 1px 2px rgba(20, 33, 58, .05), 0 8px 20px -16px rgba(20, 33, 58, .5);
  transition: box-shadow .2s ease, transform .2s ease;
}
.chat-msg.is-me .chat-bubble {
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(150deg, #2f6bf3, #1d47c8);
  border-color: transparent;
  box-shadow: 0 2px 6px -2px rgba(29, 71, 200, .5), 0 12px 26px -18px rgba(29, 71, 200, .9);
}
.chat-bubble:hover { transform: translateY(-1px); }

.chat-avatar, .chat-msg .avatar {
  box-shadow: 0 2px 6px -2px rgba(20, 33, 58, .35);
}

/* ابزار پیام: ویرایش و حذف — همیشه در دسترس (روی موبایل هم) */
.chat-tools { display: flex; gap: 6px; margin-top: 5px; }
.chat-msg.is-me .chat-tools { justify-content: flex-end; }
.chat-tool {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid rgba(20, 33, 58, .12);
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chat-tool:hover { background: #f1f5f9; color: #1e293b; }
.chat-tool.is-danger:hover { background: #fdecea; border-color: #f2c7c1; color: #b3372a; }
.chat-tool:focus-visible { outline: 2px solid var(--brand, #2563eb); outline-offset: 2px; }
.chat-edited { font-size: 10.5px; color: #94a3b8; margin-inline-start: 6px; }
.chat-edit-box { display: flex; flex-direction: column; gap: 6px; }
.chat-edit-box textarea {
  min-height: 62px;
  border-radius: 12px !important;
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
}
.chat-msg.is-removing { animation: chatOut .22s ease forwards; }
@keyframes chatOut {
  to { opacity: 0; transform: translateY(-6px) scale(.97); }
}

/* شماره‌گر هرگز جای نوشتهٔ منو را نگیرد */
.nav-link { overflow: visible; }
.nav-link .nav-count { flex: 0 0 auto; }

/* پیام تازه: ورود نرم از پایین */
.chat-msg.is-fresh { animation: chatIn .34s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes chatIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* ---------- ۶. جزئیات نامه: خوانایی بیشتر ---------- */
#ld-body {
  line-height: 2.05;
  white-space: pre-wrap;
  text-wrap: pretty;
}

/* ---------- ۷. حرکت‌های نرم عمومی ---------- */
.card { transition: box-shadow .22s ease, transform .22s cubic-bezier(.22, 1, .36, 1); }
.project-card:hover, .card.is-hoverable:hover { transform: translateY(-2px); }

.btn { transition: background .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease; }
.btn:active { transform: translateY(1px); }

.toast { animation: toastIn .28s cubic-bezier(.22, 1, .36, 1); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-count, .nav-link, .nav-link svg, .chat-bubble, .card, .btn { transition: none; }
  .nav-count.is-bump, .nav-count.is-drop, .chat-msg.is-fresh, .toast { animation: none; }
}

/* ---------- ۸. تماس تصویری ورودی (حالت گوگل‌میت) ---------- */
.call-card {
  position: fixed;
  z-index: 9997;
  inset-block-end: 22px;
  inset-inline-start: 22px;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(155deg, #182034, #0f1626);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 24px 60px -22px rgba(8, 14, 28, .85), 0 2px 0 rgba(255, 255, 255, .04) inset;
  color: #e7edf9;
  font-family: var(--font-body);
  max-width: min(420px, calc(100vw - 44px));
}
.call-card.is-on { display: flex; animation: callIn .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes callIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.call-pulse { position: relative; flex: 0 0 auto; }
.call-pulse::before,
.call-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid rgba(45, 212, 191, .55);
  animation: callRing 1.9s ease-out infinite;
}
.call-pulse::after { animation-delay: .95s; }
@keyframes callRing {
  0%   { opacity: .85; transform: scale(.85); }
  100% { opacity: 0;   transform: scale(1.45); }
}

.call-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .8);
}

.call-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.call-kicker { font-size: 10.5px; letter-spacing: .08em; color: #6ee7d3; font-weight: 700; }
.call-name { font-size: 14px; font-weight: 700; color: #f3f7ff; }
.call-title {
  font-size: 12px;
  color: #94a3c4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .18s ease, background .18s ease;
}
.call-btn:active { transform: translateY(1px); }
.call-btn:focus-visible { outline: 2px solid #6ee7d3; outline-offset: 2px; }
.call-accept {
  background: linear-gradient(150deg, #10b981, #059669);
  box-shadow: 0 8px 20px -10px rgba(5, 150, 105, .95);
  animation: callBreathe 2.2s ease-in-out infinite;
}
.call-accept:hover { background: linear-gradient(150deg, #12c78d, #047857); }
@keyframes callBreathe {
  0%, 100% { box-shadow: 0 8px 20px -10px rgba(5, 150, 105, .95); }
  50%      { box-shadow: 0 10px 26px -8px rgba(16, 185, 129, 1); }
}
.call-decline { background: rgba(255, 255, 255, .08); color: #ffd9d4; }
.call-decline:hover { background: rgba(239, 68, 68, .22); color: #fff; }

@media (max-width: 600px) {
  .call-card { inset-inline: 12px; inset-block-end: 78px; flex-wrap: wrap; }
  .call-actions { width: 100%; }
  .call-btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .call-card.is-on { animation: none; }
  .call-pulse::before, .call-pulse::after, .call-accept { animation: none; }
}
