/* Ahan Dark Mode Fix - CSS
   هدف: خوانا کردن .ftwp-text و #tmc-panel در حالت شب.
   ما روی چند الگوی رایج حالت شب هدف‌گیری می‌کنیم: 
   html.dark, body.dark, body.dark-mode, .wp-dark-mode-active, [data-theme="dark"], .is-dark-mode
   و در صورت تشخیص خودکار JS، کلاس html.ai-dark هم فعال می‌شود. */

:root {
  --adf-d-bg: #111214;
  --adf-d-surface: #15171a;
  --adf-d-text: #e8e9ee;
  --adf-d-muted: #c8ccd2;
  --adf-d-border: #2a2e34;
  --adf-d-hover: #1d2024;
  --adf-focus: 0 0 0 3px rgba(100, 150, 250, 0.35);
}

/* --- .ftwp-text --- */
html.ai-dark .ftwp-text,
html.dark .ftwp-text,
body.dark .ftwp-text,
body.dark-mode .ftwp-text,
.wp-dark-mode-active .ftwp-text,
[data-theme="dark"] .ftwp-text,
.is-dark-mode .ftwp-text {
  color: var(--adf-d-text) !important;
  text-shadow: none !important;
}

/* --- #tmc-panel & children --- */
html.ai-dark #tmc-panel .tmc-card,
html.dark #tmc-panel .tmc-card,
body.dark #tmc-panel .tmc-card,
body.dark-mode #tmc-panel .tmc-card,
.wp-dark-mode-active #tmc-panel .tmc-card,
[data-theme="dark"] #tmc-panel .tmc-card,
.is-dark-mode #tmc-panel .tmc-card {
  background: var(--adf-d-surface) !important;
  color: var(--adf-d-text) !important;
  border: 1px solid var(--adf-d-border) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45) !important;
}

html.ai-dark #tmc-panel .tmc-title,
html.dark #tmc-panel .tmc-title,
body.dark #tmc-panel .tmc-title,
body.dark-mode #tmc-panel .tmc-title,
.wp-dark-mode-active #tmc-panel .tmc-title,
[data-theme="dark"] #tmc-panel .tmc-title,
.is-dark-mode #tmc-panel .tmc-title {
  color: var(--adf-d-text) !important;
  border-bottom: 1px solid var(--adf-d-border) !important;
}

/* لینک‌ها و آیکن‌ها رنگ را از والد می‌گیرند (currentColor) */
html.ai-dark #tmc-panel .tmc-item,
html.dark #tmc-panel .tmc-item,
body.dark #tmc-panel .tmc-item,
body.dark-mode #tmc-panel .tmc-item,
.wp-dark-mode-active #tmc-panel .tmc-item,
[data-theme="dark"] #tmc-panel .tmc-item,
.is-dark-mode #tmc-panel .tmc-item {
  color: var(--adf-d-text) !important;
  background: transparent !important;
  border-color: var(--adf-d-border) !important;
}

html.ai-dark #tmc-panel .tmc-item:hover,
html.dark #tmc-panel .tmc-item:hover,
body.dark #tmc-panel .tmc-item:hover,
body.dark-mode #tmc-panel .tmc-item:hover,
.wp-dark-mode-active #tmc-panel .tmc-item:hover,
[data-theme="dark"] #tmc-panel .tmc-item:hover,
.is-dark-mode #tmc-panel .tmc-item:hover {
  background: var(--adf-d-hover) !important;
}

/* دکمه بستن */
html.ai-dark #tmc-panel .tmc-close,
html.dark #tmc-panel .tmc-close,
body.dark #tmc-panel .tmc-close,
body.dark-mode #tmc-panel .tmc-close,
.wp-dark-mode-active #tmc-panel .tmc-close,
[data-theme="dark"] #tmc-panel .tmc-close,
.is-dark-mode #tmc-panel .tmc-close {
  color: var(--adf-d-text) !important;
  background: transparent !important;
  border: 1px solid var(--adf-d-border) !important;
}
html.ai-dark #tmc-panel .tmc-close:focus {
  outline: none !important;
  box-shadow: var(--adf-focus);
}

/* اطمینان از خوانایی متن داخل spanهای بدون رنگ */
html.ai-dark #tmc-panel span,
html.dark #tmc-panel span,
body.dark #tmc-panel span,
body.dark-mode #tmc-panel span,
.wp-dark-mode-active #tmc-panel span,
[data-theme="dark"] #tmc-panel span,
.is-dark-mode #tmc-panel span {
  color: var(--adf-d-text) !important;
}

/* اگر svgها از currentColor استفاده می‌کنند، نیازی به فیلتر نیست.
   اما برای svgهای خارجی/تصویری می‌توان در صورت نیاز invert کرد. */
html.ai-dark #tmc-panel svg,
html.dark #tmc-panel svg,
body.dark #tmc-panel svg,
body.dark-mode #tmc-panel svg,
.wp-dark-mode-active #tmc-panel svg,
[data-theme="dark"] #tmc-panel svg,
.is-dark-mode #tmc-panel svg {
  stroke: currentColor !important;
  fill: none;
}

