/* CSS Document
================================
 Majd v5 – Main Navigation (RTL)
 شیشه‌ای، لوکس، بهینه‌شده (بدون اشکال هندسی اضافه)
================================*/

/* ---------- Vars ---------- */

/* ---------- Header (sticky) ---------- */
.majd5-header{
  position: sticky;
  top: var(--header-gap);
  z-index: 1200;
  background: transparent;
  transition: background .28s ease, box-shadow .28s ease, transform .28s ease;
}
.majd5-header.is-sticky{
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0,0,0,.10);
}

/* ---------- Nav capsule (glass) ---------- */
.majd5-nav{
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg,rgba(255,255,255,.86),rgba(255,255,255,.78));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 10px 28px rgba(0,0,0,.10),
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -1px 0 rgba(0,0,0,.04);
  isolation: isolate;
  transform: translateZ(0);
}
/* حلقه گرادیانی ظریف به‌جای بردر */
.majd5-nav::before{
  content:"";
  position:absolute; inset:-2px;
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(120deg, rgba(200,159,97,.65), rgba(255,255,255,0) 35%, rgba(200,159,97,.5) 65%),
    linear-gradient(180deg, rgba(30,58,95,.45), rgba(30,58,95,.15));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 2px; pointer-events:none; z-index:-1; filter: saturate(1.05);
}
.majd5-nav:hover{
  box-shadow:
    0 14px 36px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.45),
    inset 0 -1px 0 rgba(0,0,0,.05);
}

/* ---------- Logo (with shine) ---------- */
.majd5-logo{
  position: relative; display:inline-flex; align-items:center; gap:10px;
  padding:6px 10px; border-radius:12px; overflow:hidden; text-decoration:none;
}
.majd5-logo img{ height:36px; width:auto; display:block; }
.majd5-logo.small img{ height:30px; }
.majd5-brand-text{ font-weight:800; font-size:1rem; color: var(--color-primary); }

.majd5-logo .shine{
  position:absolute; inset:0; pointer-events:none;
  background-image: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.45) 12%, transparent 24%);
  background-repeat:no-repeat; background-size:220% 100%; background-position:-200% 0;
  animation: shineSweep 5s cubic-bezier(.22,1,.36,1) infinite;
  will-change: background-position;
}
@keyframes shineSweep{
  0%{background-position:-200% 0}
  70%{background-position:200% 0}
  100%{background-position:200% 0}
}

.majd5-mobile-brand{display:none}

/* ---------- Desktop menu ---------- */
.majd5-menu{
  display:flex; align-items:center; gap:6px;
  list-style:none; margin:0; padding:0;
  flex: 1 1 auto;                 /* فضای میانی را پر کند */
}

/* آیتم‌ها – قرصی با اندرلاین میکرو */
.majd5-menu > li > a{
  position:relative; display:inline-block;
  padding:10px 14px; border-radius:14px;
  text-decoration:none; font-weight:800; letter-spacing:.1px;
  color: color-mix(in srgb, var(--color-primary) 92%, #000 8%);
  transition: background .22s ease, color .22s ease, transform .22s ease, box-shadow .22s ease;
}
.majd5-menu > li > a::after{
  content:""; position:absolute; inset-inline:14px; bottom:6px; height:2px; border-radius:2px;
  background: linear-gradient(90deg, var(--color-secondary), #e7c081);
  transform: scaleX(0); transform-origin:right; transition: transform .25s ease;
  opacity:.95;
}
.majd5-menu > li:hover > a,
.majd5-menu > li > a:focus{
  background: color-mix(in srgb, var(--color-secondary) 12%, transparent);
  color:#0e1522;
}
.majd5-menu > li:hover > a::after{ transform: scaleX(1); transform-origin:left; }

.majd5-menu > li > a.active{
  background: color-mix(in srgb, var(--color-secondary) 16%, transparent);
  color:#0e1522;
}

/* زیرمنو */
.has-sub{ position:relative; }
.majd5-menu > li.has-sub > a{ display:flex; align-items:center; column-gap:8px; }
.majd5-menu > li.has-sub > a .majd5-caret{
  margin-inline-start:auto; font-size:.95rem; line-height:1;
  transition: transform .2s ease; transform: rotate(0deg);
}
.has-sub.open > a .majd5-caret,
.has-sub:hover > a .majd5-caret{ transform: rotate(90deg); }

.majd5-submenu{
  position:absolute; inset-inline-end:0; top: calc(100% + 10px);
  min-width:240px; background:#fff;
  border:1px solid rgba(30,58,95,.14); border-radius:14px; padding:10px;
  box-shadow: 0 24px 60px rgba(0,0,0,.14);
  opacity:0; visibility:hidden; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.has-sub:hover > .majd5-submenu{ opacity:1; visibility:visible; transform: translateY(0); }
.majd5-submenu > li + li{ border-top:1px dashed rgba(0,0,0,.06); }
.majd5-submenu > li > a{
  display:block; padding:10px 12px; border-radius:10px; text-decoration:none;
  color:#222; font-weight:700; transition: background .18s ease, color .18s ease, transform .18s ease;
}
.majd5-submenu > li > a:hover{ background: rgba(200,159,97,.10); color: var(--color-primary); transform: translateX(-2px); }

/* ---------- Actions (left side) ---------- */
.majd5-actions{
  margin-inline-start:auto;              /* دکمه‌ها را به چپ بچسبان در RTL */
  display:flex; align-items:center; gap:10px;
}



/* ---------- Burger (mobile) ---------- */
.majd5-burger{
  display:none; margin-inline-start:8px;
  position:relative; width:44px; height:36px; border:0; background:transparent; cursor:pointer;
}
.majd5-burger span{
  position:absolute; inset-inline:8px; height:2px; background: var(--color-primary);
  transition: transform .2s ease, opacity .2s ease, top .2s ease;
}
.majd5-burger span:nth-child(1){ top:10px; }
.majd5-burger span:nth-child(2){ top:17px; }
.majd5-burger span:nth-child(3){ top:24px; }
.majd5-burger.is-open span:nth-child(1){ transform: rotate(45deg); top:17px; }
.majd5-burger.is-open span:nth-child(2){ opacity:0; }
.majd5-burger.is-open span:nth-child(3){ transform: rotate(-45deg); top:17px; }

/* ---------- Mobile drawer ---------- */
.majd5-drawer{
  position: fixed; top:0; bottom:0; right:0;
  width: min(86vw, 360px);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.88));
  border:2px solid var(--color-primary); border-left-width:4px;
  border-radius:24px 0 0 24px;
  box-shadow:-12px 0 32px rgba(0,0,0,.18);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  z-index:1100;
  transform: translate3d(110%,0,0); opacity:0; pointer-events:none;
  transition: transform .6s cubic-bezier(.22,1,.36,1), opacity .4s ease;
  will-change: transform, opacity;
  overflow:auto; padding:14px 16px;
}
.majd5-drawer.is-open{ transform: translate3d(0,0,0); opacity:1; pointer-events:auto; }

.majd5-drawer-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  border-bottom:1px solid rgba(30,58,95,.15);
  padding:10px 6px; border-radius:18px 0 0 0;
  background: linear-gradient(90deg, var(--color-primary) 0%, transparent 100%);
  color: var(--color-light);
}
.majd5-drawer-close{ background:transparent; border:0; font-size:28px; color: var(--color-primary); cursor:pointer; position: fixed ; left: 20px;}

