/**
 * PTLS Menu System CSS
 * Vollständiger CSS-Ersatz für das Uncode Menüsystem
 * @version 2.0.0
 */

/* =============================================================================
   GLOBALE FOKUS-VERWALTUNG - Keyboard vs Maus Navigation
   ============================================================================= */

/* Globale Regel: Entferne alle Fokus-Rings bei Maus-Navigation */
body.using-mouse *:focus,
body.using-mouse *:focus-visible {
  outline: none !important;
  /* Optional: Behalte subtile Indikation für Accessibility */
  /* box-shadow: none !important; */
}

/* Menü-spezifische Regel: Fokus-Rings nur bei Keyboard-Navigation im Menübereich */
body.using-keyboard .menu-primary-inner *:focus-visible,
body.using-keyboard .main-menu-container *:focus-visible,
body.using-keyboard .mobile-menu-button:focus-visible {
  /* Menü-spezifische Fokus-Ring Farbe */
  outline: 2px solid #0073aa !important;
  outline-offset: -2px !important;
}

/* =============================================================================
   DESKTOP MENU STYLES
   ============================================================================= */

/* PTLS Menu System CSS Override - Überschreibe SmartMenus komplett */
.menu-primary-inner .drop-menu.show-menu {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  position: absolute !important;
  z-index: 9999 !important;
  left: 0px !important;
  top: 100% !important;
  transform: none !important;
  min-width: 200px !important;
}

