/* ==========================================================================
   Dhaka Exclusive — dynamic header + motion layer (dxhdr1)
   Everything here is settings-driven from Admin → Settings → Header & animation.
   Body gets: .dx-hdr (always), .dx-hdr-fx (motion master switch) and
   data-hdr-mode / data-hdr-compact / data-hdr-line / data-hdr-speed.
   ========================================================================== */

body.dx-hdr { --dx-hdr-anim: 1; }
body.dx-hdr[data-hdr-speed="calm"] { --dx-hdr-anim: .72; }
body.dx-hdr[data-hdr-speed="lively"] { --dx-hdr-anim: 1.5; }

html { scroll-padding-top: calc(var(--dx-hdr-h, 150px) + 10px); }

/* ---------- 1. Sticky / smart-hide ---------- */
body.dx-hdr .site-header {
  transition: transform .42s cubic-bezier(.22, .61, .36, 1),
              box-shadow .35s ease, background-color .35s ease;
  will-change: transform;
}
body.dx-hdr[data-hdr-mode="static"] .site-header { position: relative; }
body.dx-hdr.is-hdr-scrolled .site-header {
  box-shadow: 0 16px 46px rgba(2, 6, 23, .58);
  background: rgba(9, 14, 26, .97);
}
body.dx-hdr.is-hdr-hidden .site-header { transform: translateY(-100%); }

/* ---------- 2. Scroll progress line ---------- */
.dx-hdr-line {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  z-index: 8; pointer-events: none; overflow: hidden;
}
.dx-hdr-line span {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, #2a4bd7 0%, #e05e1a 55%, #facc15 100%);
  box-shadow: 0 0 12px rgba(224, 94, 26, .55);
  transition: transform .09s linear;
}

/* ---------- 3. Compact header on scroll (desktop) ---------- */
@media (min-width: 992px) {
  body.dx-hdr[data-hdr-compact="1"] .sh-util {
    overflow: hidden; max-height: 44px;
    transition: max-height .38s cubic-bezier(.22, .61, .36, 1), opacity .26s ease;
  }
  body.dx-hdr[data-hdr-compact="1"].is-hdr-scrolled .sh-util { max-height: 0; opacity: 0; }

  body.dx-hdr[data-hdr-compact="1"] .sh-main-inner {
    transition: min-height .38s cubic-bezier(.22, .61, .36, 1), padding .38s cubic-bezier(.22, .61, .36, 1);
  }
  body.dx-hdr[data-hdr-compact="1"].is-hdr-scrolled .sh-main-inner {
    min-height: 58px; padding-top: 6px; padding-bottom: 6px;
  }
  body.dx-hdr[data-hdr-compact="1"] .sh-logo {
    transition: transform .38s cubic-bezier(.22, .61, .36, 1);
    transform-origin: left center;
  }
  body.dx-hdr[data-hdr-compact="1"].is-hdr-scrolled .sh-logo { transform: scale(.84); }

  body.dx-hdr[data-hdr-compact="1"] .sh-icon-btn {
    transition: transform .15s, box-shadow .15s, border-color .15s, width .3s, height .3s;
  }
  body.dx-hdr[data-hdr-compact="1"].is-hdr-scrolled .sh-icon-btn { width: 40px; height: 40px; }
  body.dx-hdr[data-hdr-compact="1"].is-hdr-scrolled .sh-search { max-width: 620px; }
}

