/**
 * DomainHost header v3 — Dodo-inspired icon mega menu
 * Fixes: no Bootstrap .container (overflow-x:clip), no link overcrowding,
 * no header scrollbar, logo never overlaps nav.
 */

.dh-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid #e2e8f0;
  overflow: visible !important;
  max-height: none !important;
  transition: box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, min-height 0.2s ease;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  width: 100%;
}

/* Sticky / fixed bar while scrolling */
.dh-header.is-stuck {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
  border-bottom-color: #dbe4ee;
  background: rgba(255, 255, 255, 0.98);
}

.dh-header.is-fixed {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1200;
  animation: dhHeaderIn 0.22s ease;
}

@keyframes dhHeaderIn {
  from { transform: translateY(-8px); opacity: 0.85; }
  to { transform: translateY(0); opacity: 1; }
}

.dh-header-ph {
  display: none;
  width: 100%;
  pointer-events: none;
}

.dh-header-ph.is-on {
  display: block;
}

.dh-header.is-stuck .dh-shell {
  min-height: 60px;
}

@media (prefers-reduced-motion: reduce) {
  .dh-header.is-fixed {
    animation: none;
  }
}

.dh-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  overflow: visible !important;
}

.dh-logo {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
  color: #0f172a;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.dh-logo span {
  color: #0f766e;
}

.dh-logo:hover {
  color: #0f172a;
}

/* Desktop menu */
.dh-menu {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible !important;
}

.dh-menu__list {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dh-menu__list > li {
  position: relative;
  flex: 0 0 auto;
}

.dh-menu__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 42px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.dh-menu__link i.dh-menu__ico {
  font-size: 0.85rem;
  color: #0f766e;
  opacity: 0.9;
}

.dh-menu__link .dh-caret {
  font-size: 0.65rem;
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.dh-menu__link:hover,
.dh-menu__link:focus-visible,
.dh-menu__link.is-active,
.dh-menu__list > li.is-open > .dh-menu__link {
  background: #ecfdf5;
  color: #0f766e;
  outline: none;
}

.dh-menu__list > li.is-open .dh-caret,
.dh-menu__list > li:hover .dh-caret {
  transform: rotate(180deg);
}

/* Mega / dropdown panel — flush under trigger + invisible hover bridge */
.dh-mega {
  position: absolute;
  top: 100%;
  left: 0;
  width: min(520px, calc(100vw - 2rem));
  margin-top: 0;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  z-index: 1300;
}

/* Hover bridge: pointer can travel trigger → panel without leaving <li> */
.dh-mega::before {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  top: -16px;
  height: 20px;
}

.dh-mega--sm {
  width: min(340px, calc(100vw - 2rem));
}

.dh-mega--end {
  left: auto;
  right: 0;
}

.dh-menu__list > li.is-open > .dh-mega,
.dh-menu__list > li:hover > .dh-mega,
.dh-menu__list > li:focus-within > .dh-mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Extra hit area under the trigger while open */
.dh-menu__list > li::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 16px;
  pointer-events: none;
}

.dh-menu__list > li:hover::after,
.dh-menu__list > li.is-open::after,
.dh-menu__list > li:focus-within::after {
  pointer-events: auto;
}

.dh-mega__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
}

@media (min-width: 700px) {
  .dh-mega:not(.dh-mega--sm) .dh-mega__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.dh-mega__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  text-decoration: none !important;
  color: inherit;
}

.dh-mega__item:hover {
  background: #f0fdfa;
}

.dh-mega__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 1rem;
}

.dh-mega__item:hover .dh-mega__icon {
  background: #0f766e;
  color: #fff;
}

.dh-mega__text {
  min-width: 0;
}

.dh-mega__text strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.15rem;
}

.dh-mega__text span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #64748b;
}

.dh-mega__label {
  grid-column: 1 / -1;
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.dh-mega__all {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f766e;
  text-decoration: none !important;
}

.dh-mega__all:hover {
  color: #0d9488;
}

/* Actions */
.dh-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-left: auto;
  position: relative;
  z-index: 2;
}

.dh-icon-btn,
.dh-burger {
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.dh-icon-btn:hover,
.dh-burger:hover {
  border-color: #0f766e;
  color: #0f766e;
  background: #f8fafc;
}

.dh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 0.9rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  border: 1px solid transparent;
}

.dh-btn--ghost {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.dh-btn--ghost:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.dh-btn--solid {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff !important;
}

.dh-btn--solid:hover {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff !important;
}

.dh-burger__bars {
  width: 18px;
  height: 12px;
  position: relative;
  display: block;
}

.dh-burger__bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: top 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.dh-burger__bars span:nth-child(1) { top: 0; }
.dh-burger__bars span:nth-child(2) { top: 5px; }
.dh-burger__bars span:nth-child(3) { top: 10px; }

.dh-header.is-open .dh-burger__bars span:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}
.dh-header.is-open .dh-burger__bars span:nth-child(2) { opacity: 0; }
.dh-header.is-open .dh-burger__bars span:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

