/* ═══════════════════════════════════════════════════════════════
   HEADER & NAVIGATION — Desktop + Mobile
   Eigenständige Datei, überschreibt ALLE Header-Regeln aus style.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Mobile-only elements: hidden on desktop ── */
.mf-mobilenav__header,
.mf-mobilenav__footer,
.mf-mobile-cart-link { display: none; }

/* ── MEGA MENU — Base (Desktop) ── */
.mfh-mega { position: relative; }

.mfh-mega__toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mf-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: color .2s;
}
.mfh-mega:hover .mfh-mega__toggle { color: var(--mf-gold); }

.mfh-mega__toggle svg {
  width: 14px; height: 14px;
  transition: transform .2s;
}
.mfh-mega:hover .mfh-mega__toggle svg { transform: rotate(180deg); }

/* Hover bridge (invisible area between toggle and dropdown) */
.mfh-mega::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  height: 24px;
  z-index: 99;
  display: none;
}
.mfh-mega:hover::after { display: block; }

/* ── Dropdown — Desktop (default hidden, show on hover) ── */
.mfh-mega__dropdown {
  position: absolute;
  top: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 720px;
  max-width: 90vw;
  background: var(--mf-surface);
  border: 1px solid var(--mf-line);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
  z-index: 100;
  padding: 24px;
  overflow: hidden;
}
:root[data-theme="dark"] .mfh-mega__dropdown {
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.mfh-mega:hover .mfh-mega__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── Unified Mega (for "Kategorien" toggle) ── */
.mfh-mega--unified { position: static; }
.mfh-mega--unified .mfh-mega__toggle {
  position: relative;
  z-index: 101;
}
.mfh-mega--unified .mfh-mega__toggle::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--mf-gold);
  border-radius: 2px;
  transition: width .2s, left .2s;
}
.mfh-mega--unified:hover .mfh-mega__toggle::after {
  width: 100%;
  left: 0;
}

