/*
 * =====================================================
 * BFS Mobile Optimization
 * =====================================================
 * Eine Datei, die alle Mobile-Anpassungen abdeckt.
 * In jeder HTML-Datei einmal verlinken — fertig.
 *
 * Strategie:
 * - Nicht das Design auf dem Desktop ändern
 * - Nur dort eingreifen wo Mobile-Geräte (≤768px / ≤480px) leiden
 * - Hamburger-Menü statt versteckter Navigation
 * - Schriften proportional kleiner
 * - Grids/Tabellen einspaltig stapeln
 * - Buttons vergrößern (mind. 44px Touch-Target)
 *
 * Reihenfolge: Diese Datei MUSS *nach* den Original-Styles
 * geladen werden, damit die Mobile-Regeln greifen.
 * =====================================================
 */

/* =====================================================
   1. VIEWPORT-SICHERHEIT
   ===================================================== */
/* Hinweis: max-width oder overflow auf html/body würde
   position:sticky brechen. Wir lassen diese hier weg. */


/* Bilder/Videos nie über Container hinaus */
img, video, svg, iframe {
  max-width: 100%;
  height: auto;
}

/* =====================================================
   2. HAMBURGER-MENÜ (immer eingebaut, sichtbar nur Mobile)
   ===================================================== */

/* Hamburger-Button: per Default versteckt, taucht auf Mobile auf */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border, #2a5a44);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--ink-100, #f5f4ee);
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mobile-menu-toggle:hover {
  background: var(--surface, #1a3a2c);
}

.mobile-menu-toggle svg {
  width: 22px;
  height: 22px;
}

/* Mobile-Menü-Panel: per Default versteckt, aber display ist 'block' damit transform funktioniert */
.mobile-menu {
  display: block;
  position: fixed;
  top: 0;
  right: 0;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-night, #0e1f17) 0%, var(--bg-deep, #0a1610) 100%);
  border-left: 1px solid var(--border-soft, #1c3a2c);
  padding: 24px;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
  overflow-y: auto;
  visibility: hidden;
}

.mobile-menu.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s ease, visibility 0s linear 0s;
}

.mobile-menu-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 16, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-close {
  background: transparent;
  border: none;
  color: var(--ink-200, #e8e4d6);
  cursor: pointer;
  padding: 8px;
  margin: -8px -8px 24px auto;
  display: block;
  border-radius: 6px;
}

.mobile-menu-close:hover {
  background: var(--surface, #1a3a2c);
}

.mobile-menu a {
  display: block;
  padding: 14px 12px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-200, #e8e4d6);
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft, #1c3a2c);
  transition: color 0.2s, background 0.2s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--moss-300, #6fd49e);
  background: rgba(34, 197, 94, 0.05);
}

.mobile-menu a.btn {
  margin-top: 16px;
  border-bottom: none;
  text-align: center;
  border-radius: 8px;
  background: var(--moss-500, #22c55e);
  color: var(--bg-deep, #0a1610);
  font-weight: 600;
}

/* =====================================================
   3. MOBILE-LAYOUT (Tablet & kleiner: ≤768px)
   ===================================================== */
@media (max-width: 768px) {

  /* --- Navigation: Hamburger einblenden, Links verstecken --- */
  .mobile-menu-toggle { display: inline-flex; }
  .nav-links { display: none !important; }

  /* --- Sektionen: weniger Padding --- */
  section { padding: 60px 20px !important; }
  .section-inner { padding: 0 !important; }

  /* --- Headings: kleiner & lesbar --- */
  h1 {
    font-size: clamp(32px, 8vw, 44px) !important;
    line-height: 1.15 !important;
  }
  h2 {
    font-size: clamp(28px, 6.5vw, 38px) !important;
    line-height: 1.2 !important;
  }
  h3 {
    font-size: clamp(20px, 5vw, 26px) !important;
  }

  /* --- Hero-Bereich --- */
  .hero {
    padding: 100px 20px 50px !important;
    min-height: auto !important;
  }
  .hero-content {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .hero-lead {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  .hero-cta {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .hero-cta .btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .hero-trust {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .hero-visual {
    transform: none !important;
    margin: 0 auto !important;
    max-width: 100% !important;
  }

  /* --- Multi-Column Grids einspaltig --- */
  .principles-grid,
  .pillars-grid,
  .features-grid,
  .pricing-grid,
  .config-grid,
  .modell-grid,
  .modal-body,
  .vergleichs-tabelle,
  .three-col,
  [class*="grid-3"],
  [class*="grid-2"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* --- Tabellen scrollbar machen --- */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  table thead, table tbody, table tr {
    display: table;
    width: 100%;
  }

  /* --- Footer einspaltig --- */
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    gap: 8px !important;
    text-align: center !important;
  }

  /* --- Cards/Tiles: weniger Padding --- */
  .card,
  [class*="card-"],
  .feature-tile,
  .pricing-card {
    padding: 24px !important;
  }

  /* --- Kontakt-Layout einspaltig --- */
  .contact-grid,
  .kontakt-grid,
  [class*="kontakt-grid"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* --- Buttons: Touch-Target-Größe (min 44px) --- */
  .btn {
    min-height: 44px;
    padding: 12px 20px !important;
  }
  .btn-large {
    min-height: 52px;
    padding: 14px 24px !important;
  }

  /* --- Formular auf Mobile --- */
  /* Höhere Spezifität durch attribute selector + alle gängigen input-Typen */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  select,
  textarea,
  form input,
  form textarea,
  form select {
    font-size: 16px !important;  /* verhindert iOS-Auto-Zoom! */
  }

  /* --- Konfigurator (produkte.html): Sidebar nur auf Mobile statisch --- */
  .config-sidebar {
    position: static !important;
    max-height: none !important;
  }

  /* --- Founders-Edition Bonus-Liste: auf Mobile sauber stapeln --- */
  .founders-bonus-item {
    grid-template-columns: 24px 1fr !important;
  }
  .founders-bonus-item > .founders-bonus-value {
    grid-column: 2 !important;
    margin-top: 4px !important;
  }
}

/* =====================================================
   4. KLEINE HANDYS (≤480px)
   ===================================================== */
@media (max-width: 480px) {

  /* Logo etwas kleiner */
  .logo-mark { width: 32px !important; height: 32px !important; }
  .logo-name { font-size: 18px !important; }
  .logo-sub { font-size: 7.5px !important; }

  /* Noch kleinere Sektionen */
  section { padding: 48px 16px !important; }
  .hero { padding: 90px 16px 40px !important; }

  /* Cards noch dichter */
  .card,
  [class*="card-"],
  .feature-tile,
  .pricing-card {
    padding: 20px !important;
    border-radius: 12px !important;
  }

  /* Headings */
  h1 { font-size: clamp(28px, 9vw, 36px) !important; }
  h2 { font-size: clamp(24px, 7vw, 32px) !important; }

  /* Footer-Brand etwas kompakter */
  .footer-brand,
  .footer-col { text-align: left !important; }
}

/* =====================================================
   5. EXTRA-SAFETY: Lange Wörter umbrechen
   ===================================================== */
@media (max-width: 768px) {
  h1, h2, h3, p, li, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}
