/* =========================================
   Ashenna Nav Menu
========================================= */

.anm-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.anm-nav {
  flex: 1;
}

.anm-nav-wrap {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  flex-wrap: nowrap;
  direction: rtl;
}

.anm-item {
  position: relative;
  list-style: none;
}

.anm-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  /* ✅ انیمیشن لینک اصلی */
  transition: color 0.25s ease,
              background-color 0.25s ease,
              transform 0.2s ease;
}

.anm-link:hover {
  transform: translateY(-1px);
}

.anm-link .anm-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  opacity: 0.7;
  /* ✅ انیمیشن چرخش آیکون */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease;
}

.anm-link .anm-indicator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  display: block;
}

.anm-item:hover > .anm-link .anm-indicator,
.anm-item.is-open > .anm-link .anm-indicator {
  transform: rotate(-180deg);
  opacity: 1;
}

/* =========================================
   مگامنو ۳ ستونه
========================================= */
.anm-megamenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 700px;
  max-width: 90vw;
  display: flex;
  flex-direction: row;
  direction: rtl;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04),
              0 10px 40px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.08);
  z-index: 99999;
  overflow: hidden;
  max-height: 500px;

  /* ✅ انیمیشن باز شدن مگامنو */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.anm-item:hover > .anm-megamenu,
.anm-item.is-open > .anm-megamenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.anm-item:first-child > .anm-megamenu {
  right: auto;
  left: 0;
  transform-origin: top left;
}

/* L1 Panel */
.anm-megamenu-l1-panel {
  width: 220px;
  min-width: 180px;
  max-width: 240px;
  flex-shrink: 0;
  background: #f8f8f8;
  overflow-y: auto;
  border-left: 1px solid #eee;
}

.anm-megamenu-l1-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.anm-megamenu-l1-item > .anm-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: right;
}

.anm-megamenu-l1-item.is-active > .anm-sub-link {
  color: #e07b39;
  background: rgba(224,123,57,0.06);
}

/* L2 Panel — انیمیشن fade */
.anm-megamenu-l2-panel {
  width: 220px;
  min-width: 180px;
  max-width: 240px;
  flex-shrink: 0;
  background: #fff;
  overflow-y: auto;
  border-left: 1px solid #eee;
  display: none;
  /* ✅ انیمیشن ظاهر شدن پنل L2 */
  animation: anm-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anm-megamenu-l2-panel.is-active {
  display: block;
}

/* L3 Panel — انیمیشن fade */
.anm-megamenu-l3-panel {
  flex: 1;
  min-width: 0;
  background: #fff;
  overflow-y: auto;
  display: none;
  /* ✅ انیمیشن ظاهر شدن پنل L3 */
  animation: anm-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anm-megamenu-l3-panel.is-active {
  display: block;
}

/* ✅ keyframe برای پنل‌ها */
@keyframes anm-panel-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anm-megamenu-l2-list,
.anm-megamenu-l3-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.anm-megamenu-l2-item > .anm-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: right;
}

.anm-megamenu-l2-item.is-active > .anm-sub-link {
  color: #e07b39;
  background: rgba(224,123,57,0.06);
}

.anm-megamenu-l3-item > .anm-sub-link {
  width: 100%;
  text-align: right;
}

/* ✅ انیمیشن آیتم‌های لیست — stagger */
.anm-megamenu-l1-item,
.anm-megamenu-l2-item,
.anm-megamenu-l3-item {
  animation: anm-item-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anm-megamenu-l1-item:nth-child(1) { animation-delay: 0.04s; }
.anm-megamenu-l1-item:nth-child(2) { animation-delay: 0.08s; }
.anm-megamenu-l1-item:nth-child(3) { animation-delay: 0.12s; }
.anm-megamenu-l1-item:nth-child(4) { animation-delay: 0.16s; }
.anm-megamenu-l1-item:nth-child(5) { animation-delay: 0.20s; }
.anm-megamenu-l1-item:nth-child(6) { animation-delay: 0.24s; }
.anm-megamenu-l1-item:nth-child(n+7) { animation-delay: 0.28s; }

@keyframes anm-item-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* sub-link پایه */
.anm-sub-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 10px 16px;
  color: #333;
  font-size: 13.5px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
  /* ✅ انیمیشن hover */
  transition: color 0.2s ease,
              background-color 0.2s ease,
              padding-right 0.2s ease;
  position: relative;
}

.anm-sub-link:hover {
  color: #e07b39;
  background: rgba(224,123,57,0.04);
  /* ✅ کمی جابجایی هنگام hover */
  padding-right: 20px;
}

.anm-sub-link .anm-label {
  flex: 1;
  text-align: right;
}

.anm-sub-link .anm-indicator {
  display: inline-flex;
  align-items: center;
  opacity: 0.45;
  font-size: 11px;
  flex-shrink: 0;
  transform: scaleX(-1);
  transition: opacity 0.2s ease,
              color 0.2s ease;
}

.anm-sub-link .anm-indicator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  display: block;
}

