/* menu-styles.css - نسخه حرفه‌ای با زیرمنوهای نرم */
/* ========== VARIABLES ========== */
:root {
  --menu-delay-step: 0.08s;
  --menu-duration: 0.5s;
  --item-offset: 20px;
  --color-primary: #1a5f8a;
  --color-secondary: #ff8e53;
  --color-dark: #1a1a1a;
  --color-light: #ffffff;
}

/* ========== منو - همبرگر (استانداردسازی شده) ========== */
.hamburger-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.85) 100%);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.12),
    0 3px 10px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 1.1s cubic-bezier(0.45, 0.05, 0.15, 1);
  gap: 10px;
  transform-origin: center;
}

.hamburger-container::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, 
    var(--color-primary) 0%,
    var(--color-secondary) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.hamburger-container:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 
    0 12px 35px rgba(0, 0, 0, 0.15),
    0 5px 15px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hamburger-container:hover::before {
  opacity: 0.1;
}

.hamburger-container:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* دسکتاپ: دکمه دقیقاً به منو می‌چسبد */
.hamburger-container.active {
  right: 380px; /* عرض منو در دسکتاپ */
  transform: translateX(0) translateY(0);
  margin-right: -1px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  background: rgba(255, 255, 255, 0.98);
  border-right: none;
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.12),
    0 3px 10px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* اضافه کردن خط جداسازی ظریف */
.hamburger-container.active::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 20%;
  height: 60%;
  width: 1px;
  background: linear-gradient(to bottom, 
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%);
  z-index: 1;
}

.hamburger {
  width: 28px;
  height: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transform-origin: center;
}

.line {
  width: 22px;
  height: 2.5px;
  background: linear-gradient(90deg, 
    #333 0%,
    #555 50%,
    #333 100%);
  border-radius: 2px;
  transition: all 1.1s cubic-bezier(0.45, 0.05, 0.15, 1);
  transform-origin: center;
}

.line:nth-child(1) { transform-origin: top left; }
.line:nth-child(3) { transform-origin: bottom left; }

.hamburger:hover .line {
  background: linear-gradient(90deg, 
    var(--color-primary) 0%,
    var(--color-secondary) 100%);
}

.hamburger.active .line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 4px);
  background: var(--color-primary);
  width: 22px;
}

.hamburger.active .line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.active .line:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
  background: var(--color-primary);
  width: 22px;
}

