/* ============================================================
   HEADER MOBILE FIX — Autark Innovations
   Datum: 2026-05-12
   Zweck: Auf Mobile (<768px) NUR EINE schmale Header-Bar
          + Cookie-Banner als Toast (verdeckt CTAs nicht mehr)
          + Promo-/Sungrow-Bars hidden
   Ziel: ~ 220-280px Hero-Höhe zurückgewinnen, Above-the-fold CTA garantiert
   ============================================================ */

/* ====================================================
   1) DESKTOP: Promo-Bar bleibt, aber max 32px hoch
   ==================================================== */
@media (min-width: 769px) {
  html body .stb-bar {
    min-height: 32px !important;
    max-height: 36px !important;
    padding: 0 !important;
    font-size: 13px !important;
  }
  html body .stb-inner {
    padding: 6px 14px !important;
    min-height: 32px !important;
    font-size: 13px !important;
  }
}

/* ====================================================
   2) MOBILE (<768px) — Alle Top-Bars ausblenden außer Nav
   ==================================================== */
@media (max-width: 767.98px) {

  /* --- Promo-Bar (stb-bar / autark-promo-bar) komplett aus --- */
  html body .stb-bar,
  html body #autark-promo-bar,
  html body .sticky-top-bar,
  html body [id*="promo-bar"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* --- Sticky Trust-Bar (.stb 32px Marquee "47 Anlagen") auch aus --- */
  html body .stb,
  html body #autark-sticky-trust-bar {
    display: none !important;
    height: 0 !important;
    visibility: hidden !important;
  }
  html body.has-stb {
    padding-top: 0 !important;
  }
  html body.has-stb nav.nav,
  html body.has-stb nav#nav {
    top: 0 !important;
  }

  /* --- Sungrow Backup-Banner: auf Mobile dezent (max 28px) ODER ganz aus --- */
  /* Variante A: Komplett ausgeblendet (empfohlen für Hero-Conversion) */
  html body #sgb-wrapper,
  html body #sungrowBackupBanner {
    display: none !important;
    height: 0 !important;
    visibility: hidden !important;
  }

  /* --- Notifications / Tel-Banner / Trust-Strip im Header-Bereich aus --- */
  html body .top-notification-bar,
  html body .notif-bar,
  html body .tel-banner,
  html body .phone-strip,
  html body header > .promo,
  html body header > .alert {
    display: none !important;
  }

  /* --- NAV: max 56px Höhe, kompakt --- */
  html body nav#nav,
  html body nav.nav {
    min-height: 56px !important;
    max-height: 60px !important;
    padding: 6px 12px !important;
    gap: 6px !important;
    align-items: center !important;
  }

  /* --- Logo: max 32px Bild + kompakter Text --- */
  html body nav .nav-logo-link,
  html body nav .nav-logo {
    gap: 8px !important;
  }
  html body nav .nav-logo-link img,
  html body nav .nav-logo img {
    width: 32px !important;
    height: 32px !important;
  }
  html body nav .nav-logo-text {
    font-size: 14px !important;
    letter-spacing: 0.02em !important;
    line-height: 1 !important;
  }
  html body nav .nav-logo-sub {
    font-size: 9.5px !important;
    letter-spacing: 0.14em !important;
    color: rgba(255,255,255,0.65) !important;
    display: block !important;
    margin-top: 1px !important;
  }

  /* --- Nav-Right: NUR primary CTA "Angebot" + Burger sichtbar, rechts angedockt --- */
  html body nav .nav-right,
  html body nav.nav#nav .nav-right {
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    margin-left: auto !important;
  }
  /* Nav generell: flex-row mit Logo + Spacer + nav-right */
  html body nav.nav#nav,
  html body nav.nav,
  html nav.nav#nav,
  html nav.nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  html body nav.nav#nav .nav-logo-link,
  html body nav.nav .nav-logo-link {
    flex: 0 0 auto !important;
  }
  /* Nav-Links Container: auf Mobile HIDDEN außer wenn .open / aria-expanded */
  html body nav.nav#nav .nav-links,
  html body nav.nav .nav-links {
    display: none !important;
  }
  /* Wenn Burger geöffnet (navOverlay sichtbar): zeige .nav-links als Full-Overlay-Menu */
  html body nav.nav#nav .nav-links.active,
  html body nav.nav#nav .nav-links.open,
  html body nav.nav .nav-links.active,
  html body nav.nav .nav-links.open {
    display: flex !important;
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: calc(100vh - 60px) !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    padding: 16px 20px 24px !important;
    background: rgba(10, 20, 40, 0.98) !important;
    backdrop-filter: blur(20px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(140%) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 9990 !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4) !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
  }
  /* Jeder Nav-Link im offenen Menü: voll klickbar, ≥48px Höhe */
  html body nav.nav#nav .nav-links.open a,
  html body nav.nav#nav .nav-links.active a,
  html body nav.nav .nav-links.open a,
  html body nav.nav .nav-links.active a {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    color: #F0F6FF !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease !important;
  }
  html body nav.nav#nav .nav-links.open a:hover,
  html body nav.nav#nav .nav-links.open a:focus,
  html body nav.nav .nav-links.open a:hover,
  html body nav.nav .nav-links.open a:focus {
    background: rgba(56,189,248,0.12) !important;
    color: #38BDF8 !important;
  }
  /* Body-Scroll-Lock wenn Menü offen */
  html body:has(nav .nav-links.open),
  html body:has(nav .nav-links.active) {
    overflow: hidden !important;
  }
  html body nav.nav#nav .nav-right,
  html body nav.nav .nav-right {
    display: flex !important;
  }

  /* Phone-Link wird auf Mobile zum 44x44 Icon-Button (von viewport-layout.css) ODER ganz aus */
  /* Wir blenden Phone-Icon aus dem Header aus (steckt im Burger-Menü) - cleaner Look */
  html body nav #navPhone {
    display: none !important;
  }

  /* Rating + Senior-Toggle + Phone-Variants auf Mobile hidden (im Burger statt) */
  html body nav .nav-right #navRating,
  html body nav .nav-right .cw-senior-toggle,
  html body nav .nav-right span.nav-rating,
  html body nav .nav-right .nav-rating,
  html body nav #navPhoneText,
  html body nav .nav-phone-text {
    display: none !important;
  }

  /* PRIMARY CTA "Angebot" SICHTBAR auf Mobile.
     Höhere Specificity nötig (override aus mobile-fixes-v2.css /
     premium-foundation.css mit display:none !important). */
  html body nav.nav#nav .nav-right .nav-cta,
  html body nav.nav#nav.nav .nav-right .nav-cta,
  html body nav#nav .nav-right a.nav-cta,
  html body nav.nav.nav#nav .nav-right a.nav-cta {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #38BDF8 0%, #0EA5E9 100%) !important;
    color: #0A1428 !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    padding: 10px 14px !important;
    min-height: 44px !important;
    height: auto !important;
    width: auto !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(56,189,248,0.32), 0 1px 0 rgba(255,255,255,0.18) inset !important;
    border: 1px solid rgba(56,189,248,0.4) !important;
    white-space: nowrap !important;
    letter-spacing: 0 !important;
    line-height: 1.1 !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  html body nav.nav#nav .nav-right .nav-cta::after {
    content: "" !important;
  }
  html body nav.nav#nav .nav-right .nav-cta:active {
    transform: scale(0.97) !important;
  }
  /* Auf engen Screens: "Kostenloses Angebot →" gekürzt → JS setzt data-mobile-label="Angebot" */
  html body nav.nav#nav .nav-right .nav-cta[data-mobile-label] {
    /* keep narrow */
    max-width: 130px !important;
  }

  /* Auf sehr kleinen Phones (<360px): CTA-Label kürzen */
  @media (max-width: 359px) {
    html body nav .nav-right .nav-cta {
      font-size: 12px !important;
      padding: 8px 10px !important;
    }
  }

  /* Burger: 44x44, klare Hit-Area */
  html body nav #navBurger,
  html body nav .nav-burger {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* ====================================================
   3) SICKY NAV: Verschwindet beim Hoch-Scrollen NICHT
   (nav bleibt sticky/fixed, aber kompakter)
   ==================================================== */