.menu-primary-inner .drop-menu:not(.show-menu) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Überschreibe alle SmartMenus Inline-Styles - AGGRESSIVE Überschreibung */
.menu-primary-inner .drop-menu[style*="display: none"],
.menu-primary-inner .drop-menu[style*="visibility: hidden"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Forciere sichtbare Submenus - ULTRA AGGRESSIVE */
.menu-primary-inner .drop-menu.show-menu,
.menu-primary-inner .drop-menu.show-menu[style*="display: none"],
.menu-primary-inner .drop-menu.show-menu[style*="visibility: hidden"],
.menu-primary-inner .drop-menu.show-menu[style] {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  position: absolute !important;
  left: 0px !important;
  top: 100% !important;
  z-index: 9999 !important;
  min-width: 200px !important;
}

/* Parent Item Positioning */
.menu-primary-inner > li {
  position: relative !important;
}

/* Force Submenu Content Visibility */
.menu-primary-inner .drop-menu.show-menu li,
.menu-primary-inner .drop-menu.show-menu a {
  display: block !important;
  visibility: visible !important;
}

/* Submenu UL Container - Padding links und rechts */
.menu-primary-inner .drop-menu.show-menu {
  /* padding-left: 6px !important;
  padding-right: 8px !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important; */
}

/* Ultra-spezifische Content-Regeln */
.menu-primary-inner .drop-menu.show-menu li[role="menuitem"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  height: auto !important;
  overflow: visible !important;
}

.menu-primary-inner .drop-menu.show-menu a[role="menuitem"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  height: auto !important;
  overflow: visible !important;
}

/* Überschreibe alle möglichen versteckenden Inline-Styles */
.menu-primary-inner .drop-menu.show-menu li[style*="display: none"] {
  display: block !important;
}

.menu-primary-inner .drop-menu.show-menu li[style*="visibility: hidden"] {
  visibility: visible !important;
}

.menu-primary-inner .drop-menu.show-menu a[style*="display: none"] {
  display: block !important;
}

.menu-primary-inner .drop-menu.show-menu a[style*="visibility: hidden"] {
  visibility: visible !important;
}

/* =============================================================================
   DESKTOP HOVER - Nur außerhalb Mobile Breakpoint
   ============================================================================= */

/* Desktop Hover - funktioniert nur auf größeren Bildschirmen */
@media (min-width: 960px) {
  /* Standard: Alle Submenus versteckt, außer show-menu */
  .menu-primary-inner .drop-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* Zeige Submenus mit show-menu Klasse IMMER (höchste Priorität) */
  .menu-primary-inner .drop-menu.show-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    z-index: 9999 !important;
    left: 0px !important;
    top: 98% !important;
    min-width: 200px !important;
  }

  /* Hover öffnet Submenus (funktioniert IMMER unabhängig von show-menu Klasse) */
  /* .menu-primary-inner > li:hover > .drop-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    z-index: 9999 !important;
    left: 0px !important;
    top: 98% !important;
    min-width: 200px !important;
  } */

  /* Desktop Hover - Submenu Content Sichtbarkeit für ALLE Hover-Zustände */
  .menu-primary-inner > li:hover .drop-menu li,
  .menu-primary-inner > li:hover .drop-menu a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Desktop Fokus-Styling - nur bei Keyboard-Navigation UND using-keyboard Klasse */
  body.using-keyboard .menu-primary-inner > li > a:focus-visible {
    outline: 2px solid #0073aa !important;
    outline-offset: -2px !important;
    background-color: transparent !important;
    border-radius: 3px !important;
    /* Kein zusätzliches Padding - verhindert Verschiebung */
    /* Kein zusätzliches Margin - verhindert Layout-Sprünge */
  }

  /* Desktop Fokus-Verhalten - Öffne Submenu sofort bei Fokus auf Hauptelement */
  /* body.using-keyboard .menu-primary-inner > li > a:focus + .drop-menu,
  body.using-keyboard .menu-primary-inner > li > a:focus-visible + .drop-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: absolute !important;
    z-index: 9999 !important;
    left: 0px !important;
    top: 98% !important;
    min-width: 200px !important;
  } */

  /* Desktop Fokus-within - Halte Submenu offen während Navigation im Submenu */
  /* body.using-keyboard .menu-primary-inner > li:focus-within .drop-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: absolute !important;
    z-index: 9999 !important;
    left: 0px !important;
    top: 98% !important;
    min-width: 200px !important;
  } */

  /* Desktop Fokus - Submenu Content Sichtbarkeit - KRITISCH für Fokus-Navigation */
  body.using-keyboard .menu-primary-inner > li > a:focus + .drop-menu li,
  body.using-keyboard .menu-primary-inner > li > a:focus + .drop-menu a,
  body.using-keyboard
    .menu-primary-inner
    > li
    > a:focus-visible
    + .drop-menu
    li,
  body.using-keyboard .menu-primary-inner > li > a:focus-visible + .drop-menu a,
  body.using-keyboard .menu-primary-inner > li:focus-within .drop-menu li,
  body.using-keyboard .menu-primary-inner > li:focus-within .drop-menu a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* KRITISCH: Verstecke alle anderen Submenus bei Keyboard-Navigation - NUR wenn aktiv mit Keyboard navigiert wird */
  body.using-keyboard
    .menu-primary-inner
    > li:not(:focus-within):not(:hover)
    .drop-menu:not(.show-menu) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* KRITISCH: Bei Keyboard-Navigation haben fokussierte Elemente Priorität über Hover - nur wenn Menü fokussiert ist */
  body.using-keyboard
    .menu-primary-inner:focus-within
    > li:hover:not(:focus-within)
    .drop-menu:not(.show-menu) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* Entferne Fokus-Styling komplett bei Maus-Navigation */
  body.using-mouse .menu-primary-inner > li > a:focus-visible,
  body.using-mouse .menu-primary-inner > li > a:focus {
    outline: none !important;
    background-color: transparent !important;
  }

  /* Entferne Standard-Fokus für Maus-Klicks */
  .menu-primary-inner > li > a:focus:not(:focus-visible) {
    outline: none !important;
    background-color: transparent !important;
  }

  /* Desktop Submenu-Links Fokus-Styling - nur bei Keyboard-Navigation */
  body.using-keyboard .menu-primary-inner .drop-menu a:focus-visible {
    outline: 2px solid #0073aa !important;
    outline-offset: -2px !important;
    background-color: transparent !important;
    border-radius: 3px !important;
    /* Kein zusätzliches Padding - verhindert Verschiebung */
    /* Kein zusätzliches Margin - verhindert Layout-Sprünge */
  }

  /* Entferne Fokus-Styling komplett bei Maus-Navigation in Submenus */
  body.using-mouse .menu-primary-inner .drop-menu a:focus-visible,
  body.using-mouse .menu-primary-inner .drop-menu a:focus {
    outline: none !important;
    background-color: transparent !important;
  }

  /* Entferne Standard-Fokus für Maus-Klicks in Submenus */
  .menu-primary-inner .drop-menu a:focus:not(:focus-visible) {
    outline: none !important;
    background-color: transparent !important;
  }
} /* =============================================================================
   MOBILE HOVER DEAKTIVIERUNG - Verhindert Hover-Effekte auf Touch-Geräten
   ============================================================================= */