.menu-text {
  font-weight: 600;
  color: #333;
  font-size: 15px;
  margin-right: 8px;
  position: relative;
  z-index: 2;
  letter-spacing: -0.3px;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hamburger-container:hover .menu-text {
  color: var(--color-primary);
  transform: translateX(-2px);
}

/* ========== Overlay — فقط تیرگی ملایم (بدون بلور؛ بلور مخصوص پنل منوست) ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.45, 0.05, 0.15, 1);
  z-index: 1998;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ========== منوی کشویی — سبک Rolls-Royce ========== */
.sideMenu {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  height: 100dvh;
  /* پس‌زمینهٔ تقریباً مات تا منو در همهٔ صفحات یکسان دیده شود (مستقل از محتوای پشت) */
  background: rgba(13, 17, 25, 0.95);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  transition: transform 1.1s cubic-bezier(0.45, 0.05, 0.15, 1);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1999;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.sideMenu.active {
  transform: translateX(0);
}

/* هدر منو — مینیمال با حروف فاصله‌دار */
.menu-header {
  padding: 48px 36px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  position: relative;
  background: none;
}

.menu-header h2 {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
  letter-spacing: 4px;
}

/* محتوای منو */
.menu-content {
  padding: 25px 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* ========== آیتم‌های منو ========== */
.menuItem {
  position: relative;
  border: none;
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.45s cubic-bezier(0.45, 0.05, 0.15, 1),
              transform 0.45s cubic-bezier(0.45, 0.05, 0.15, 1);
  /* تأخیر هر آیتم از JS با --mi-delay ست می‌شه */
  transition-delay: var(--mi-delay, 0ms);
  will-change: transform, opacity;
}

/* وقتی sideMenu کلاس items-visible می‌گیره، همه آیتم‌ها با تأخیر خودشون میان */
.sideMenu.items-visible .menuItem {
  opacity: 1;
  transform: translateX(0);
}

/* افکت نور پس‌زمینه برای آیتم‌ها */
.menuItem::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(26, 95, 138, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.menuItem:hover::before {
  opacity: 1;
}

/* لینک‌ها و دکمه‌های منو — تایپوگرافی سبک و لوکس */
.menu-link,
.menu-toggle {
  display: flex;
  align-items: center;
  padding: 18px 36px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 300;
  transition: color 0.6s ease;
  cursor: pointer;
  gap: 14px;
  width: 100%;
  text-align: right;
  border: none;
  background: none;
  font-family: inherit;
  position: relative;
  z-index: 1;
  letter-spacing: 0;
}

.menu-link:focus,
.menu-toggle:focus {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

/* underline متحرک — خط نازک زیر متن که از راست رشد می‌کنه */
.menu-link span.link-text,
.menu-link,
.menu-toggle {
  position: relative;
}

.menu-link::after,
.menu-toggle::after {
  content: '';
  position: absolute;
  bottom: 12px;
  right: 36px;
  width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.85);
  transition: width 0.7s cubic-bezier(0.45, 0.05, 0.15, 1);
}

.menu-link:hover::after {
  width: calc(100% - 72px);
}

.menu-link:hover,
.menu-toggle:hover {
  color: #fff;
}

/* آیکون‌ها — کوچیک و محو، فقط نشانه */
.menu-link i,
.menu-toggle i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.3);
  transition: color 0.6s ease;
}

.menu-link:hover i,
.menu-toggle:hover i {
  color: rgba(255, 255, 255, 0.7);
}

/* آیکون زیرمنو */
.submenu-icon {
  margin-right: auto;
  margin-left: 10px;
  transition: transform 0.7s cubic-bezier(0.45, 0.05, 0.15, 1), opacity 0.5s ease;
  font-size: 12px;
  opacity: 0.45;
  transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .submenu-icon {
  transform: rotate(180deg);
  opacity: 0.9;
}

/* دکمه‌های زیرمنو در حالت باز */
.menu-toggle[aria-expanded="true"] {
  color: #fff;
  background: none;
  box-shadow: none;
}

.menu-toggle[aria-expanded="true"] i:first-child {
  color: rgba(255, 255, 255, 0.7);
}

/* ========== زیرمنوها — مینیمال و آروم ========== */
.submenu {
  overflow: hidden;
  background: none;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.9s cubic-bezier(0.45, 0.05, 0.15, 1),
              opacity 0.8s ease;
  position: relative;
  z-index: 0;
  will-change: opacity, max-height;
}

.submenu[aria-hidden="false"] {
  max-height: 900px;
  opacity: 1;
}

/* آیتم‌های زیرمنو */
.submenu-item {
  padding: 9px 64px 9px 36px;
  border: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.45, 0.05, 0.15, 1);
  position: relative;
  will-change: transform, opacity;
}

.submenu[aria-hidden="false"] .submenu-item {
  opacity: 1;
  transform: translateY(0);
}

/* تأخیر پلکانی */
.submenu-item:nth-child(1) { transition-delay: 0.08s; }
.submenu-item:nth-child(2) { transition-delay: 0.16s; }
.submenu-item:nth-child(3) { transition-delay: 0.24s; }
.submenu-item:nth-child(4) { transition-delay: 0.32s; }
.submenu-item:nth-child(5) { transition-delay: 0.40s; }
.submenu-item:nth-child(6) { transition-delay: 0.48s; }

/* لینک‌های زیرمنو — کم‌رنگ، hover روشن */
.submenu-item a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-block;
  transition: color 0.55s ease;
  position: relative;
  font-weight: 300;
}

.submenu-item a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
  transition: width 0.6s cubic-bezier(0.45, 0.05, 0.15, 1);
}

.submenu-item a:hover {
  color: #fff;
}

.submenu-item a:hover::after {
  width: 100%;
}

