/* ═══════════════════════════════════════════════════════════════
   رابط موبایل — هدر، منوی کشویی، و نشانگرِ سلفا در گفتگو
   (اپ iOS و مرورگر گوشی) — آخرین فایلِ CSS؛ چیدمان‌های قبلی را کنار می‌گذارد.

   هدر:
   ردیف ۱:  ⚙︎ تنظیمات   |   لوگو (وسط، بزرگ‌تر)   |   ☰ منو
   ردیف ۲:  مود سه‌حالته  |  داشبورد احساسات  |  انتخاب مدل
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html body #mainApp header.header {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    grid-template-rows: 64px auto !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 8px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 4px 16px 12px !important;
    overflow: visible !important;
  }
  html body #mainApp header.header::before { display: none !important; content: none !important; }

  /* ── ردیف ۱ ── */
  html body #mainApp header.header > #settingsBtn {
    grid-column: 1; grid-row: 1; justify-self: start;
    width: 40px !important; height: 40px !important; margin: 0 !important;
    border-radius: 12px !important;
  }
  /* پوشه‌ی لوگو و احساسات باز می‌شود تا هر کدام جای خودش را بگیرد */
  html body #mainApp header.header > .logo-mood-wrap { display: contents !important; }
  html body #mainApp header.header > .logo-mood-wrap > .logo-row,
  html body #mainApp header.header > .logo-mood-wrap > .logo {
    grid-column: 2; grid-row: 1; justify-self: center; align-self: center;
    display: flex !important; align-items: center; justify-content: center;
    margin: 0 !important;
  }
  /* لوگو ۵۰٪ بزرگ‌تر */
  html body #mainApp header.header .logo-mood-wrap .logo {
    transform: scale(1.5);
    transform-origin: center center;
    margin: 0 !important;
  }
  html body #mainApp header.header > #mobileMenuBtn {
    grid-column: 3; grid-row: 1; justify-self: end;
    width: 40px !important; height: 40px !important; margin: 0 !important;
    border-radius: 12px !important;
  }
  html body #mainApp header.header > #logoutBtn { display: none !important; }

  /* ── ردیف ۲ ── */
  html body #mainApp header.header > #modeSwitcher {
    grid-column: 1; grid-row: 2; justify-self: start;
    display: inline-flex !important; margin: 0 !important;
  }
  html body #mainApp header.header > #modeSwitcher .mode-btn { padding: 5px 10px !important; }
  /* داشبورد احساسات در هدر دیده نمی‌شود؛ با لمسِ لوگو یا نشانگرِ آبی باز می‌شود */
  html body #mainApp header.header .logo-mood-wrap > #moodBar,
  html body #mainApp header.header .logo-mood-wrap > #moodBar.hidden { display: none !important; }
  html body #mainApp header.header .logo-mood-wrap .logo {
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  html body #mainApp header.header .logo-mood-wrap .logo:active { opacity: 0.75; }
  /* ردیف دوم: مود و مدل در دو سر */
  html body #mainApp header.header > #providerDropdown {
    grid-column: 3; grid-row: 2; justify-self: end;
    flex: none !important; width: auto !important; max-width: none !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important;
    display: inline-flex !important;
  }
  html body #mainApp header.header > #providerDropdown .provider-dd-trigger {
    height: 32px; padding: 0 12px; font-size: 13px;
  }
  html body #mainApp header.header > #providerDropdown .provider-dd-menu { left: auto; right: 0; }

  html body #mainApp header.header > #identityBar,
  html body #mainApp header.header > #userEmailBadge { display: none !important; }

  /* عنوانِ گفتگو (نام هویت) — همان حالِ متنِ برجسته‌ی پیام‌ها */
  #chatPanelTitle {
    font-family: inherit !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: var(--gold-bright, #e9c979) !important;
    opacity: 1 !important;
  }

  /* میکروفونِ دیکته در موبایل حذف — گفتگوی صوتی با دکمه‌ی موج است */
  #chatMic, .chat-input .btn-mic { display: none !important; }

  /* ═══ منوی کشویی ═══ */
  .mobile-drawer-panel { width: min(340px, 88vw) !important; }
  .mobile-drawer-header { padding: 18px 20px 14px !important; }
  .mobile-drawer-title {
    font-size: 17px !important; letter-spacing: 0.02em !important;
    text-transform: none !important; font-weight: 600 !important;
    color: var(--gold-bright, #f4d893) !important;
  }
  .mobile-drawer-body {
    padding: 8px 20px 20px !important;
    gap: 8px !important;
    overflow-x: hidden !important;
  }
  .mobile-drawer-body > * { max-width: 100%; box-sizing: border-box; }

  /* عنوانِ هر بخش */
  .mobile-drawer-body .drawer-sec-label,
  .mobile-drawer-body .mode-switcher-label {
    font-size: 11px !important; font-weight: 600 !important;
    letter-spacing: 0.08em !important; text-transform: uppercase;
    color: var(--gold, #c9a961) !important; opacity: 0.75 !important;
    margin: 14px 2px 2px !important; padding: 0 !important;
  }
  .mobile-drawer-body > .drawer-sec-label:first-child { margin-top: 6px !important; }

  /* هویت + پروژه: دو کارتِ تمام‌عرض */
  .mobile-drawer-body #identityBar {
    display: flex !important; flex-direction: column !important;
    align-items: stretch !important; gap: 8px !important;
    width: 100% !important; overflow: visible !important; position: static !important;
  }
  .mobile-drawer-body #identityBar .hdr-center {
    position: static !important; transform: none !important;
    display: flex !important; flex-direction: column !important;
    align-items: stretch !important; gap: 8px !important; width: 100% !important;
  }
  .mobile-drawer-body .identity-display {
    width: 100% !important; box-sizing: border-box;
    flex-direction: row !important; align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 14px !important; border-radius: 12px !important;
  }
  .mobile-drawer-body .identity-display-value { font-size: 15px !important; }
  .mobile-drawer-body .goals-badge {
    width: 100% !important; max-width: none !important; margin: 0 !important;
    box-sizing: border-box; padding: 12px 14px !important; border-radius: 12px !important;
    font-size: 13px !important;
  }

  /* مود: فهرستِ تمام‌عرض */
  .mobile-drawer-body .mode-switcher,
  #mobileDrawer .mode-switcher {
    width: 100% !important; box-sizing: border-box !important;
    margin: 0 !important; padding: 6px !important;
    border: 1px solid rgba(244, 216, 147, 0.14) !important;
    background: rgba(244, 216, 147, 0.03) !important;
    border-radius: 14px !important; gap: 2px !important;
    flex-direction: column !important; align-items: stretch !important;
  }
  #mobileDrawer .mode-switcher .mode-btn {
    width: 100% !important; justify-content: flex-start !important;
    gap: 10px !important; padding: 11px 12px !important;
    border-radius: 10px !important; font-size: 15px !important;
  }
  #mobileDrawer .mode-switcher .mode-btn-label { margin: 0 !important; }

  /* ابزارها: فهرستِ برچسب‌دار به‌جای سه آیکونِ بی‌نام */
  .mobile-drawer-body .header-actions {
    display: flex !important; flex-direction: column !important;
    align-items: stretch !important; gap: 2px !important; width: 100% !important;
  }
  .mobile-drawer-body .header-actions .btn-icon {
    width: 100% !important; height: 46px !important;
    display: flex !important; align-items: center !important; justify-content: flex-start !important;
    gap: 12px !important; padding: 0 12px !important;
    border-radius: 10px !important; border: 0 !important;
    background: transparent !important; color: var(--ink-primary, #e8e2d6) !important;
    position: relative;
  }
  .mobile-drawer-body .header-actions .btn-icon:active { background: rgba(255,255,255,0.05) !important; }
  .mobile-drawer-body .header-actions .btn-icon svg { width: 20px !important; height: 20px !important; flex-shrink: 0; opacity: 0.8; }
  .mobile-drawer-body .header-actions .lock-badge {
    position: static !important; order: 3; margin-inline-start: auto; font-size: 12px;
  }
  .drawer-act-label { display: none; }
  .mobile-drawer-body .drawer-act-label { display: inline; font-size: 15px; }

  /* حساب */
  .mobile-drawer-body .user-email-badge {
    padding: 12px 14px !important; border-radius: 12px !important; font-size: 13px !important;
  }
}