/* ── Cat-Mega inner structure (Desktop) ── */
.mfh-mega__dropdown.mfh-cat-mega {
  position: fixed;
  top: auto;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 780px;
  max-width: 92vw;
  padding: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.mfh-mega:hover > .mfh-mega__dropdown.mfh-cat-mega {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1060px) {
  .mfh-mega__dropdown.mfh-cat-mega { left: 0; right: 0; transform: translateY(10px); }
  .mfh-mega:hover > .mfh-mega__dropdown.mfh-cat-mega { transform: translateY(0); }
}

.mfh-cat-mega__inner {
  display: flex;
  min-height: 260px;
}
.mfh-cat-mega__sidebar {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--mf-line);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mfh-cat-mega__tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mf-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.mfh-cat-mega__tab:hover { background: rgba(179,144,71,.05); color: var(--mf-text); }
.mfh-cat-mega__tab.is-active {
  background: rgba(179,144,71,.08);
  color: var(--mf-gold);
  font-weight: 700;
}
.mfh-cat-mega__tab svg { opacity: .4; }
.mfh-cat-mega__tab.is-active svg { opacity: 1; color: var(--mf-gold); }

.mfh-cat-mega__panels {
  flex: 1;
  position: relative;
  padding: 24px;
}
.mfh-cat-mega__panel {
  display: none;
}
.mfh-cat-mega__panel.is-active {
  display: block;
  animation: mfCatFadeIn .2s ease;
}
@keyframes mfCatFadeIn {
  from { opacity: 0; transform: translateX(6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.mfh-cat-mega__cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.mfh-cat-mega__card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.mfh-cat-mega__card:hover {
  background: rgba(179,144,71,.04);
  border-color: var(--mf-line);
}
.mfh-cat-mega__card-img {
  width: 52px; height: 52px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--mf-bg, #f5f5f5);
}
.mfh-cat-mega__card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.mfh-cat-mega__card:hover .mfh-cat-mega__card-img img {
  transform: scale(1.05);
  transition: transform .3s;
}
.mfh-cat-mega__card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mfh-cat-mega__card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mf-text);
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mfh-cat-mega__card-sub {
  font-size: 11.5px;
  color: var(--mf-muted);
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mfh-cat-mega__card-count {
  font-size: 11px;
  color: var(--mf-gold);
  font-weight: 600;
}

/* ── Info Dropdown — Desktop ── */
.mfh-info-dropdown {
  width: 520px;
}
.mfh-info-dropdown__inner {
  display: flex;
  gap: 24px;
}
.mfh-info-dropdown__group {
  flex: 1;
}
.mfh-info-dropdown__label {
  display: block;
  padding: 0 0 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mf-muted);
}
.mfh-info-dropdown__link {
  display: block;
  padding: 8px 0;
  text-decoration: none;
  color: var(--mf-text);
  font-size: 13px;
  font-weight: 600;
  transition: color .15s;
}
.mfh-info-dropdown__link:hover { color: var(--mf-gold); }
.mfh-info-dropdown__link small {
  display: block;
  font-size: 11px;
  color: var(--mf-muted);
  font-weight: 400;
  margin-top: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE NAVIGATION (max-width: 980px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {

  /* ── Nav container: fullscreen overlay ── */
  .mf-header__nav {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1500;
    background: var(--mf-surface);
    padding: 0;
    gap: 0;
    flex-direction: column;
    justify-content: flex-start !important;
    align-items: stretch;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.mf-mobile-nav-open .mf-header__nav,
  .mf-header__nav.is-open {
    display: flex;
  }
  body.mf-mobile-nav-open .mf-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* ── Mobile Nav Header (logo + close) ── */
  .mf-mobilenav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--mf-line);
    flex-shrink: 0;
  }
  .mf-mobilenav__logo img {
    height: 28px;
    width: auto;
    display: block;
  }
  /* Logo is white in source — invert to black in light mode, keep white in dark */
  :root:not([data-theme="dark"]) .mf-mobilenav__logo img {
    filter: invert(1);
  }
  :root[data-theme="dark"] .mf-mobilenav__logo img {
    filter: none;
  }
  .mf-mobilenav__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--mf-line);
    background: rgba(255,255,255,.04);
    color: var(--mf-text);
    cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  .mf-mobilenav__close:hover {
    background: rgba(179,144,71,.1);
    border-color: var(--mf-gold);
    color: var(--mf-gold);
  }

  /* Hide the old ::before "Menü" label */
  .mf-header__nav::before {
    display: none !important;
  }

  /* ── Mobile Nav Footer (theme toggle) ── */
  .mf-mobilenav__footer {
    display: block !important;
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--mf-line);
  }
  .mf-mobilenav__theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--mf-line);
    background: rgba(255,255,255,.03);
    color: var(--mf-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  .mf-mobilenav__theme-toggle:hover {
    background: rgba(179,144,71,.06);
    border-color: var(--mf-gold);
  }
  .mf-mobilenav__theme-toggle svg {
    color: var(--mf-gold);
    flex-shrink: 0;
  }

  /* ── Top-level links ── */
  .mf-header__nav > a {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    color: var(--mf-text);
    text-decoration: none;
    border-bottom: 1px solid var(--mf-line);
    transition: background .15s;
  }
  .mf-header__nav > a:active { background: rgba(179,144,71,.06); }
  .mf-header__nav > :last-child { border-bottom: none; }

  /* ── Mega toggle styling ── */
  .mf-header__nav > .mfh-mega {
    display: block;
    width: 100%;
    border-bottom: 1px solid var(--mf-line);
  }
  .mf-header__nav > .mfh-mega > .mfh-mega__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    color: var(--mf-text);
    text-decoration: none;
  }
  .mf-header__nav > .mfh-mega > .mfh-mega__toggle:active {
    background: rgba(179,144,71,.06);
  }
  .mf-header__nav > .mfh-mega > .mfh-mega__toggle svg {
    margin-left: auto;
    color: var(--mf-muted);
    transition: transform .25s;
  }

  /* Hide desktop-only elements */
  .mfh-mega::after { display: none !important; }
  .mfh-mega--unified .mfh-mega__toggle::after { display: none !important; }
  .mf-header__nav a[href="#"] { display: none; }
  .mf-header__nav::after { display: none; }

  /* ══════════════════════════════════════════
     DROPDOWN PANELS — Mobile Reset
     CRITICAL: Override ALL desktop positioning/hiding
     ══════════════════════════════════════════ */
  .mf-header__nav .mfh-mega__dropdown,
  .mf-header__nav .mfh-mega__dropdown.mfh-cat-mega,
  .mf-header__nav .mfh-info-dropdown {
    /* Kill desktop positioning */
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    /* Kill desktop visibility hiding */
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    /* Kill desktop decoration */
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 1px solid var(--mf-line) !important;
    padding: 0 !important;
    margin: 0 !important;
    /* Fixed/absolute reset */
    bottom: auto !important;
    max-height: none !important;
    overflow: visible !important;
    /* Background */
    background: var(--mf-surface) !important;
  }

  /* Default: collapsed (hidden) */
  .mf-header__nav .mfh-mega__dropdown {
    display: none !important;
  }

  /* Expanded: when JS adds .is-mobile-open */
  .mf-header__nav .mfh-mega.is-mobile-open > .mfh-mega__dropdown {
    display: block !important;
  }

  /* Rotate chevron when open */
  .mfh-mega.is-mobile-open > .mfh-mega__toggle svg {
    transform: rotate(180deg);
  }

  /* ── Cat-Mega on Mobile: list layout ── */
  .mfh-cat-mega__inner {
    flex-direction: column !important;
  }
  .mfh-cat-mega__sidebar {
    display: none !important;
  }
  .mfh-cat-mega__panels {
    width: 100% !important;
    padding: 8px 0 !important;
  }
  /* Show ALL panels on mobile (not just .is-active) */
  .mfh-cat-mega__panel {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .mfh-cat-mega__cards {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Card styling for mobile list */
  .mfh-cat-mega__card {
    border-radius: 0;
    padding: 14px 16px;
    gap: 14px;
    border-bottom: 1px solid var(--mf-line);
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  .mfh-cat-mega__card:last-child { border-bottom: none; }
  .mfh-cat-mega__card:hover { background: rgba(179,144,71,.05); }
  .mfh-cat-mega__card:active { background: rgba(179,144,71,.08); }
  .mfh-cat-mega__card-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .mfh-cat-mega__card-title { font-size: 14px; }
  .mfh-cat-mega__card-sub { font-size: 11px; }
  .mfh-cat-mega__card-count { font-size: 11px; }

  /* ── Info Dropdown — Mobile ── */
  .mfh-info-dropdown__inner {
    flex-direction: column;
    padding: 8px 0;
    gap: 0;
  }
  .mfh-info-dropdown__group {
    border-bottom: 1px solid var(--mf-line);
    padding: 8px 0;
  }
  .mfh-info-dropdown__group:last-child { border-bottom: none; }
  .mfh-info-dropdown__label {
    padding: 4px 16px;
    font-size: 10px;
  }
  .mfh-info-dropdown__link {
    padding: 12px 16px;
  }

  /* ── Mobile cart link in menu ── */
  .mf-mobile-cart-link {
    display: flex !important;
    align-items: center;
    gap: 12px;
    color: var(--mf-text);
    font-size: 15px;
    font-weight: 700;
    padding: 16px 24px;
    border-bottom: 1px solid var(--mf-line);
    text-decoration: none;
  }

  /* ── Hamburger button ── */
  .mf-menu-toggle {
    display: inline-flex;
    order: -1;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--mf-line);
  }

  /* ── Header layout adjustments ── */
  .mf-header__brand { order: 0; flex: 1 1 auto; }
  .mf-header__nav { order: 1; }
  .mf-header__actions { order: 2; gap: 10px; }
  .mf-header__inner { justify-content: space-between; min-height: 60px; gap: 10px; }
  .mf-header__logo { width: 150px; }
  .mf-header__actions .mf-theme-toggle { display: none !important; }
  .mf-header__actions .mf-account-link span { display: none; }
}