/* حالت فوکوس برای دسترس‌پذیری بهتر */
#tmc-panel a:focus,
#tmc-panel button:focus {
  outline: none !important;
  box-shadow: var(--adf-focus);
}

/* --- Chip fix for .ftwp-text when underlying bg is light in dark mode --- */
html.ai-dark .ftwp-text.adf-chip,
html.dark .ftwp-text.adf-chip,
body.dark .ftwp-text.adf-chip,
body.dark-mode .ftwp-text.adf-chip,
.wp-dark-mode-active .ftwp-text.adf-chip,
[data-theme="dark"] .ftwp-text.adf-chip,
.is-dark-mode .ftwp-text.adf-chip {
  background: var(--adf-d-surface) !important;
  color: var(--adf-d-text) !important;
  padding: .12em .35em !important;
  border-radius: .3em !important;
  box-shadow: 0 0 0 1px var(--adf-d-border) inset;
}

/* Try to neutralize explicit white backgrounds on the span itself */
html.ai-dark .ftwp-text,
html.dark .ftwp-text,
body.dark .ftwp-text,
body.dark-mode .ftwp-text,
.wp-dark-mode-active .ftwp-text,
[data-theme="dark"] .ftwp-text,
.is-dark-mode .ftwp-text {
  background-color: transparent !important;
}

/* --- .tmcpt-title readability in dark mode --- */
html.ai-dark .tmcpt-title,
html.dark .tmcpt-title,
body.dark .tmcpt-title,
body.dark-mode .tmcpt-title,
.wp-dark-mode-active .tmcpt-title,
[data-theme="dark"] .tmcpt-title,
.is-dark-mode .tmcpt-title {
  color: var(--adf-d-text) !important;
  background: transparent !important;
  text-shadow: none !important;
}

/* Chip style is generic now for any selector we mark as adf-chip */
html.ai-dark .adf-chip,
html.dark .adf-chip,
body.dark .adf-chip,
body.dark-mode .adf-chip,
.wp-dark-mode-active .adf-chip,
[data-theme="dark"] .adf-chip,
.is-dark-mode .adf-chip {
  background: var(--adf-d-surface) !important;
  color: var(--adf-d-text) !important;
  padding: .12em .35em !important;
  border-radius: .3em !important;
  box-shadow: 0 0 0 1px var(--adf-d-border) inset;
}

/* Force-ink for inline-colored text (e.g., p style="color:#555") in dark mode */
html.ai-dark .adf-ink,
html.dark .adf-ink,
body.dark .adf-ink,
body.dark-mode .adf-ink,
.wp-dark-mode-active .adf-ink,
[data-theme="dark"] .adf-ink,
.is-dark-mode .adf-ink {
  color: var(--adf-d-text) !important;
  background: transparent !important;
}

/* As a pragmatic safety net, target common grey inline colors directly */
html.ai-dark p[style*="color:#555"],
html.ai-dark p[style*="color: #555"],
html.dark p[style*="color:#555"],
html.dark p[style*="color: #555"],
body.dark p[style*="color:#555"],
body.dark p[style*="color: #555"],
.wp-dark-mode-active p[style*="color:#555"],
.wp-dark-mode-active p[style*="color: #555"],
[data-theme="dark"] p[style*="color:#555"],
[data-theme="dark"] p[style*="color: #555"],
.is-dark-mode p[style*="color:#555"],
.is-dark-mode p[style*="color: #555"] {
  color: var(--adf-d-text) !important;
}


/* === Night Mode Overrides v1.3.5 === */
/* ftwp list anchors */
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] #ftwp-list .ftwp-anchor,
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] .ftwp-list-nest .ftwp-anchor {
  color: #000000 !important;
  fill: #000000 !important;
  stroke: #000000 !important;
  opacity: 0.95 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] #ftwp-list .ftwp-anchor .ftwp-text,
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] .ftwp-list-nest .ftwp-anchor .ftwp-text {
  color: #000000 !important;
}
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] #ftwp-list .ftwp-anchor:hover,
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] #ftwp-list .ftwp-anchor:focus {
  opacity: 1 !important;
  color: #111111 !important;
  fill: #111111 !important;
  stroke: #111111 !important;
}
html.ai-dark, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"] #ftwp-list .ftwp-anchor:visited {
  color: #000000 !important;
}



/* === ADF inline-background paragraph guard v1.4.3 === */
html.ai-dark, html.ai-dark-by-clock, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"], .is-dark-mode [style*="background"] p,
html.ai-dark, html.ai-dark-by-clock, html.dark, html.dark-mode, body.dark, body.dark-mode, .dark-mode, .night-mode, .theme-dark, .wp-dark-mode-active, html[data-theme="dark"], [data-theme="dark"], .is-dark-mode [style*="background-color"] p {
  color: #111 !important;
  text-shadow: none !important;
  mix-blend-mode: normal !important;
  filter: none !important;
}

