/* ─── Mega Menu — Aghakhani Theme ─────────────────────── */

/* ── جلوگیری از اسکرول افقی ─────────────────────────── */
body { overflow-x: clip; }

/* ── آیکون‌ها ───────────────────────── */
.mm-icon,
.mm-mob-cat-icon {
  display: inline-block;
  font-size: 18px;
  flex-shrink: 0;
}
img.mm-mob-cat-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

:root {
  --mm-gold:       #C9A96E;
  --mm-gold-dark:  #9A7440;
  --mm-gold-light: rgba(201,169,110,0.12);
  --mm-dark:       #1C1C1C;
  --mm-mid:        #555555;
  --mm-muted:      #999999;
  --mm-bg-panel:   #FEFDFB;
  --mm-bg-cat:     #F6F3EF;
  --mm-border:     #E5DDD2;
  --mm-nav-h:     140px; /* JS این مقدار را با ارتفاع واقعی هدر sync می‌کند */
}

/* ════════════════════════════════════════════════════════
   DESKTOP NAV LINKS
   ════════════════════════════════════════════════════════ */
.mm-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.mm-nav-links > li > a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--mm-dark);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.mm-nav-links > li > a:hover {
  color: var(--mm-gold-dark);
  background: var(--mm-gold-light);
}
.mm-nav-links > li > a .mm-chv {
  font-size: 9px;
  transition: transform .25s ease;
  color: var(--mm-muted);
}
/* لینک‌های درون هدر/پنل بدون underline */
.mm-content-header h3 a,
.mm-sg-title a {
  color: inherit;
  text-decoration: none;
}
.mm-content-header h3 a:hover { color: var(--mm-gold); }
.mm-sg-title a:hover { color: var(--mm-gold-dark); }

/* ════════════════════════════════════════════════════════
   MEGA MENU WRAPPER
   ════════════════════════════════════════════════════════ */
.mm-mega-wrapper { position: static; }

.mm-mega-wrapper:hover > a .mm-chv {
  transform: rotate(180deg);
  color: var(--mm-gold);
}
.mm-mega-wrapper:hover > a {
  color: var(--mm-gold-dark);
  background: var(--mm-gold-light);
}

/* ════════════════════════════════════════════════════════
   DROPDOWN PANEL
   ════════════════════════════════════════════════════════ */
.mm-mega-panel {
  position: fixed;
  top: 140px;
  right: 0;
  width: 800px;
  max-width: 100vw;
  background: var(--mm-bg-panel);
  border-top: 2px solid var(--mm-gold);
  border-bottom: 1px solid var(--mm-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.13);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
  z-index: 999;
}

/* لپتاپ متوسط: کمی بزرگتر ولی از راست */
@media (min-width: 1280px) and (max-width: 1535px) {
  .mm-mega-panel {
    width: 900px;
  }
}

/* صفحه نمایش بزرگ: از container شروع بشه */
@media (min-width: 1536px) {
  .mm-mega-panel {
    right: calc((100vw - 1280px) / 2);
    width: 1000px;
  }
}
.mm-mega-wrapper:hover .mm-mega-panel {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}
.mm-mega-inner {
  display: flex;
  flex-direction: row;
  min-height: 360px;
  max-height: calc(100vh - var(--mm-nav-h) - 40px);
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════
   CATEGORY TABS (right side in RTL)
   ════════════════════════════════════════════════════════ */
.mm-cat-tabs {
  width: 240px;
  flex-shrink: 0;
  background: var(--mm-bg-cat);
  border-left: 1px solid var(--mm-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
}

.mm-cat-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--mm-mid);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  text-align: right;
  gap: 10px;
}
.mm-cat-tab:hover { background: #EEEAE3; color: var(--mm-dark); }
.mm-cat-tab.active {
  background: #fff;
  color: var(--mm-gold-dark);
  border-left-color: var(--mm-gold);
  font-weight: 600;
}
.mm-cat-tab .mm-tab-arrow {
  font-size: 11px;
  color: var(--mm-muted);
  flex-shrink: 0;
  margin-right: auto;
  transition: transform .15s;
}
.mm-cat-tab.active .mm-tab-arrow {
  transform: translateX(-3px);
  color: var(--mm-gold);
}
.mm-cat-divider {
  height: 1px;
  background: var(--mm-border);
  margin: 8px 16px;
}

/* ════════════════════════════════════════════════════════
   CONTENT AREA (left side in RTL)
   ════════════════════════════════════════════════════════ */
.mm-cat-contents { flex: 1; overflow-y: auto; }

.mm-cat-content {
  padding: 24px 36px;
  display: none;
  animation: mm-slideIn .18s ease;
}
.mm-cat-content.active { display: block; }

@keyframes mm-slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.mm-content-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mm-border);
}
.mm-content-header .mm-icon {
  font-size: 20px;
}
.mm-content-header img.mm-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.mm-content-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--mm-gold-dark);
  margin: 0;
}