/* ═══ نشانگرِ سلفا در گفتگو — کمی بزرگ‌تر، تپشِ روشن‌تر، قابل لمس ═══ */
.msg-content .selfa-logo.selfa-trailing-logo {
  display: block !important;
  width: 34px !important; height: 34px !important;
  margin: 14px 0 6px !important;
  padding: 5px; box-sizing: content-box;   /* ناحیه‌ی لمس ۴۴px */
  cursor: pointer;
  animation: selfa-beacon 1.8s ease-in-out infinite !important;
  -webkit-tap-highlight-color: transparent;
}
.msg-content .selfa-logo.selfa-inline-cursor {
  width: 26px !important; height: 26px !important;
  vertical-align: -7px;
  animation: selfa-beacon 1.1s ease-in-out infinite !important;
}
@keyframes selfa-beacon {
  0%, 100% { opacity: 0.55; transform: scale(0.94); filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.3)); }
  50%      { opacity: 1;    transform: scale(1.06); filter: drop-shadow(0 0 11px rgba(96, 165, 250, 0.85)); }
}
/* رنگِ نشانگر همیشه آبی، مستقل از حال‌وهوا */
.msg-content .selfa-logo.selfa-trailing-logo svg,
.msg-content .selfa-logo.selfa-inline-cursor svg,
.msg-content .selfa-logo[data-mood] svg {
  filter: hue-rotate(185deg) saturate(1.6) brightness(1.15) !important;
}
.msg-content .selfa-logo.selfa-trailing-logo:active { transform: scale(0.9); }
@media (prefers-reduced-motion: reduce) {
  .msg-content .selfa-logo.selfa-trailing-logo,
  .msg-content .selfa-logo.selfa-inline-cursor { animation: none !important; opacity: 1; }
}