/* Account mini panel */
.dh-account {
  position: relative;
}

.dh-account__panel {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  margin-top: 0;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 1400;
}

.dh-account__panel::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 16px;
}

.dh-account.is-open .dh-account__panel {
  display: block;
}

.dh-account__panel a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  color: #334155;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.dh-account__panel a:hover {
  background: #ecfdf5;
  color: #0f766e;
}

/* Drawer */
.dh-drawer {
  position: fixed;
  inset: 0;
  z-index: 1500;
  visibility: hidden;
  pointer-events: none;
}

.dh-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.dh-drawer__bg {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.dh-drawer.is-open .dh-drawer__bg { opacity: 1; }

.dh-drawer__sheet {
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 380px);
  height: 100%;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.dh-drawer.is-open .dh-drawer__sheet { transform: translateX(0); }

.dh-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #e2e8f0;
}

.dh-drawer__head strong {
  font-size: 1rem;
  color: #0f172a;
}

.dh-drawer__body {
  flex: 1 1 auto;
  overflow: auto !important;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.dh-drawer__link,
.dh-drawer__toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.dh-drawer__link:hover,
.dh-drawer__toggle:hover,
.dh-drawer__link.is-active {
  background: #ecfdf5;
  color: #0f766e;
}

.dh-drawer__link i:first-child,
.dh-drawer__toggle i:first-child {
  width: 1.15rem;
  margin-right: 0.35rem;
  color: #0f766e;
}

.dh-drawer__group { margin-bottom: 0.15rem; }

.dh-drawer__sub {
  display: none;
  padding: 0.1rem 0.2rem 0.45rem 0.85rem;
}

.dh-drawer__group.is-open > .dh-drawer__sub { display: block; }
.dh-drawer__group.is-open .dh-caret { transform: rotate(180deg); }

.dh-drawer__sub a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.dh-drawer__sub a:hover {
  background: #f1f5f9;
  color: #0f766e;
}

.dh-drawer__foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
}

.dh-drawer__foot .dh-btn {
  width: 100%;
}

body.dh-lock { overflow: hidden !important; }

/* Breakpoints */
@media (min-width: 1100px) {
  .dh-menu { display: block; }
  .dh-burger { display: none; }
}

@media (max-width: 1099.98px) {
  .dh-menu { display: none !important; }
  .dh-btn--ghost .dh-btn__label { display: none; }
  .dh-btn--ghost {
    width: 40px;
    padding: 0;
  }
  .dh-btn--solid i { display: none; }
}

@media (max-width: 420px) {
  .dh-logo { font-size: 1.02rem; }
  .dh-btn--solid {
    padding: 0 0.7rem;
    font-size: 0.8rem;
  }
}

/* Dark */
[data-theme="dark"] .dh-header,
[data-theme="dark"] .dh-mega,
[data-theme="dark"] .dh-drawer__sheet,
[data-theme="dark"] .dh-account__panel {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .dh-header.is-stuck,
[data-theme="dark"] .dh-header.is-fixed {
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  border-bottom-color: #334155;
}

[data-theme="dark"] .dh-logo,
[data-theme="dark"] .dh-drawer__head strong,
[data-theme="dark"] .dh-mega__text strong,
[data-theme="dark"] .dh-drawer__link,
[data-theme="dark"] .dh-drawer__toggle {
  color: #e2e8f0;
}

[data-theme="dark"] .dh-menu__link,
[data-theme="dark"] .dh-mega__text span,
[data-theme="dark"] .dh-drawer__sub a,
[data-theme="dark"] .dh-account__panel a {
  color: #cbd5e1;
}

[data-theme="dark"] .dh-menu__link:hover,
[data-theme="dark"] .dh-menu__link.is-active,
[data-theme="dark"] .dh-menu__list > li.is-open > .dh-menu__link,
[data-theme="dark"] .dh-mega__item:hover,
[data-theme="dark"] .dh-drawer__link:hover,
[data-theme="dark"] .dh-drawer__link.is-active {
  background: rgba(20, 184, 166, 0.12);
  color: #5eead4;
}

[data-theme="dark"] .dh-mega__icon {
  background: rgba(20, 184, 166, 0.15);
  color: #5eead4;
}

[data-theme="dark"] .dh-icon-btn,
[data-theme="dark"] .dh-burger,
[data-theme="dark"] .dh-btn--ghost {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .dh-btn--solid {
  background: #14b8a6;
  border-color: #14b8a6;
  color: #042f2e !important;
}

/* Kill legacy duplicate bars */
.nk-category-bar { display: none !important; }