/* ── Groups grid ────────────────────────── */
.mm-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px 32px;
}

/* ── Sub-group ──────────────────────────── */
.mm-sg-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mm-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.mm-sg-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 13px;
  background: var(--mm-gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.mm-sg-items { display: flex; flex-direction: column; gap: 1px; }
.mm-sg-item {
  font-size: 13px;
  font-weight: 400;
  color: var(--mm-mid);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 5px;
  transition: color .15s, background .15s, padding-right .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-sg-item:hover {
  color: var(--mm-gold-dark);
  background: var(--mm-gold-light);
  padding-right: 14px;
}
.mm-item-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity .15s;
}
/* آیکون تصویری */
img.mm-item-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 0.75;
}
.mm-sg-item:hover .mm-item-icon,
.mm-nested-item:hover .mm-item-icon,
.mm-mob-item:hover .mm-item-icon {
  opacity: 1;
}

/* ── Nested group ───────────────────────── */
.mm-nested-group {
  margin-top: 8px;
  margin-right: 10px;
  padding-right: 12px;
  border-right: 2px dashed var(--mm-border);
}
.mm-nested-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--mm-dark);
  margin-bottom: 5px;
  padding: 4px 0;
}
.mm-nested-item {
  font-size: 12px;
  color: var(--mm-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s, background .15s;
}
.mm-nested-item:hover { color: var(--mm-gold-dark); background: var(--mm-gold-light); }

/* ── Pills ──────────────────────────────── */
.mm-pills-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.mm-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1px solid var(--mm-border);
  border-radius: 30px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--mm-mid);
  text-decoration: none;
  transition: border-color .2s, color .2s, box-shadow .2s, background .2s;
  white-space: nowrap;
}
.mm-pill::before {
  content: '◆';
  font-size: 6px;
  color: var(--mm-gold);
  opacity: 0;
  transition: opacity .2s;
}
.mm-pill:hover {
  border-color: var(--mm-gold);
  color: var(--mm-gold-dark);
  background: var(--mm-gold-light);
  box-shadow: 0 2px 10px rgba(201,169,110,0.18);
}
.mm-pill:hover::before { opacity: 1; }

/* ── CTA panel ──────────────────────────── */
.mm-page-cta {
  font-size: 14px;
  color: var(--mm-mid);
  line-height: 1.85;
  margin-bottom: 22px;
}
.mm-btn-gold {
  display: inline-flex;
  align-items: center;
  padding: 12px 26px;
  background: var(--mm-gold);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
.mm-btn-gold:hover { background: var(--mm-gold-dark); }


/* ════════════════════════════════════════════════════════
   MOBILE ACCORDION
   ════════════════════════════════════════════════════════ */

/* wrapper کامل — تمام عرض، راست‌چین، override میکنه items-center موبایل */
.mm-mobile-wrap {
  align-self: stretch;
  width: 100%;
  direction: rtl;
  text-align: right;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* استایل scrollbar موبایل */
.mm-mobile-wrap::-webkit-scrollbar {
  width: 4px;
}

.mm-mobile-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.mm-mobile-wrap::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 110, 0.3);
  border-radius: 2px;
}