.submenu-item a:focus {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: 3px;
  border-radius: 2px;
}

/* فوتر منو */
.menu-footer {
  padding: 30px 25px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
  background: linear-gradient(180deg, 
    transparent 0%,
    rgba(0, 0, 0, 0.3) 100%);
  position: relative;
}

.menu-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(26, 95, 138, 0.3) 50%,
    transparent 100%);
}

.menu-logo {
  max-width: 170px;
  height: auto;
  opacity: 0.9;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: 
    drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4))
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  transform-origin: center;
}

.menu-logo:hover {
  opacity: 1;
  transform: scale(1.08) translateY(-3px);
  filter: 
    drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 20px rgba(26, 95, 138, 0.4));
}

/* حذف هرگونه متن اضافی زیر لوگو — فقط لوگو نمایش داده شود */
.menu-logo::after {
  display: none !important;
}

.menu-footer > *:not(.menu-logo) {
  display: none !important;
}

/* ========== نوار پیشرفت اسکرول ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, 
    var(--color-primary) 0%,
    var(--color-secondary) 50%,
    var(--color-primary) 100%);
  z-index: 2001;
  width: 0%;
  transition: width 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 
    0 2px 12px rgba(26, 95, 138, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.3);
  transform-origin: right;
}

/* ========== دکمه بازگشت به بالا ========== */
.scroll-top {
  position: fixed;
  bottom: 40px;
  left: 40px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, 
    var(--color-primary) 0%,
    var(--color-secondary) 100%);
  color: white;
  border: none;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.8) rotate(180deg);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1999;
  box-shadow: 
    0 8px 30px rgba(26, 95, 138, 0.4),
    0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.scroll-top::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.15) 0%,
    transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scroll-top::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 16px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1) rotate(0);
}

.scroll-top:hover {
  transform: translateY(-8px) scale(1.08) rotate(5deg);
  box-shadow: 
    0 15px 40px rgba(26, 95, 138, 0.6),
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.scroll-top:hover::before,
.scroll-top:hover::after {
  opacity: 1;
}

.scroll-top:active {
  transform: translateY(-4px) scale(0.98) rotate(-5deg);
  transition-duration: 0.1s;
}

/* ========== ریسپانسیو ========== */
@media (max-width: 992px) {
  .hamburger-container {
    top: 18px;
    right: 18px;
    padding: 9px 13px;
  }
  
  .sideMenu {
    width: 320px;
  }
  
  .hamburger-container.active {
    right: 320px;
    transform: translateX(0) translateY(0);
    margin-right: -1px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
  }
  
  .hamburger-container.active::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 20%;
    height: 60%;
    width: 1px;
    background: linear-gradient(to bottom, 
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
    z-index: 1;
  }
}

@media (max-width: 768px) {
  .hamburger-container {
    top: 15px;
    right: 15px;
    padding: 8px 12px;
    border-radius: 11px;
  }
  
  .hamburger {
    width: 26px;
    height: 18px;
  }
  
  .line {
    width: 20px;
    height: 2.3px;
  }
  
  .hamburger.active .line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 3px);
  }
  
  .hamburger.active .line:nth-child(3) {
    transform: rotate(-45deg) translate(3px, -3px);
  }
  
  .menu-text {
    font-size: 14px;
    margin-right: 6px;
  }
  
  .sideMenu {
    width: min(300px, 85vw);
    height: 100vh;
    height: 100dvh;
  }

  .hamburger-container.active {
    right: min(300px, 85vw);
    transform: translateX(0) translateY(0);
    margin-right: -1px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 12px;
    border-right: none;
  }
  
  .hamburger-container.active::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 20%;
    height: 60%;
    width: 1px;
    background: linear-gradient(to bottom, 
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
    z-index: 1;
  }
  
  .menu-header {
    padding: 28px 25px;
  }
  
  .menu-header h2 {
    font-size: 1.4rem;
  }
  
  .menu-link,
  .menu-toggle {
    padding: 18px 25px;
    font-size: 15px;
    gap: 14px;
  }
  
  .menu-link i,
  .menu-toggle i {
    font-size: 17px;
  }
  
  .submenu-item {
    padding: 12px 45px 12px 35px;
  }
  
  .submenu-item a {
    font-size: 14px;
  }
  
  .submenu-item a:hover {
    padding-right: 24px;
  }
  
  .scroll-top {
    width: 56px;
    height: 56px;
    bottom: 30px;
    left: 30px;
    font-size: 1.3rem;
  }
}

