/* منوی همبرگری موبایل — هم‌رنگ پالت سایت (سرمه‌ای، هلویی، سبزآبی). */

.th-menu-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #303c50;
  border-radius: 14px;
  background: linear-gradient(150deg, #192233, #111827);
  color: #ffb575;
  cursor: pointer;
  transition: border-color .25s ease, background .25s ease, transform .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.th-menu-toggle:hover { border-color: #ffb57580; }
.th-menu-toggle:active { transform: scale(.96); }
.th-menu-toggle:focus-visible { outline: 2px solid #ffb575; outline-offset: 3px; }

.th-menu-toggle-bars { display: grid; gap: 4px; width: 20px; }
.th-menu-toggle-bars i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .2s ease, width .35s cubic-bezier(.22, 1, .36, 1);
}
.th-menu-toggle-bars i:nth-child(2) { width: 70%; justify-self: end; }
body.th-menu-open .th-menu-toggle-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.th-menu-open .th-menu-toggle-bars i:nth-child(2) { opacity: 0; width: 0; }
body.th-menu-open .th-menu-toggle-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* لایهٔ پنل */
.th-drawer {
  position: fixed;
  inset: 0;
  z-index: 2147481500;
  display: flex;
  direction: ltr;
  justify-content: flex-end;
  pointer-events: none;
}
.th-drawer[hidden] { display: none !important; }

.th-drawer-veil {
  position: absolute;
  inset: 0;
  background: #04070cd9;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .35s cubic-bezier(.22, 1, .36, 1);
}
.th-drawer.is-open { pointer-events: auto; }
.th-drawer.is-open .th-drawer-veil { opacity: 1; }

.th-drawer-panel {
  direction: rtl;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(86vw, 360px);
  height: 100%;
  max-height: 100dvh;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(168deg, #111827 0%, #0d1421 55%, #090d15 100%);
  border-left: 1px solid #303c50;
  box-shadow: 0 0 60px #000a;
  color: #f3f5fa;
  transform: translateX(100%);
  opacity: .4;
  transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
  will-change: transform;
}
.th-drawer.is-open .th-drawer-panel { transform: translateX(0); opacity: 1; }

.th-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.th-drawer-brand img { display: block; width: 140px; height: auto; }
.th-drawer-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #303c50;
  border-radius: 12px;
  background: #192233;
  color: #ffb575;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.th-drawer-close:hover { background: #223049; border-color: #ffb57580; }
.th-drawer-close:active { transform: scale(.94); }
.th-drawer-close:focus-visible { outline: 2px solid #ffb575; outline-offset: 3px; }

.th-drawer-title { margin: 0; font-size: 12px; color: #aab4c5; letter-spacing: .02em; }

.th-drawer-nav .th-drawer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.th-drawer-nav li { margin: 0; padding: 0; }
.th-drawer-nav li a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 10px 14px 10px 40px;
  border: 1px solid #303c50;
  border-radius: 14px;
  background: #0f1724;
  color: #f3f5fa;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .25s ease, border-color .25s ease, color .25s ease, transform .25s ease;
}
.th-drawer-nav li a::before {
  content: "";
  position: absolute;
  inset-inline-start: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #303c50;
  transition: background .25s ease, box-shadow .25s ease;
}
.th-drawer-nav li a::after {
  content: "←";
  font-size: 13px;
  color: #aab4c5;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .25s ease, transform .25s ease;
}
.th-drawer-nav li a:hover,
.th-drawer-nav li a:focus-visible {
  background: #192233;
  border-color: #ffb57566;
  color: #ffb575;
}
.th-drawer-nav li a:hover::before,
.th-drawer-nav li a:focus-visible::before { background: #ffb575; box-shadow: 0 0 0 4px #ffb57522; }
.th-drawer-nav li a:hover::after,
.th-drawer-nav li a:focus-visible::after { opacity: 1; transform: translateX(0); }
.th-drawer-nav li a:focus-visible { outline: 2px solid #ffb575; outline-offset: 2px; }

.th-drawer-actions { display: grid; gap: 8px; }
.th-drawer-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #303c50;
  border-radius: 14px;
  background: #111827;
  color: #f3f5fa;
  font-size: 13px;
  text-decoration: none;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}
.th-drawer-action i { font-style: normal; color: #aab4c5; transition: transform .25s ease, color .25s ease; }
.th-drawer-action:hover { border-color: #ffb57566; color: #ffb575; }
.th-drawer-action:hover i { transform: translateX(-3px); color: #ffb575; }
.th-drawer-action.is-primary {
  background: #ffb575;
  border-color: #ffb575;
  color: #090d15;
  font-weight: 600;
}
.th-drawer-action.is-primary i { color: #090d15; }
.th-drawer-action.is-primary:hover { background: #ffca9b; color: #090d15; }

.th-drawer-quick { display: grid; gap: 2px; padding-top: 14px; border-top: 1px solid #303c50; }
.th-drawer-quick p { margin: 0 0 4px; font-size: 11px; color: #aab4c5; }
.th-drawer-quick a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 10px;
  color: #aab4c5;
  font-size: 13px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, padding-inline-start .25s ease;
}
.th-drawer-quick a:hover { background: #ffffff0a; color: #77dfcd; padding-inline-start: 16px; }

/* ورود پله‌ای آیتم‌ها */
.th-drawer.is-open .th-drawer-nav li,
.th-drawer.is-open .th-drawer-actions,
.th-drawer.is-open .th-drawer-quick {
  animation: th-drawer-in .5s cubic-bezier(.22, 1, .36, 1) both;
}
.th-drawer.is-open .th-drawer-nav li:nth-child(1) { animation-delay: .06s; }
.th-drawer.is-open .th-drawer-nav li:nth-child(2) { animation-delay: .11s; }
.th-drawer.is-open .th-drawer-nav li:nth-child(3) { animation-delay: .16s; }
.th-drawer.is-open .th-drawer-nav li:nth-child(4) { animation-delay: .21s; }
.th-drawer.is-open .th-drawer-nav li:nth-child(5) { animation-delay: .26s; }
.th-drawer.is-open .th-drawer-nav li:nth-child(6) { animation-delay: .31s; }
.th-drawer.is-open .th-drawer-actions { animation-delay: .26s; }
.th-drawer.is-open .th-drawer-quick { animation-delay: .32s; }
@keyframes th-drawer-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

body.th-menu-open { overflow: hidden !important; }

/* قالب داخل .th-header برای همهٔ دکمه‌ها پس‌زمینه و بردر هلویی اجباری می‌کند؛
   دکمهٔ منو باید آرام‌تر و هم‌خانوادهٔ بقیهٔ هدر بماند. */
html body:not(.wp-admin) .th-header .th-menu-toggle {
  background: linear-gradient(150deg, #192233, #111827) !important;
  border: 1px solid #303c50 !important;
  color: #ffb575 !important;
  box-shadow: none !important;
}
html body:not(.wp-admin) .th-header .th-menu-toggle:hover { border-color: #ffb57580 !important; }
html body:not(.wp-admin) .th-header .th-menu-toggle:focus-visible { outline: 2px solid #ffb575 !important; outline-offset: 3px; }

@media (max-width: 760px) {
  .th-menu-toggle,
  html body:not(.wp-admin) .th-header .th-menu-toggle { display: grid; }
  /* چیدمان: دکمهٔ منو (راست) | لوگو | حساب و سبد (چپ). */
  html body.tolou-storefront .th-header .th-header-row {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }
  /* متن «حساب کاربری» جای کمی می‌گیرد؛ همان گزینه در کشوی منو هست. */
  html body.tolou-storefront .th-header .th-account .th-native-account { display: none !important; }
  html body.tolou-storefront .th-header .th-account { gap: 6px !important; }
}

@media (min-width: 761px) {
  .th-drawer,
  html body:not(.wp-admin) .th-header .th-menu-toggle { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .th-drawer-panel, .th-drawer-veil, .th-menu-toggle-bars i { transition: none !important; }
  .th-drawer.is-open .th-drawer-nav li,
  .th-drawer.is-open .th-drawer-actions,
  .th-drawer.is-open .th-drawer-quick { animation: none !important; }
}
