:root {
  --msf-bg: #fff;
  --msf-text: #000;
  --msf-badge: #ff0000;
  --msf-mobile-icon-size: 20px;
  --msf-mobile-text-size: 13px;
  --msf-cart-bg: #2271b1;
  --msf-cart-icon: #ffffff;
  --msf-cart-badge: #ff0000;
  --msf-cart-height: 20px;
  --msf-desktop-bg: #ffffff;
  --msf-desktop-text: #000000;
}

/* Mobile Footer Bar - Barrierefrei - ULTRA STICKY */
.msf-bar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  display: flex !important;
  justify-content: space-around;
  align-items: center;
  background: var(--msf-bg);
  color: var(--msf-text);
  border-top: 1px solid rgba(0,0,0,0.1);
  z-index: 2147483647 !important;
  padding: 10px 5px !important;
  min-height: 70px;
  max-height: 70px;
  transform: translate3d(0, 0, 0) !important;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-transform: translate3d(0, 0, 0) !important;
  -webkit-perspective: 1000;
  perspective: 1000;
  margin: 0 !important;
  overflow: visible !important;
  clip-path: none !important;
}

/* Force Position - Override EVERYTHING */
body .msf-bar,
html .msf-bar,
#page .msf-bar,
.site .msf-bar,
main .msf-bar,
div .msf-bar {
  position: fixed !important;
  bottom: 0 !important;
}

/* iOS Safari Fix - Verhindert Springen beim Scrollen */
@supports (-webkit-touch-callout: none) {
  .msf-bar {
    position: fixed !important;
    bottom: 0 !important;
    bottom: env(safe-area-inset-bottom, 0) !important;
  }
}

/* Fallback für ältere Browser */
@media (max-width: 767px) {
  body {
    padding-bottom: 75px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  
  html {
    scroll-padding-bottom: 75px;
    overflow-x: hidden !important;
  }
  
  /* Stelle sicher dass kein Parent-Container den Footer clippt */
  body > * {
    overflow-x: visible !important;
  }
}

.msf-bar a.msf-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--msf-text);
  font-size: var(--msf-mobile-text-size);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background-color 0.2s;
  border-radius: 4px;
  min-height: 50px;
  gap: 4px;
}

/* Barrierefreiheit: Fokus-Styles */
.msf-bar a.msf-item:focus,
.msf-float-item:focus,
.msf-cart-widget:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Barrierefreiheit: Hover und Active States */
.msf-bar a.msf-item:hover {
  background-color: rgba(0,0,0,0.05);
}

.msf-bar a.msf-item:active {
  transform: scale(0.95);
}

.msf-bar i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--msf-mobile-icon-size);
  pointer-events: none;
  line-height: 1;
  width: 1.25em;
  height: 1.25em;
  text-align: center;
}

.msf-bar span {
  pointer-events: none;
  line-height: 1.2;
  display: block;
  text-align: center;
}

/* Legacy Cart Badge für normale Icons */
.cart-badge {
  position: absolute;
  top: 0; 
  right: 20%;
  background: var(--msf-badge);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  width: 16px; 
  height: 16px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-weight: bold;
  pointer-events: none;
}

/* Warenkorb-Widget (mittig, hervorgehoben) */
.msf-cart-widget {
  position: relative;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 5px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  border-radius: 50%;
  overflow: visible !important;
}

/* WICHTIG: Permanente Klasse die nicht überschrieben werden kann */
.msf-permanent-cart {
  position: relative !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  overflow: visible !important;
}

.msf-cart-widget:hover {
  transform: scale(1.05);
}

.msf-cart-widget:active {
  transform: scale(0.95) translateY(2px);
}

.msf-cart-circle {
  position: relative !important;
  width: 60px !important;
  height: 60px !important;
  background: var(--msf-cart-bg) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15) !important;
  border: 3px solid var(--msf-bg) !important;
  transform: translateY(-25px) !important;
  transition: all 0.3s !important;
}

.msf-cart-widget:hover .msf-cart-circle {
  transform: translateY(-28px) !important;
  box-shadow: 0 -6px 16px rgba(0,0,0,0.2) !important;
}

.msf-cart-circle i {
  font-size: 26px !important;
  color: var(--msf-cart-icon) !important;
  pointer-events: none !important;
}

.msf-cart-count {
  position: absolute !important;
  top: 2px !important;
  right: 2px !important;
  background: var(--msf-cart-badge) !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 22px !important;
  height: 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: bold !important;
  border: 2px solid var(--msf-bg) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
  pointer-events: none !important;
}

/* Layout-Anpassung wenn Warenkorb aktiv */
.msf-bar.has-cart-widget {
  justify-content: space-between;
  padding: 0 10px 5px 10px;
  overflow: visible !important;
}

.msf-bar.has-cart-widget .msf-item {
  flex: 0 1 auto;
  min-width: 60px;
}

/* Floating Widget - Slide-Out Design mit anpassbaren Farben */
.msf-floating-widget {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.msf-float-item {
  background: var(--msf-desktop-bg);
  color: var(--msf-desktop-text);
  text-decoration: none;
  border-radius: 0 25px 25px 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
  overflow: hidden;
  white-space: nowrap;
}

.msf-float-item i {
  font-size: 20px;
  min-width: 20px;
  transition: all 0.3s;
  color: var(--msf-desktop-text);
  pointer-events: none;
}

.msf-float-item .tooltip {
  opacity: 0;
  max-width: 0;
  margin-left: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  color: var(--msf-desktop-text);
  pointer-events: none;
}

.msf-float-item:hover,
.msf-float-item:focus {
  width: auto;
  padding-right: 20px;
  padding-left: 15px;
  box-shadow: 3px 3px 12px rgba(0,0,0,0.25);
}

.msf-float-item:hover .tooltip,
.msf-float-item:focus .tooltip {
  opacity: 1;
  max-width: 200px;
  margin-left: 12px;
}

.msf-float-item:hover i,
.msf-float-item:focus i {
  margin-right: 0;
}

.msf-float-item:active {
  transform: scale(0.95);
}

/* Responsives Verhalten */
@media (min-width: 768px) {
  .msf-bar { 
    display: none !important; 
  }
}

@media (max-width: 767px) {
  .msf-floating-widget { 
    display: none !important; 
  }
}

/* Animation für Badge-Update */
@keyframes badgePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.msf-cart-count.updated,
.cart-badge.updated {
  animation: badgePop 0.3s ease;
}

/* Barrierefreiheit: Reduzierte Bewegung */
@media (prefers-reduced-motion: reduce) {
  .msf-bar a.msf-item,
  .msf-float-item,
  .msf-cart-widget,
  .msf-cart-circle,
  .msf-float-item i,
  .msf-float-item .tooltip {
    transition: none !important;
    animation: none !important;
  }
}

/* Barrierefreiheit: Hoher Kontrast Modus */
@media (prefers-contrast: high) {
  .msf-bar,
  .msf-float-item {
    border: 2px solid currentColor;
  }
  
  .msf-bar a.msf-item:focus,
  .msf-float-item:focus,
  .msf-cart-widget:focus {
    outline: 3px solid currentColor;
    outline-offset: 3px;
  }
}

/* Skip-Link für Screenreader (falls gewünscht) */
.msf-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100000;
}

.msf-skip-link:focus {
  top: 0;
}

/* Barrierefreiheit: Mindestgröße für Touch-Targets (44x44px nach WCAG) */
.msf-bar a.msf-item,
.msf-float-item,
.msf-cart-widget {
  min-width: 44px;
  min-height: 44px;
}
