/* §۲۷ بخش ۴: منوی بالای صفحهٔ یک دقیقاً مثل منوی بالای صفحهٔ دو.
   این فایل فقط سلکتورهای صفحهٔ یک (.nav-pills / .nav-pill / .nav-icon) را به توکن‌های menu-3d-shared.css وصل می‌کند.
   منطق منو، ورود (دکمهٔ نئونی) و جلوهٔ لوگو دست نخورده‌اند. حرکت‌ها فقط transform و opacity. باید بعد از styles.css و فایل‌های حرکتی بیاید. */

/* رنگ آیکن هر گزینه به ترتیب منو */
.topbar .nav-pills .nav-pill { --c1: var(--m3-blue); --c2: var(--m3-blue-l); }
.topbar .nav-pills .nav-pill:nth-child(1) { --c1: var(--m3-cyan); --c2: var(--m3-cyan-l); }     /* داشبورد */
.topbar .nav-pills .nav-pill:nth-child(2) { --c1: var(--m3-blue); --c2: var(--m3-blue-l); }     /* بودجه */
.topbar .nav-pills .nav-pill:nth-child(3) { --c1: var(--m3-orange); --c2: var(--m3-orange-l); } /* گزارش‌ها */
.topbar .nav-pills .nav-pill:nth-child(4) { --c1: var(--m3-violet); --c2: var(--m3-violet-l); } /* تحلیل و پیش‌بینی */
.topbar .nav-pills .nav-pill:nth-child(5) { --c1: var(--m3-coral); --c2: var(--m3-coral-l); }   /* مدیران و کاربران */
.topbar .nav-pills .nav-pill:nth-child(6) { --c1: var(--m3-green); --c2: var(--m3-green-l); }   /* منبع تخصیص اعتبار */
.topbar .nav-pills .nav-pill:nth-child(7) { --c1: var(--m3-indigo); --c2: var(--m3-indigo-l); } /* تنظیمات */

/* نوار شیشه‌ای روشن */
.topbar .nav-pills {
  gap: .5rem; padding: .65rem; border-radius: 1.35rem; color: var(--m3-ink);
  background: var(--m3-plate-bg); border: 1px solid #fff; box-shadow: var(--m3-plate-shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
}

/* کارت برجستهٔ روشن (همان کارت منوی بالای صفحهٔ دو) */
.topbar .nav-pills .nav-pill {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: flex-start; white-space: nowrap;
  min-height: 3.6rem; padding: .45rem .5rem; gap: .45rem; border-radius: 1rem;
  font-size: .9rem; line-height: 1.65; font-weight: 700; font-synthesis: weight;
  color: var(--m3-ink); text-shadow: none;
  background: var(--m3-card-bg); border: 1px solid var(--m3-card-edge);
  box-shadow: var(--m3-top-shadow); outline: none;
  transform: translateY(0); transition: transform 150ms cubic-bezier(.3, .7, .3, 1);
}
/* لایهٔ فرورفته + نوار رنگی پایین کارت فعال */
.topbar .nav-pills .nav-pill::after {
  content: ''; position: absolute; z-index: -1; inset: 0; right: auto; bottom: auto; width: auto; height: auto;
  inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, var(--c2), var(--c1)) 50% calc(100% - 3px) / 44% 3px no-repeat,
    radial-gradient(120% 90% at 50% 130%, color-mix(in srgb, var(--c2) 26%, transparent), transparent 62%), var(--m3-press-bg);
  box-shadow: inset 5px 6px 12px rgb(70 102 156 / 38%), inset -3px -3px 8px rgb(255 255 255 / 90%), inset 0 0 0 1.5px color-mix(in srgb, var(--c1) 60%, transparent);
  opacity: 0; transform: none; animation: none; transition: opacity 200ms ease;
}
/* برق آینه‌ای مورب (همان برق صفحهٔ دو) */
.topbar .nav-pills .nav-pill::before {
  content: ''; position: absolute; z-index: 3; inset: -20% auto -20% 0; width: 45%; border-radius: 0; pointer-events: none; box-shadow: none;
  background: var(--m3-sweep);
  opacity: 0; transform: translateX(-120%) skewX(-18deg); transition: none;
}
@media (prefers-reduced-motion: no-preference) {
  .topbar .nav-pills .nav-pill::before { animation: bp-m3-mirror 3s ease-in-out infinite; animation-delay: calc(var(--m3-order, 0) * 90ms); }
}
.topbar .nav-pills .nav-pill:nth-child(2) { --m3-order: 1; }
.topbar .nav-pills .nav-pill:nth-child(3) { --m3-order: 2; }
.topbar .nav-pills .nav-pill:nth-child(4) { --m3-order: 3; }
.topbar .nav-pills .nav-pill:nth-child(5) { --m3-order: 4; }
.topbar .nav-pills .nav-pill:nth-child(6) { --m3-order: 5; }
.topbar .nav-pills .nav-pill:nth-child(7) { --m3-order: 6; }
.motion-paused .topbar .nav-pills .nav-pill::before { animation: none; }