.majd5-drawer-menu{ list-style:none; margin:10px 0 0; padding:0; display:grid; gap:8px; }
.majd5-drawer-menu > li > a,
.drawer-toggle{
  display:flex; align-items:center; column-gap:8px;
  width:100%; padding:12px; border-radius:12px;
  text-decoration:none; font-weight:800; text-align:right;
  color:#111; background: rgba(200,159,97,.08); border:1px solid rgba(200,159,97,.25);
}
.majd5-drawer-menu > li > a:hover{ background: rgba(200,159,97,.12); }
.drawer-toggle{
  cursor:pointer; background: rgba(30,58,95,.06);
  border-color: rgba(30,58,95,.22); color: var(--color-primary);
}
/* فلش موبایل با Font Awesome در HTML: <i class="fa-solid fa-angle-left majd5-caret"> */
.drawer-toggle .majd5-caret{
  margin-inline-start:auto; font-size:1rem; line-height:1; transition: transform .2s ease; transform: rotate(0deg);
}
.drawer-toggle[aria-expanded="true"] .majd5-caret{ transform: rotate(90deg); }

.drawer-sub{
  list-style:none; margin:6px 6px 2px; padding:8px; display:none;
  border:1px solid rgba(30,58,95,.15); border-radius:12px; background:#fff;
}
.drawer-sub li a{
  display:block; padding:10px; border-radius:10px; color:#222; font-weight:700; text-decoration:none;
}
.drawer-sub li a:hover{ background: rgba(30,58,95,.08); }

/* ---------- Backdrop ---------- */
.majd5-backdrop{
  position: fixed; inset:0; background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px); z-index:1095; opacity:0; transition: opacity .35s ease;
}
.majd5-backdrop[hidden]{ display:none; }
.majd5-backdrop.show{ opacity:1; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px){
  :root{--mobile-header-h:68px;--mobile-header-gap:max(8px,env(safe-area-inset-top,0px))}
  #page:has(.majd5-header){padding-top:calc(var(--mobile-header-h) + var(--mobile-header-gap))}
  .majd5-header,.majd5-header.is-sticky{
    position:fixed;inset:var(--mobile-header-gap) 0 auto;height:var(--mobile-header-h);
    background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none;
    box-shadow:none;transition:box-shadow .25s ease;
  }
  .majd5-header>.container{padding-inline:10px}
  .majd5-nav{height:var(--mobile-header-h);padding:8px 12px;border-radius:20px;background:#fff}
  .majd5-nav::before{border-radius:20px}
  .majd5-menu{ display:none; }          /* منوی دسکتاپ پنهان */
  .majd5-burger{ display:inline-block; }
  .majd5-actions{ display:none; }       /* CTA جدا در موبایل اختیاری: پنهان */
}




/* Mobile: drawer trigger on the right, brand centered, logo on the left. */
@media(max-width:991.98px){
 .majd5-nav{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:6px;text-align:center}
 .majd5-nav>.majd5-logo{grid-column:3;grid-row:1;justify-content:center;margin:0;padding:4px}
 .majd5-nav>.majd5-logo img{height:32px;max-width:36px;object-fit:contain}
 .majd5-mobile-brand{display:block;grid-column:2;grid-row:1;color:var(--color-primary);font-size:clamp(11px,3.4vw,14px);font-weight:700;white-space:nowrap}
 .majd5-burger{grid-column:1;grid-row:1;width:44px;height:36px;margin:0;display:inline-block}
}