/* ---------- 4. Rotating offer headline in the utility bar ---------- */
.sh-util-announce { display: none; align-items: center; gap: 8px; min-width: 0; color: #dbeafe; }
@media (min-width: 992px) { .sh-util-announce { display: flex; } }
.dx-ann-item { display: none; align-items: center; gap: 7px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: min(46vw, 560px); font-weight: 600; }
.dx-ann-item.is-on { display: inline-flex; animation: dxAnnIn .45s cubic-bezier(.22, .61, .36, 1) both; }
.dx-ann-item .dx-ann-ico { font-size: .95em; line-height: 1; }
@keyframes dxAnnIn {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}
.dx-ann-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .55);
  animation: dxAnnDot 2.2s ease-out infinite;
}
@keyframes dxAnnDot {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---------- 5. Animated category nav ---------- */
body.dx-hdr-fx .sh-cat { position: relative; }
body.dx-hdr-fx .sh-cat::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, #2a4bd7, #e05e1a);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
body.dx-hdr-fx .sh-cat:hover::after,
body.dx-hdr-fx .sh-cat.is-active::after { transform: scaleX(1); }

body.dx-hdr-fx .sh-caret { transition: transform .3s cubic-bezier(.22, .61, .36, 1); }
body.dx-hdr-fx .sh-cat-item:hover > .sh-cat-parent .sh-caret,
body.dx-hdr-fx .sh-cat-item:focus-within > .sh-cat-parent .sh-caret { transform: rotate(180deg); }

/* dropdown entrance */
body.dx-hdr-fx .sh-cat-dd { transform-origin: top center; }
body.dx-hdr-fx .sh-cat-item:hover > .sh-cat-dd,
body.dx-hdr-fx .sh-cat-item:focus-within > .sh-cat-dd {
  animation: dxDd .28s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes dxDd {
  from { opacity: 0; transform: translateY(-10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
body.dx-hdr-fx .sh-cat-dd-list li { animation: dxDdLi .34s both; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(1) { animation-delay: 0ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(2) { animation-delay: 26ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(3) { animation-delay: 52ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(4) { animation-delay: 78ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(5) { animation-delay: 104ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(6) { animation-delay: 130ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(7) { animation-delay: 156ms; }
body.dx-hdr-fx .sh-cat-dd-list li:nth-child(8) { animation-delay: 182ms; }
@keyframes dxDdLi {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 6. Ambient motion: category band gradient, logo, badges ---------- */
body.dx-hdr-fx .sh-catbar {
  background: linear-gradient(100deg, #0b1220 0%, #0d1a30 32%, #17284c 50%, #0d1a30 68%, #0b1220 100%);
  background-size: 220% 100%;
  animation: dxBarDrift calc(14s / var(--dx-hdr-anim)) ease-in-out infinite;
}
@keyframes dxBarDrift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

body.dx-hdr-fx .sh-brand .sh-logo { transition: transform .4s cubic-bezier(.22, .61, .36, 1), filter .4s ease; }
body.dx-hdr-fx .sh-brand:hover .sh-logo {
  transform: translateY(-1px) scale(1.03);
  filter: drop-shadow(0 6px 16px rgba(42, 75, 215, .45));
}

body.dx-hdr-fx .sh-cart-btn .sh-badge {
  animation: dxBadgePulse calc(3.2s / var(--dx-hdr-anim)) ease-in-out infinite;
}
@keyframes dxBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); }
  55%      { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
}

body.dx-hdr-fx .sh-catbar-hotline-icon { position: relative; }
body.dx-hdr-fx .sh-catbar-hotline-icon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, .55); pointer-events: none;
  animation: dxHotRing calc(2.6s / var(--dx-hdr-anim)) ease-out infinite;
}
@keyframes dxHotRing {
  0%   { transform: scale(.82); opacity: .9; }
  80%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

body.dx-hdr-fx .sh-search:focus-within {
  box-shadow: 0 0 0 3px rgba(42, 75, 215, .18), 0 10px 26px rgba(2, 6, 23, .35);
}
body.dx-hdr-fx .sh-search:focus-within .sh-search-btn { filter: brightness(1.08); }

/* ---------- 8. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  body.dx-hdr .site-header,
  body.dx-hdr-fx .sh-cat::after,
  body.dx-hdr-fx .sh-caret { transition: none !important; }
  body.dx-hdr.is-hdr-hidden .site-header { transform: none; }
  body.dx-hdr-fx .sh-catbar,
  body.dx-hdr-fx .sh-cart-btn .sh-badge,
  body.dx-hdr-fx .sh-catbar-hotline-icon::after,
  body.dx-hdr-fx .sh-cat-dd,
  body.dx-hdr-fx .sh-cat-dd-list li,
  .dx-ann-item.is-on,
  .dx-ann-dot { animation: none !important; }
}