@media (max-width: 576px) {
  .hamburger-container {
    top: 12px;
    right: 12px;
    padding: 7px 10px;
    border-radius: 10px;
  }
  
  .menu-text {
    display: none;
  }
  
  .hamburger {
    width: 24px;
    height: 16px;
  }
  
  .line {
    width: 18px;
    height: 2px;
  }
  
  .hamburger.active .line:nth-child(1) {
    transform: rotate(45deg) translate(3px, 2.5px);
  }
  
  .hamburger.active .line:nth-child(3) {
    transform: rotate(-45deg) translate(2.5px, -2.5px);
  }
  
  .sideMenu {
    width: min(300px, 82vw);
    height: 100vh;
    height: 100dvh;
  }

  .hamburger-container.active {
    right: min(300px, 82vw);
    transform: translateX(0) translateY(0);
    margin-right: -1px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 10px;
    border-right: none;
  }
  
  .hamburger-container.active::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 20%;
    height: 60%;
    width: 1px;
    background: linear-gradient(to bottom, 
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
    z-index: 1;
  }
  
  .menu-header {
    padding: 25px 20px;
  }
  
  .menu-header h2 {
    font-size: 1.3rem;
  }
  
  .menu-link,
  .menu-toggle {
    font-size: 14.5px;
    padding: 16px 22px;
    gap: 12px;
  }
  
  .menu-link i,
  .menu-toggle i {
    font-size: 16px;
  }
  
  .submenu-item {
    padding: 10px 40px 10px 30px;
  }
  
  .submenu-item a {
    font-size: 13.5px;
  }
  
  .submenu-item a:hover {
    padding-right: 20px;
    transform: translateX(-4px);
  }
  
  .scroll-top {
    width: 52px;
    height: 52px;
    bottom: 25px;
    left: 25px;
    font-size: 1.2rem;
    border-radius: 16px;
  }
  
  .menu-logo {
    max-width: 150px;
  }
}
/* ========== چیدمان LTR (زبان انگلیسی / عربی چپ به راست) ========== */
html[dir="ltr"] .hamburger-container {
  right: auto;
  left: 20px;
}

html[dir="ltr"] .hamburger-container.active {
  right: auto;
  left: 380px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  margin-left: -1px;
  margin-right: 0;
}

html[dir="ltr"] .hamburger-container.active::after {
  right: auto;
  left: -1px;
}

html[dir="ltr"] .sideMenu {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transform: translateX(-100%);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
}

html[dir="ltr"] .sideMenu.active {
  transform: translateX(0);
}

html[dir="ltr"] .scroll-progress {
  right: auto;
  left: 0;
  transform-origin: left;
}

@media (max-width: 992px) {
  html[dir="ltr"] .hamburger-container { right: auto; left: 18px; }
  html[dir="ltr"] .hamburger-container.active { right: auto; left: 320px; }
}

@media (max-width: 768px) {
  html[dir="ltr"] .hamburger-container { right: auto; left: 15px; }
  html[dir="ltr"] .hamburger-container.active { right: auto; left: min(300px, 85vw); }
}

@media (max-width: 576px) {
  html[dir="ltr"] .hamburger-container { right: auto; left: 12px; }
  html[dir="ltr"] .hamburger-container.active { right: auto; left: min(300px, 82vw); }
}

/* ========== دسترس‌پذیری: کاهش حرکت ========== */
@media (prefers-reduced-motion: reduce) {
  .sideMenu,
  .overlay,
  .hamburger-container,
  .line,
  .menuItem,
  .menu-link,
  .menu-toggle,
  .submenu,
  .scroll-top {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