.anm-megamenu-l1-item.is-active > .anm-sub-link .anm-indicator,
.anm-megamenu-l2-item.is-active > .anm-sub-link .anm-indicator {
  opacity: 1;
  color: #e07b39;
}

/* =========================================
   دراپداون ساده
========================================= */
.anm-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04),
              0 10px 40px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.08);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  z-index: 99999;
  overflow: hidden;
  direction: rtl;

  /* ✅ انیمیشن دراپداون */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.anm-item:hover > .anm-dropdown,
.anm-item.is-open > .anm-dropdown,
.anm-dropdown-item:hover > .anm-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* زیردراپداون */
.anm-dropdown .anm-dropdown {
  top: 0;
  right: 100%;
  left: auto;
  margin-right: 6px;
  transform: translateX(-8px) scale(0.97);
  transform-origin: top right;
}

.anm-dropdown-item:hover > .anm-dropdown {
  transform: translateX(0) scale(1);
}

.anm-dropdown-item {
  position: relative;
  list-style: none;
}

/* ✅ انیمیشن آیتم‌های دراپداون */
.anm-dropdown > .anm-dropdown-item {
  animation: anm-item-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anm-dropdown > .anm-dropdown-item:nth-child(1) { animation-delay: 0.03s; }
.anm-dropdown > .anm-dropdown-item:nth-child(2) { animation-delay: 0.06s; }
.anm-dropdown > .anm-dropdown-item:nth-child(3) { animation-delay: 0.09s; }
.anm-dropdown > .anm-dropdown-item:nth-child(4) { animation-delay: 0.12s; }
.anm-dropdown > .anm-dropdown-item:nth-child(5) { animation-delay: 0.15s; }
.anm-dropdown > .anm-dropdown-item:nth-child(n+6) { animation-delay: 0.18s; }

/* =========================================
   دکمه همبرگر
========================================= */
.anm-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  color: #333;
  border-radius: 8px;
  /* ✅ انیمیشن دکمه */
  transition: background-color 0.2s ease,
              transform 0.2s ease,
              color 0.2s ease;
  flex-shrink: 0;
}

.anm-toggle:hover {
  background-color: rgba(0,0,0,0.06);
  transform: scale(1.05);
}

.anm-toggle:active {
  transform: scale(0.95);
}

.anm-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
  /* ✅ انیمیشن آیکون همبرگر */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}

.anm-toggle i {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================
   Overlay
========================================= */
.anm-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 99996;
  cursor: pointer;
  /* ✅ انیمیشن fade overlay */
  transition: background-color 0.35s ease;
}

.anm-mobile-overlay.is-open {
  display: block;
  background: rgba(0,0,0,0.45);
  /* ✅ انیمیشن ورود */
  animation: anm-overlay-in 0.35s ease forwards;
}

@keyframes anm-overlay-in {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.45); }
}

/* =========================================
   منوی موبایل — slide از راست
========================================= */
.anm-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: #fff;
  z-index: 99997;
  overflow-y: auto;
  overflow-x: hidden;
  /* ✅ انیمیشن slide */
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.12);
  direction: rtl;
  display: none;
}

.anm-mobile-menu.is-ready {
  display: block;
}

.anm-mobile-menu.is-open {
  transform: translateX(0);
}

/* =========================================
   هدر منوی موبایل
========================================= */
.anm-mobile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  direction: rtl;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  /* ✅ سایه هدر هنگام اسکرول */
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.anm-mobile-search {
  flex: 1;
  min-width: 0;
}

.anm-mobile-search form,
.anm-mobile-search .dgwt-wcas-search-wrapp,
.anm-mobile-search input[type="search"],
.anm-mobile-search input[type="text"] {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* دکمه بستن X */
.anm-mobile-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: transparent;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  color: #444;
  padding: 0;
  outline: none;
  /* ✅ انیمیشن دکمه بستن */
  transition: background-color 0.2s ease,
              color 0.2s ease,
              border-color 0.2s ease,
              transform 0.2s ease;
  flex-shrink: 0;
}

.anm-mobile-close:hover {
  background: #fff0e8;
  color: #e07b39;
  border-color: #e07b39;
  transform: rotate(90deg);
}

.anm-mobile-close:active {
  transform: rotate(90deg) scale(0.9);
}

.anm-mobile-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
  transition: transform 0.2s ease;
}

/* =========================================
   لیست منوی موبایل
========================================= */
.anm-mobile-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 60px;
}