@media (max-width: 767.98px) {
  html body nav#nav.nav-scrolled,
  html body nav.nav.nav-scrolled {
    background: rgba(8, 16, 32, 0.96) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
  }
}

/* ====================================================
   4) HERO: Erstes Section padding-top auf Mobile reduzieren
   (gewinnt weitere ~30px für CTA-Above-the-fold)
   ==================================================== */
@media (max-width: 767.98px) {
  html body main > section:first-of-type,
  html body main > .hero,
  html body section.hero:first-of-type,
  html body section.wow-hero,
  html body section.sb-hero,
  html body section[class*="hero"]:first-of-type {
    padding-top: clamp(64px, 14vw, 88px) !important;
    padding-bottom: 1.5rem !important;
  }
}

/* ====================================================
   5) COOKIE-BANNER: Greift NICHT mehr ins Hero (Toast 72-96px statt 200px+)
   Hauptdefinition in cookie-consent.js; hier OVERRIDE für ältere Bundle-Version
   (bundle-global.js trägt Pre-Toast-Version inline mit)
   ==================================================== */
/* Desktop: Toast-Layout 360px rechts unten — auch für alte Bundle-Version */
@media (min-width: 601px) {
  html body #cookieConsentOverlay:not(.cc-settings-mode) {
    justify-content: flex-end !important;
    padding: 0 16px 16px !important;
  }
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card {
    width: 360px !important;
    max-width: calc(100vw - 32px) !important;
    border-radius: 14px !important;
    border-top-width: 1px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04) !important;
    flex-wrap: wrap !important;
  }
}
@media (max-width: 767.98px) {
  /* Cookie-Banner darf max 130px hoch sein (2-row Layout, flex-wrap) */
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card {
    max-height: 130px !important;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
  }
  /* Text: 14px, wrap erlaubt für Lesbarkeit */
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-text {
    font-size: 14px !important;
    line-height: 1.4 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    margin: 0 !important;
    flex: 1 1 100% !important;
  }
  /* Buttons: 14px, flex-wrap statt nowrap (verhindert "Nur essenziellngen"-Overlap) */
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-btns {
    flex: 1 1 100% !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
    align-items: stretch !important;
  }
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-btn {
    padding: 11px 10px !important;
    font-size: 14px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-btn-primary {
    flex: 1 1 100% !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    padding: 12px 14px !important;
    order: 1 !important;
    min-height: 46px !important;
  }
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-btn-secondary {
    flex: 1 1 calc(50% - 6px) !important;
    font-size: 14px !important;
    padding: 11px 8px !important;
    order: 2 !important;
  }
  html body #cookieConsentOverlay:not(.cc-settings-mode) .cc-card .cc-btn-tertiary {
    flex: 1 1 calc(50% - 6px) !important;
    font-size: 14px !important;
    padding: 11px 6px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    order: 3 !important;
  }
  /* Wenn Cookie-Banner sichtbar: mobile-sticky-cta nach OBEN über Cookie-Bar */
  html body:has(#cookieConsentOverlay.cc-visible:not(.cc-settings-mode)) .mobile-sticky-cta,
  html body:has(#cookieConsentOverlay.cc-visible:not(.cc-settings-mode)) #mobileStickyCta {
    bottom: 108px !important;
  }
}

/* ====================================================
   6) ABOVE-THE-FOLD CTA GARANTIE
   Hero-CTA muss innerhalb 0-540px y-Position liegen
   ==================================================== */
@media (max-width: 767.98px) {
  /* Hero-CTA-Container: Begrenze auf max 360px Breite, klar zentriert */
  html body section[class*="hero"] .hero-cta,
  html body section[class*="hero"] .cta-primary,
  html body section[class*="hero"] a.btn-primary,
  html body section[class*="hero"] a.btn-glow,
  html body .hero-section .hero-cta,
  html body .hero-section .cta-primary {
    max-width: 360px !important;
    margin-inline: auto !important;
    min-height: 52px !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    padding: 14px 24px !important;
    letter-spacing: 0 !important;
  }
}

/* ====================================================
   7) FOCUS-STATES (WCAG-konform)
   ==================================================== */
html body nav .nav-cta:focus-visible,
html body #navBurger:focus-visible,
html body .nav-burger:focus-visible {
  outline: 2px solid #38BDF8 !important;
  outline-offset: 2px !important;
}

/* ====================================================
   8) Reduced Motion respektieren
   ==================================================== */
@media (prefers-reduced-motion: reduce) {
  html body nav .nav-right .nav-cta {
    transition: none !important;
  }
  html body nav .nav-right .nav-cta:active {
    transform: none !important;
  }
}

/* ====================================================
   9) Burger-Menu erweitert: Phone + WhatsApp Block am Ende
   (gefüllt via header-mobile-fix.js, hier nur Styling)
   ==================================================== */
.nav-mobile-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px 16px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-mobile-quick-actions a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  min-height: 52px !important;
  letter-spacing: 0 !important;
  transition: transform 0.15s ease, background 0.2s ease !important;
}
.nav-mobile-quick-actions a:active {
  transform: scale(0.97) !important;
}
.nav-mobile-quick-actions .nmq-phone {
  background: rgba(56,189,248,0.12) !important;
  color: #38BDF8 !important;
  border: 1px solid rgba(56,189,248,0.32) !important;
}
.nav-mobile-quick-actions .nmq-whatsapp {
  background: rgba(37,211,102,0.14) !important;
  color: #25D366 !important;
  border: 1px solid rgba(37,211,102,0.34) !important;
}
.nav-mobile-quick-actions .nmq-phone:hover {
  background: rgba(56,189,248,0.18) !important;
}
.nav-mobile-quick-actions .nmq-whatsapp:hover {
  background: rgba(37,211,102,0.20) !important;
}
.nav-mobile-quick-actions svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ====================================================
   10) Cookie-Banner active class: Tel/Sticky-CTA nach oben
   ==================================================== */