/* Deaktiviere alle Hover-Effekte auf Mobile-Geräten */
@media (max-width: 767px) {
  /* Überschreibe alle Hover-Styles für Menü-Elemente */
  .menu-primary-inner.menu-smart li:hover,
  .menu-primary-inner.menu-smart li:hover > a,
  .menu-primary-inner.menu-smart li:hover .drop-menu {
    display: inherit !important;
    visibility: inherit !important;
    opacity: inherit !important;
    transform: inherit !important;
  }

  /* Verhindere dass Submenus durch Hover geöffnet werden */
  .menu-primary-inner.menu-smart li:hover > .drop-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  /* Nur explizit geöffnete Submenus (.show-menu) sollen sichtbar sein */
  .menu-primary-inner.menu-smart .drop-menu.show-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* =============================================================================
   MOBILE MENU STYLES - Stelle sicher dass Mobile Menu funktioniert
   ============================================================================= */

/* Mobile Menu Button - Stelle sicher dass der Button funktioniert */
.mobile-menu-button {
  cursor: pointer !important;
  pointer-events: auto !important;
  display: flex !important;
  align-items: center !important;
  position: relative !important;
  z-index: 1000 !important;
  width: auto !important;
  height: auto !important;
  min-height: 60px !important;
}

/* Mobile Menu Button Fokus-Styles - nur bei Keyboard-Navigation */
body.using-keyboard .mobile-menu-button:focus-visible {
  outline: 2px solid #0073aa !important;
  outline-offset: -2px !important;
  border-radius: 3px !important;
}

/* Entferne Mobile Menu Button Fokus bei Maus-Navigation */
body.using-mouse .mobile-menu-button:focus-visible,
body.using-mouse .mobile-menu-button:focus {
  outline: none !important;
  background-color: transparent !important;
}

/* Entferne Standard-Fokus für Mobile Menu Button bei Maus-Klicks */
.mobile-menu-button:focus:not(:focus-visible) {
  outline: none !important;
  background-color: transparent !important;
}

/* Mobile Menu Container - Sanfte Transition aber ohne aggressive Überschreibung */
.main-menu-container {
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* Mobile Menu geschlossen - nur auf mobilen Geräten verstecken */
@media (max-width: 960px) {
  /* Weniger aggressive Überschreibung - lasse Uncode das Display steuern */
  .main-menu-container:not(.open-items) {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* Mobile Menu geöffnet - erzwinge Sichtbarkeit mit korrekter Höhenbegrenzung */
  .main-menu-container.open-items {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
    height: auto !important;
    max-height: calc(
      100vh - 200px
    ) !important; /* Begrenzt die Höhe auf Viewport minus Header */
    overflow-y: auto !important; /* Ermöglicht vertikales Scrollen */
    overflow-x: hidden !important;
    position: relative !important;
    z-index: 10000 !important;
    -webkit-overflow-scrolling: touch !important; /* Smooth Scrolling auf iOS */
  }

  /* Force alle Menü-Elemente sichtbar wenn Mobile Menu offen */
  .main-menu-container.open-items .menu-horizontal,
  .main-menu-container.open-items .menu-horizontal-inner,
  .main-menu-container.open-items .navbar-nav,
  .main-menu-container.open-items .menu-primary-inner {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Force alle Li-Elemente sichtbar */
  .main-menu-container.open-items .menu-primary-inner li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 100% !important;
  }

  /* Force alle Links sichtbar mit KONSISTENTEM Layout */
  .main-menu-container.open-items .menu-primary-inner a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
  }

  /* Spezielle Behandlung für Submenu-Links */
  .main-menu-container.open-items .menu-primary-inner .drop-menu a {
    /* Submenu-Links erben das gleiche Layout wie Hauptmenü-Links */
    margin-left: 0 !important; /* Kein zusätzlicher linker Margin */
  }

  /* Mobile Submenus - standardmäßig eingeklappt */
  .main-menu-container.open-items .menu-primary-inner .drop-menu {
    position: static !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease, opacity 0.3s ease !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    margin-left: 20px !important;
    top: auto !important;
    left: auto !important;
    min-width: auto !important;
    width: 100% !important;
  }

  /* KRITISCH: Mobile Submenus werden NUR durch .show-menu Klasse gesteuert */
  /* KEINE automatische Submenu-Öffnung durch :focus oder :focus-within auf Mobile */
  /* Das verhindert ungewollte automatische Submenu-Öffnungen beim Tab zwischen Hauptmenü-Items */

  /* NUR show-menu Klasse steuert Mobile Submenu-Sichtbarkeit */
  .main-menu-container.open-items .menu-primary-inner .drop-menu.show-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 500px !important;
  }

  /* KONSISTENTE Fokus-Styles für Mobile - nur bei Keyboard-Navigation */
  body.using-keyboard
    .main-menu-container.open-items
    .menu-primary-inner
    > li
    > a:focus-visible,
  body.using-keyboard
    .main-menu-container.open-items
    .menu-primary-inner
    .drop-menu
    a:focus-visible {
    outline: 2px solid #0073aa !important;
    outline-offset: -2px !important;
    border-radius: 3px !important;
  }

  /* Entferne Fokus-Styling komplett bei Maus-Navigation auf Mobile */
  body.using-mouse
    .main-menu-container.open-items
    .menu-primary-inner
    > li
    > a:focus-visible,
  body.using-mouse
    .main-menu-container.open-items
    .menu-primary-inner
    > li
    > a:focus,
  body.using-mouse
    .main-menu-container.open-items
    .menu-primary-inner
    .drop-menu
    a:focus-visible,
  body.using-mouse
    .main-menu-container.open-items
    .menu-primary-inner
    .drop-menu
    a:focus {
    outline: none !important;
    background-color: transparent !important;
  }

  /* Entferne Standard-Fokus für Maus-Klicks auf Mobile - KONSISTENT */
  .main-menu-container.open-items
    .menu-primary-inner
    > li
    > a:focus:not(:focus-visible),
  .main-menu-container.open-items
    .menu-primary-inner
    .drop-menu
    a:focus:not(:focus-visible) {
    outline: none !important;
    background-color: transparent !important;
  }

  /* Stelle sicher dass Desktop-Submenu-Regeln auf Mobile überschrieben werden */
  .main-menu-container.open-items .menu-primary-inner .drop-menu.show-menu {
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
  }

  /* Submenu-Inhalte sichtbar wenn per JavaScript erweitert (show-menu Klasse) - KONSISTENTES Verhalten */
  .main-menu-container.open-items .menu-primary-inner .drop-menu.show-menu li,
  .main-menu-container.open-items .menu-primary-inner .drop-menu.show-menu a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Keyboard Navigation Support - nur per show-menu Klasse */
  .main-menu-container.open-items
    .menu-primary-inner
    > li
    > a[aria-expanded="true"]
    + .drop-menu.show-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 500px !important;
  }
}