/* هاور، فشار و حالت فعال: فقط transform؛ سایه‌ها ثابت */
.topbar .nav-pills .nav-pill:is(:hover, :focus-visible) {
  color: var(--m3-ink); background: var(--m3-card-bg); border-color: var(--m3-card-edge); box-shadow: var(--m3-top-shadow); transform: translateY(-3px);
}
.topbar .nav-pills .nav-pill:focus-visible { outline: 2px solid #1d5fd1; outline-offset: 3px; }
.topbar .nav-pills .nav-pill:active { transform: translateY(4px) scale(.97); transition-duration: 70ms; }
.topbar .nav-pills .nav-pill.active, .topbar .nav-pills .nav-pill.active:is(:hover, :focus-visible) {
  color: var(--m3-ink); background: var(--m3-card-bg); border-color: var(--m3-card-edge); box-shadow: var(--m3-flat-shadow); transform: translateY(4px);
}
.topbar .nav-pills .nav-pill.active::after { opacity: 1; }

/* آیکن رنگی سه‌بعدی */
.topbar .nav-pills .nav-icon {
  position: relative; display: grid; place-items: center; flex: 0 0 2.05rem; width: 2.05rem; height: 2.05rem; border-radius: .65rem;
  color: #fff; font-size: 1rem; filter: none; border: 0;
  background: linear-gradient(165deg, var(--c2) 0%, var(--c1) 70%, color-mix(in srgb, var(--c1) 82%, #0b2a63) 100%);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 60%), inset 0 -3px 5px rgb(0 0 0 / 16%), 0 6px 12px -4px color-mix(in srgb, var(--c1) 60%, transparent);
  transform: none; transition: transform 180ms cubic-bezier(.2, .8, .2, 1.2);
}
.topbar .nav-pills .nav-icon::after {
  content: ''; position: absolute; inset: 2px 3px 52%; border-radius: .5rem .5rem 45% 45% / .5rem .5rem 35% 35%;
  background: var(--m3-gloss); pointer-events: none;
}
.topbar .nav-pills .nav-icon .ui-icon { position: relative; z-index: 1; width: 1.15rem; height: 1.15rem; color: #fff; stroke: currentColor; fill: none; stroke-width: 1.9; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 22%)); }
.topbar .nav-pills .nav-pill:is(:hover, :focus-visible) .nav-icon { color: #fff; filter: none; transform: rotate(-6deg) scale(1.06); }

/* عرض نوار: کارت‌ها یک‌خطی در فاصلهٔ میان ساعت و لوگو */
@media (min-width: 1101px) {
  .topbar .nav-pills { width: auto; max-width: calc(100vw - 370px); flex-wrap: nowrap; justify-content: center; }
}
@media (min-width: 1101px) and (max-width: 1360px) {
  .topbar .nav-pills { gap: .35rem; padding: .5rem; }
  .topbar .nav-pills .nav-pill { min-height: 3.2rem; padding: .35rem .4rem; gap: .35rem; font-size: .8rem; }
  .topbar .nav-pills .nav-icon { flex-basis: 1.8rem; width: 1.8rem; height: 1.8rem; }
  .topbar .nav-pills .nav-icon .ui-icon { width: 1rem; height: 1rem; }
}
/* عرض‌های کمتر (و تبلت): همان کارت‌ها، فشرده‌تر */
@media (max-width: 1240px) {
  .topbar .nav-pills { gap: .28rem; padding: .42rem; }
  .topbar .nav-pills .nav-pill { min-height: 3rem; padding: .3rem .32rem; gap: .28rem; font-size: .74rem; }
  .topbar .nav-pills .nav-icon { flex-basis: 1.6rem; width: 1.6rem; height: 1.6rem; border-radius: .55rem; }
  .topbar .nav-pills .nav-icon .ui-icon { width: .92rem; height: .92rem; }
}
@media (max-width: 1100px) {
  .topbar .nav-pills { flex-wrap: wrap; justify-content: center; }
}
/* موبایل: مثل سایت فقط آیکن، وسط کارت */
@media (max-width: 720px) {
  .topbar .nav-pills .nav-pill { justify-content: center; min-height: 3.2rem; }
}

/* کاهش حرکت: بدون برق آینه‌ای و بدون جابه‌جایی هاور/فشار */
@media (prefers-reduced-motion: reduce) {
  .topbar .nav-pills .nav-pill::before { animation: none !important; opacity: 0; }
  .topbar .nav-pills .nav-pill:is(:hover, :focus-visible, :active), .topbar .nav-pills .nav-pill:is(:hover, :focus-visible) .nav-icon { transform: none; }
}