html.cc-banner-active .mobile-sticky-cta,
html.cc-banner-active #mobileStickyCta {
  bottom: 104px !important;
  transition: bottom 0.25s ease !important;
}

/* ====================================================
   11) WALLBOX-PAGE: site-header / container.row fix
       wallbox.html nutzt <header class="site-header">
       <div class="container row"> mit <nav> dahinter.
       JS injiziert weitere Nav-Inhalte → vertikales Stacking.
       Fix: nav-Inhalt zwingt zu flex-row, nowrap + overflow-clip.
   ==================================================== */
header.site-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 20, 40, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 8px 0 !important;
}
header.site-header .container.row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  min-height: 56px;
  max-height: 64px;
  overflow: hidden;
}
header.site-header .container.row > .brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}
header.site-header .container.row > .brand img {
  width: 32px;
  height: 32px;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}
header.site-header .container.row > .brand span {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
}
header.site-header .container.row > nav {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 18px !important;
  flex: 1 1 auto;
  justify-content: flex-end;
  overflow: hidden;
  max-height: 56px;
}
header.site-header .container.row > nav > a {
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0.9;
  padding: 6px 10px;
  border-radius: 8px;
}
header.site-header .container.row > nav > a:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
}
/* If JS injects extra nav-content (nav-links, nav-right, etc), hide it in site-header context */
header.site-header .container.row > nav > .nav-logo-link,
header.site-header .container.row > nav > .nav-links,
header.site-header .container.row > nav > .nav-right,
header.site-header .container.row > nav > .nav-bottom-row,
header.site-header .container.row > nav > .nav-mobile-quick-actions {
  display: none !important;
}
@media (max-width: 767.98px) {
  header.site-header { padding: 6px 0 !important; }
  header.site-header .container.row {
    min-height: 48px;
    max-height: 56px;
    padding: 0 12px;
  }
  header.site-header .container.row > nav > a {
    font-size: 0.85rem;
    padding: 6px 8px;
  }
}

/* ====================================================
   END HEADER-MOBILE-FIX
   ==================================================== */
