/**
 * FitRoniX — خطوط انرژی + کارت شیشه‌ای (هم‌سبک Cyber ادمین)
 * فقط وقتی .fxu-circuit-bg توسط user-tech-bg.js mount شده
 */

/* ─── پس‌زمینه پایه (خطوط از پشت ویجت‌ها دیده شوند) ─── */
html.fxu-circuit-on[data-user-panel-theme="fitronix"]:not([data-theme="dark"]) body.user-app,
html.fxu-circuit-on[data-user-panel-theme="firouzi"]:not([data-theme="dark"]) body.user-app {
  background: #f1f5f9 !important;
}

html.fxu-circuit-on[data-user-panel-theme="fitronix"][data-theme="dark"] body.user-app,
html.fxu-circuit-on[data-user-panel-theme="firouzi"][data-theme="dark"] body.user-app {
  background: #0f172a !important;
}

.shell-user:has(.fxu-circuit-bg) {
  --fxu-glass-blur: 16px;
  --fxu-glass-bg: rgba(255, 255, 255, 0.62);
  --fxu-glass-bg-strong: rgba(255, 255, 255, 0.78);
  --fxu-glass-border: rgba(15, 23, 42, 0.08);
  --fxu-nested-bg: rgba(241, 245, 249, 0.42);
  --fx-surface: var(--fxu-glass-bg);
  --card-bg: var(--fxu-glass-bg);
  --bg-elevated: var(--fxu-glass-bg-strong);
  --header-bg: var(--fxu-glass-bg-strong);
  --up-surface: var(--fxu-glass-bg);
  position: relative;
  isolation: isolate;
  background: transparent !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) {
  --fxu-glass-bg: color-mix(in srgb, #f1f5f9 7%, #0f172a 93%);
  --fxu-glass-bg-strong: color-mix(in srgb, #f1f5f9 9%, #0f172a 91%);
  --fxu-glass-border: color-mix(in srgb, #cbd5e1 20%, transparent);
  --fxu-nested-bg: color-mix(in srgb, #cbd5e1 10%, #0f172a);
}

html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) {
  --sf-card: var(--fxu-glass-bg-strong);
  --sf-surface-muted: rgba(255, 255, 255, 0.4);
}

html[data-user-panel-theme="firouzi"][data-theme="dark"] .shell-user:has(.fxu-circuit-bg) {
  --sf-card: var(--fxu-glass-bg-strong);
  --sf-surface-muted: rgba(255, 255, 255, 0.06);
}

/* ─── لایه خطوط — پشت همه چیز ─── */
.shell-user .fxu-circuit-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.shell-user .fxu-circuit-bg .fxu-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 40% at 88% 8%, rgba(37, 99, 235, 0.09), transparent 58%),
    radial-gradient(ellipse 45% 35% at 12% 92%, rgba(249, 115, 22, 0.06), transparent 55%);
  animation: fxu-glow-breathe 9s ease-in-out infinite;
}

html[data-theme="dark"] .shell-user .fxu-circuit-bg .fxu-bg-glow {
  background:
    radial-gradient(ellipse 55% 40% at 88% 8%, rgba(37, 99, 235, 0.14), transparent 58%),
    radial-gradient(ellipse 45% 35% at 12% 92%, rgba(249, 115, 22, 0.08), transparent 55%);
}

@keyframes fxu-glow-breathe {
  0%, 100% { opacity: 0.88; }
  50% { opacity: 1; }
}

.shell-user .fxu-circuit-bg .fxa-bg-circuit {
  position: absolute;
  inset: 0;
  opacity: 0.58;
}

html[data-theme="dark"] .shell-user .fxu-circuit-bg .fxa-bg-circuit {
  opacity: 0.5;
}

/* رنگ خطوط — پالت داشبورد */
html[data-user-panel-theme="fitronix"]:not([data-theme="dark"]) .shell-user .fxu-circuit-bg .fxa-circuit-lines {
  stroke: #2563eb;
  opacity: 0.72;
}

html[data-user-panel-theme="fitronix"][data-theme="dark"] .shell-user .fxu-circuit-bg .fxa-circuit-lines {
  stroke: #2563eb;
  opacity: 0.42;
}

html[data-user-panel-theme="fitronix"][data-theme="dark"] .shell-user .fxu-circuit-bg .fxa-circuit-node {
  fill: #2563eb;
  opacity: 0.45;
}

html[data-user-panel-theme="fitronix"][data-theme="dark"] .shell-user .fxu-circuit-bg .fxa-circuit-path {
  stroke-width: 1.3;
  opacity: 0.38;
}

html[data-user-panel-theme="fitronix"]:not([data-theme="dark"]) .shell-user .fxu-circuit-bg .fxa-circuit-node {
  fill: #2563eb;
  opacity: 0.7;
}

html[data-user-panel-theme="fitronix"]:not([data-theme="dark"]) .shell-user .fxu-circuit-bg .fxa-circuit-path {
  stroke-width: 1.4;
  opacity: 0.55;
}

/* ─── لایه‌های محتوا — شفاف تا خطوط دیده شوند ─── */
html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .sidebar-user-panel,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .sidebar-user-panel {
  /* fixed از main.css — relative سایدبار را به flex برمی‌گرداند و offset دوبل می‌شود */
  z-index: 2;
  background: var(--fxu-glass-bg-strong) !important;
  backdrop-filter: blur(var(--fxu-glass-blur));
  -webkit-backdrop-filter: blur(var(--fxu-glass-blur));
}

html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .main,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .main,
html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .main:has(#view-dashboard.active),
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .main:has(#view-dashboard.active),
html[data-user-panel-theme="fitronix"]:not([data-theme="dark"]) .shell-user:has(.fxu-circuit-bg) .main:has(#view-dashboard.active),
html[data-user-panel-theme="firouzi"]:not([data-theme="dark"]) .shell-user:has(.fxu-circuit-bg) .main:has(#view-dashboard.active) {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .main > .header,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .main > .header,
html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .main > .content,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .main > .content,
html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) #view-dashboard,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) #view-dashboard,
html[data-user-panel-theme="fitronix"] .shell-user:has(.fxu-circuit-bg) .view,
html[data-user-panel-theme="firouzi"] .shell-user:has(.fxu-circuit-bg) .view {
  background: transparent !important;
}

/* ─── سطح شیشه‌ای — ویجت‌های داشبورد v2 ─── */
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-standalone,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-score-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-panel-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-weekly-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-comp,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-programs-section,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-v3.fx-dash-greet,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-v3.up-dash-greet,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-ops-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-customize,
.shell-user:has(.fxu-circuit-bg) .up-w,
.shell-user:has(.fxu-circuit-bg) .view .card,
.shell-user:has(.fxu-circuit-bg) .view .up-w,
.shell-user:has(.fxu-circuit-bg) .fx-profile-card,
.shell-user:has(.fxu-circuit-bg) .fx-program-card,
.shell-user:has(.fxu-circuit-bg) .up-stat-board,
.shell-user:has(.fxu-circuit-bg) .up-zones-wrap,
.shell-user:has(.fxu-circuit-bg) button.dash-feature-widget,
.shell-user:has(.fxu-circuit-bg) .main > .header,
.shell-user:has(.fxu-circuit-bg) .up-header,
.shell-user:has(.fxu-circuit-bg) .up-mp-hero,
.shell-user:has(.fxu-circuit-bg) .up-sup-hero,
.shell-user:has(.fxu-circuit-bg) .up-sub-hero,
.shell-user:has(.fxu-circuit-bg) .up-po-hero,
.shell-user:has(.fxu-circuit-bg) .usp-hero,
.shell-user:has(.fxu-circuit-bg) .orders-hero,
.shell-user:has(.fxu-circuit-bg) .up-ex-hero,
.shell-user:has(.fxu-circuit-bg) .up-mp-stat,
.shell-user:has(.fxu-circuit-bg) .up-sup-kpi,
.shell-user:has(.fxu-circuit-bg) .up-inv-kpi,
.shell-user:has(.fxu-circuit-bg) .usp-kpi,
.shell-user:has(.fxu-circuit-bg) .up-np-kpi,
.shell-user:has(.fxu-circuit-bg) .up-mp-plan-card,
.shell-user:has(.fxu-circuit-bg) .up-wp-kpi,
.shell-user:has(.fxu-circuit-bg) .up-wp-day,
.shell-user:has(.fxu-circuit-bg) .up-wp-ex,
.shell-user:has(.fxu-circuit-bg) .up-ex-toolbar,
.shell-user:has(.fxu-circuit-bg) .up-quick-chip,
.shell-user:has(.fxu-circuit-bg) .up-program-card,
.shell-user:has(.fxu-circuit-bg) .up-vol-stat,
.shell-user:has(.fxu-circuit-bg) .fx-dash-row-shell,
.shell-user:has(.fxu-circuit-bg) .dash-ops-card,
.shell-user:has(.fxu-circuit-bg) .dash-ops-kpi,
.shell-user:has(.fxu-circuit-bg) .dash-ops-item {
  background: var(--fxu-glass-bg) !important;
  backdrop-filter: blur(var(--fxu-glass-blur));
  -webkit-backdrop-filter: blur(var(--fxu-glass-blur));
  border-color: var(--fxu-glass-border) !important;
}

/* امتیاز کل — گرادیان ملایم روی شیشه */
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-score-card--total {
  background:
    linear-gradient(160deg, rgba(239, 246, 255, 0.85) 0%, rgba(255, 255, 255, 0.58) 65%) !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-score-card--total {
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.12) 0%, rgba(22, 27, 39, 0.72) 65%) !important;
}

/* خوش‌آمدگویی */
.shell-user:has(.fxu-circuit-bg) .fx-dash-greet,
.shell-user:has(.fxu-circuit-bg) .fx-greet-v3.fx-dash-greet,
.shell-user:has(.fxu-circuit-bg) .fx-greet-v3.up-dash-greet {
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(37, 99, 235, 0.07), transparent 55%),
    var(--fxu-glass-bg-strong) !important;
  backdrop-filter: blur(var(--fxu-glass-blur));
  -webkit-backdrop-filter: blur(var(--fxu-glass-blur));
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .fx-dash-greet,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .fx-greet-v3.fx-dash-greet,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .fx-greet-v3.up-dash-greet {
  background:
    radial-gradient(ellipse 100% 70% at 0% 0%, rgba(249, 115, 22, 0.08), transparent 50%),
    var(--fxu-glass-bg-strong) !important;
}

/* بنر پرومو — گرادیان برند (خطوط از کنار دیده می‌شوند) */
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-dash[data-dash-sortable="fx-main"] > .fx-promo-banner,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-dash[data-dash-sortable="fx-main"] > [data-dash-sort-key="promo"],
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-promo-banner {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.96) 0%, rgba(37, 99, 235, 0.94) 45%, rgba(59, 130, 246, 0.96) 100%) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-dash[data-dash-sortable="fx-main"] > .fx-promo-banner,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-dash[data-dash-sortable="fx-main"] > [data-dash-sort-key="promo"],
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-promo-banner {
  background: linear-gradient(135deg, #0c1a36 0%, #0f2744 50%, #1a3a6e 100%) !important;
  border: 1px solid rgba(37, 99, 235, 0.28) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* المان‌های تو در تو — نیمه‌شفاف */
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-workout-kpi,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-nutrition-pills li,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-stats--pair li,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-recovery-tile,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-sleep-metric,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-macro,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-ops-tile,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-seg,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-workout-chart,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-chart-host,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-weekly-summary,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-weekly-chart,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-stat,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-tasks,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-program-card,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-quick-btn,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-monitor-row,
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-foot {
  background: var(--fxu-nested-bg) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* فوتر ویجت سلامت — کمی مات‌تر برای خوانایی */
.shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-foot {
  background: color-mix(in srgb, var(--fxu-glass-bg) 88%, transparent) !important;
}

/* ناوبار موبایل */
.shell-user:has(.fxu-circuit-bg) .up-bottom-nav {
  background: color-mix(in srgb, var(--fxu-glass-bg-strong) 94%, transparent) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .shell-user:has(.fxu-circuit-bg) {
    --fxu-glass-bg: rgba(255, 255, 255, 0.9);
    --fxu-glass-bg-strong: rgba(255, 255, 255, 0.95);
    --fxu-nested-bg: rgba(241, 245, 249, 0.85);
  }
  html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) {
    --fxu-glass-bg: rgba(30, 36, 51, 0.97);
    --fxu-glass-bg-strong: rgba(30, 36, 51, 0.99);
    --fxu-nested-bg: rgba(255, 255, 255, 0.08);
  }
}

/* ═══════════════════════════════════════════════════════════
   داشبورد تم تاریک — لایه نهایی (بالاترین اولویت)
═══════════════════════════════════════════════════════════ */
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-standalone,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-score-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-panel-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-weekly-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-comp,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-ops-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-programs-section,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-customize,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-dash[data-dash-sortable="fx-main"] > [data-dash-sort-key]:not([data-dash-sort-key="promo"]) {
  background: #1e2433 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-score-card--total {
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.16) 0%, #1e2433 68%) !important;
  border-color: rgba(37, 99, 235, 0.22) !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .fx-greet-v3.fx-dash-greet,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .fx-greet-v3.up-dash-greet {
  background:
    radial-gradient(ellipse 100% 70% at 100% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    #1e2433 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) .main > .header {
  background: rgba(30, 36, 51, 0.98) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-workout-kpi,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-nutrition-pills li,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-stats--pair li,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-recovery-tile,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-sleep-metric,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-macro,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-ops-tile,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-body-seg,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-stat,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-greet-tasks,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-program-card,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-quick-btn,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-monitor-row,
html[data-theme="dark"] .shell-user:has(.fxu-circuit-bg) #view-dashboard .fx-hw-foot {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
}

@media (prefers-reduced-motion: reduce) {
  .shell-user .fxu-circuit-bg .fxa-circuit-path,
  .shell-user .fxu-circuit-bg .fxa-circuit-node,
  .shell-user .fxu-circuit-bg .fxu-bg-glow {
    animation: none !important;
  }
}

/* خرید پلن — خلاصه سفارش خوانا روی پس‌زمینه شیشه‌ای */
.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-summary-card {
  background: #ffffff !important;
  border-color: #e4e9ef !important;
  color: #263238 !important;
}

.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-summary-card .card-head h3,
.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-summary-card .k,
.shell-user:has(.fxu-circuit-bg) #view-plan-order .plan-order-summary-item .k,
.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-sum-total .k {
  color: #546e7a !important;
}

.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-summary-card .v,
.shell-user:has(.fxu-circuit-bg) #view-plan-order .plan-order-summary-item .v {
  color: #263238 !important;
}

.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-summary-hint {
  color: #546e7a !important;
}

.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-sum-total {
  background: rgba(249, 115, 22, 0.1) !important;
}

.shell-user:has(.fxu-circuit-bg) #view-plan-order .up-po-sum-total .v {
  color: #ea580c !important;
}