.anm-mobile-item {
  list-style: none;
  /* ✅ انیمیشن ورود آیتم‌های موبایل */
  animation: anm-mobile-item-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* delay برای هر آیتم */
.anm-mobile-list > .anm-mobile-item:nth-child(1)  { animation-delay: 0.08s; }
.anm-mobile-list > .anm-mobile-item:nth-child(2)  { animation-delay: 0.12s; }
.anm-mobile-list > .anm-mobile-item:nth-child(3)  { animation-delay: 0.16s; }
.anm-mobile-list > .anm-mobile-item:nth-child(4)  { animation-delay: 0.20s; }
.anm-mobile-list > .anm-mobile-item:nth-child(5)  { animation-delay: 0.24s; }
.anm-mobile-list > .anm-mobile-item:nth-child(6)  { animation-delay: 0.28s; }
.anm-mobile-list > .anm-mobile-item:nth-child(7)  { animation-delay: 0.32s; }
.anm-mobile-list > .anm-mobile-item:nth-child(n+8){ animation-delay: 0.36s; }

@keyframes anm-mobile-item-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anm-mobile-link-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0f0f0;
  direction: rtl;
  /* ✅ انیمیشن hover ردیف */
  transition: background-color 0.2s ease;
}

.anm-mobile-link-wrap:hover {
  background-color: rgba(224,123,57,0.03);
}

/* سطح ۱ */
.anm-mobile-link {
  display: block;
  flex: 1;
  padding: 14px 20px;
  text-decoration: none;
  color: #222;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  transition: color 0.2s ease, padding-right 0.2s ease;
}

.anm-mobile-link:hover {
  color: #e07b39;
  padding-right: 24px;
}

/* سطح ۲ */
.anm-mobile-item.level-1 > .anm-mobile-link-wrap {
  background: #fafafa;
}

.anm-mobile-item.level-1 > .anm-mobile-link-wrap > .anm-mobile-link {
  padding-right: 36px;
  font-size: 14px;
  font-weight: 400;
  color: #444;
}

.anm-mobile-item.level-1 > .anm-mobile-link-wrap > .anm-mobile-link:hover {
  padding-right: 40px;
}

/* سطح ۳ */
.anm-mobile-item.level-2 > .anm-mobile-link-wrap {
  background: #f4f4f4;
}

.anm-mobile-item.level-2 > .anm-mobile-link-wrap > .anm-mobile-link {
  padding-right: 52px;
  font-size: 13.5px;
  color: #555;
}

.anm-mobile-item.level-2 > .anm-mobile-link-wrap > .anm-mobile-link:hover {
  padding-right: 56px;
}

/* سطح ۴ */
.anm-mobile-item.level-3 > .anm-mobile-link-wrap {
  background: #efefef;
}

.anm-mobile-item.level-3 > .anm-mobile-link-wrap > .anm-mobile-link {
  padding-right: 68px;
  font-size: 13px;
  color: #666;
}

/* دکمه toggle زیرمنو */
.anm-mobile-toggle-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  color: #aaa;
  flex-shrink: 0;
  /* ✅ انیمیشن چرخش */
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.2s ease,
              background-color 0.2s ease;
  border-radius: 6px;
}

.anm-mobile-toggle-sub:hover {
  background-color: rgba(0,0,0,0.05);
  color: #666;
}

.anm-mobile-toggle-sub svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.anm-mobile-toggle-sub i {
  font-size: 14px;
}

.anm-mobile-toggle-sub.is-open {
  transform: rotate(180deg);
  color: #e07b39;
}

/* ✅ انیمیشن باز/بسته شدن زیرمنوی موبایل */
.anm-mobile-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  /* انیمیشن با JS کنترل میشه */
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
}

/* =========================================
   منوی عمودی
========================================= */
.anm-wrap.layout-vertical .anm-nav-wrap {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.anm-wrap.layout-vertical .anm-item {
  width: 100%;
}

.anm-wrap.layout-vertical .anm-link {
  width: 100%;
}

.anm-wrap.layout-vertical .anm-megamenu {
  position: static;
  box-shadow: none;
  border: 1px solid #eee;
  border-radius: 6px;
  transform: none;
  opacity: 1;
  visibility: visible;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  pointer-events: auto;
  display: none;
}

.anm-wrap.layout-vertical .anm-item.is-open > .anm-megamenu {
  display: flex;
}

.anm-wrap.layout-vertical .anm-dropdown {
  position: static;
  box-shadow: none;
  border: none;
  border-radius: 0;
  transform: none;
  opacity: 1;
  visibility: visible;
  width: 100%;
  padding: 0;
  pointer-events: auto;
  display: none;
}

.anm-wrap.layout-vertical .anm-item.is-open > .anm-dropdown {
  display: block;
}

/* =========================================
   جلوگیری از خروج viewport
========================================= */
.anm-megamenu-overflow-fix {
  right: auto !important;
  left: 0 !important;
}

/* =========================================
   کاهش انیمیشن برای کاربران با تنظیمات خاص
========================================= */
@media (prefers-reduced-motion: reduce) {
  .anm-megamenu,
  .anm-dropdown,
  .anm-mobile-menu,
  .anm-mobile-overlay,
  .anm-link,
  .anm-sub-link,
  .anm-toggle,
  .anm-mobile-close,
  .anm-mobile-toggle-sub,
  .anm-mobile-item,
  .anm-megamenu-l1-item,
  .anm-megamenu-l2-item,
  .anm-megamenu-l3-item,
  .anm-dropdown-item {
    animation: none !important;
    transition: none !important;
  }
}