.mm-mobile-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 169, 110, 0.5);
}

/* لینک ساده موبایل */
.mm-mob-plain-link {
  display: block;
  width: 100%;
  text-decoration: none;
  padding: 0 32px;
}

.mm-mobile-services {
  width: 100%;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* ── دکمه toggle ─────────────────────────── */
.mm-mob-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #e7dfd4;
  cursor: pointer;
  color: #717171;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  text-align: right;
  direction: rtl;
}
.mm-mob-toggle[aria-expanded="true"] .mm-mob-chv { transform: rotate(180deg); }
.mm-mob-chv { transition: transform .25s ease; flex-shrink: 0; }

/* ── پنل اصلی ───────────────────────────── */
.mm-mob-panel { display: none; padding: 4px 0; }
.mm-mob-panel.open { display: block; }

/* ── دسته‌بندی ──────────────────────────── */
.mm-mob-cat { border-bottom: 1px solid #e7dfd4; }

.mm-mob-cat-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #555;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  text-align: right;
  direction: rtl;
}
.mm-mob-cat-toggle[aria-expanded="true"] { color: var(--mm-gold-dark); }
.mm-mob-cat-toggle[aria-expanded="true"] .mm-mob-chv { transform: rotate(180deg); }
.mm-mob-cat-toggle .mm-mob-chv { margin-right: auto; }

/* ── محتوای دسته ────────────────────────── */
.mm-mob-cat-panel { display: none; padding: 2px 0 8px; }
.mm-mob-cat-panel.open { display: block; }

/* ── زیرگروه ────────────────────────────── */
.mm-mob-sg { padding: 4px 36px 2px; }
.mm-mob-sg-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--mm-dark);
  padding: 5px 0 4px;
  border-bottom: 1px solid var(--mm-border);
  margin-bottom: 3px;
  text-align: right;
}
.mm-mob-sg-title a { color: inherit; text-decoration: none; }
.mm-mob-nested-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mm-mid);
  padding: 4px 36px;
  text-align: right;
}

/* ── آیتم لینک ─────────────────────────── */
.mm-mob-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 13px;
  color: var(--mm-mid);
  text-decoration: none;
  padding: 7px 36px;
  text-align: right;
  direction: rtl;
  transition: color .15s, background .15s;
}
.mm-mob-item:hover { color: var(--mm-gold-dark); background: var(--mm-gold-light); }
.mm-mob-item--nested { padding-right: 48px; font-size: 12px; color: var(--mm-muted); }

/* ── CTA موبایل ─────────────────────────── */
.mm-mob-cta-text {
  font-size: 12.5px;
  color: var(--mm-mid);
  padding: 6px 36px;
  line-height: 1.7;
  text-align: right;
}
.mm-mob-cta-btn {
  display: inline-flex;
  margin: 6px 36px;
  padding: 9px 20px;
  background: var(--mm-gold);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* ── لینک «همه خدمات» ───────────────────── */
.mm-mob-all-link {
  display: block;
  font-size: 12px;
  color: var(--mm-gold-dark);
  text-decoration: none;
  padding: 6px 36px 8px;
  font-weight: 600;
  text-align: right;
}
.mm-mob-all-link:hover { text-decoration: underline; }


/* ════════════════════════════════════════════════════════
   RESPONSIVE — tablet (1024px-1280px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .mm-cat-tabs { width: 210px; }
  .mm-cat-content { padding: 20px 24px; }
  .mm-groups-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 20px 24px;
  }
}

@media (max-width: 1100px) {
  .mm-cat-tabs { width: 185px; }
  .mm-cat-tab { font-size: 12.5px; padding: 11px 16px; }
  .mm-groups-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px 20px;
  }
}
