/* ==========================================================================
   RESPONSIVE FIXES – SG WBO v1.0
   Konsolidierte, geräteübergreifende Korrekturen
   Wird NACH allen anderen CSS-Dateien geladen (letzte Kaskade)

   Einheitliches Breakpoint-System:
   ────────────────────────────────
   xs  : max 360px   — sehr kleine Smartphones (z. B. iPhone SE 1st)
   sm  : max 480px   — kleine Smartphones
   md  : 768px       — Tablets (Portrait)
   lg  : 1024px      — Laptops / Tablets (Landscape)
   xl  : 1440px      — Desktop / Wide Screen
   2xl : 1920px      — Ultra Wide
   ========================================================================== */


/* ==========================================================================
   1. NAVIGATION – Touch-Targets & Mobile-Overlay (max-width: 1023px)
   WCAG 2.5.8 fordert mindestens 24×24 px, Best Practice: 44×44 px.
   Die sg-nav__mobile Links lagen teils unter 40 px.
   ========================================================================== */

@media (max-width: 1023px) {

  /* Slide-in Panel Links: mind. 48 px Höhe */
  .sg-nav__mobile-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0.875rem 0;
  }

  /* Sub-Links im Dropdown des Mobile-Panels */
  .sg-nav__mobile-dropdown a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
  }

  /* Toggle-Button: sicheres 44×44-Target */
  .sg-nav__toggle {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}


/* ==========================================================================
   2. SEHR KLEINE SMARTPHONES (max-width: 360px)
   Verhindert horizontale Überläufe und unlestbare Abstände auf 320 px Min.
   ========================================================================== */

@media (max-width: 360px) {

  /* Container: weniger Randabstand */
  .container,
  .main-container {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  /* sg-nav: engere Seitenabstände */
  .sg-nav__inner {
    padding: 0 0.75rem;
  }

  /* Countdown: kleinste Darstellung ohne Überlauf */
  .cdw-countdown {
    gap: 0.2rem;
    flex-wrap: nowrap;
  }

  .cdw-unit {
    min-width: 44px;
  }

  .cdw-unit__value {
    width: clamp(44px, 12vw, 58px);
    height: clamp(44px, 12vw, 58px);
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    border-radius: 0.5rem;
  }

  .cdw-countdown__sep {
    font-size: clamp(1rem, 3vw, 1.4rem);
    padding-bottom: 1rem;
  }

  .cdw-team__logo {
    width: 36px;
    height: 36px;
  }

  /* Matchup enger */
  .cdw-card__matchup {
    gap: 0.4rem;
  }

  /* Spieler-Karte kompakter */
  .spieler-card__avatar {
    width: 72px;
    height: 72px;
  }

  /* Match-Card */
  .match-card {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .match-card img {
    height: 32px;
    width: 32px;
  }

  /* Typografie: Mindestgrößen */
  h1 {
    font-size: clamp(1.4rem, 6.5vw, 1.9rem) !important;
  }

  h2 {
    font-size: clamp(1.2rem, 5.5vw, 1.6rem) !important;
  }

  /* Buttons: ausreichend Padding */
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }

  /* PWA-Banner kompakter */
  .pwa-install-content {
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .pwa-install-text small {
    display: none;
  }
}


/* ==========================================================================
   3. KLEINE SMARTPHONES (max-width: 480px)
   Ergänzende Korrekturen für Buttons und Grids.
   ========================================================================== */

@media (max-width: 480px) {

  /* Galerie: 2 Spalten (bisher 1 Spalte durch minmax(180px,1fr)) */
  .gallery-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Kader-Karte: Padding reduzieren */
  .spieler-card {
    padding: var(--space-3, 0.75rem);
  }

  /* Bottom-Nav Labels bei kleinen Screens kleiner */
  .bottom-nav-item span {
    font-size: 0.65rem;
  }

  /* Sponsor-Slider: Logos etwas kleiner */
  .spslider-item {
    width: clamp(80px, 20vw, 120px);
  }
}


/* ==========================================================================
   4. TABLET – PORTRAIT UND LANDSCAPE (min-width: 768px and max-width: 1023px)
   Diese Bandbreite war in main.css kaum abgedeckt. Grids werden optimiert.
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1023px) {

  /* Teams-Grid: 3 Spalten statt 2 */
  .teams-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) !important;
  }

  /* News-Grid: 2 Spalten */
  .news-grid,
  .sg-news-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  /* POTM Spieler-Grid: 3 Spalten */
  .potm-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  /* Download-Center: 2 Spalten */
  .dlc-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  /* Sportstätten: 2 Spalten */
  .loc-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Sponsor-Cards: 3 Spalten */
  .sponsor-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Kader-Übersicht: 4 Spalten (war 2) */
  .kader-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Countdown-Einheiten: etwas größer */
  .cdw-unit {
    min-width: 64px;
  }

  /* Galerie: 3 Spalten */
  .gallery-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}


/* ==========================================================================
   5. WIDESCREEN – DESKTOP (min-width: 1440px)
   Ergänzt fehlende Grid-Regeln; sg-premium.css deckt nur nav/footer/news ab.
   ========================================================================== */

@media (min-width: 1440px) {

  /* Hauptcontainer: mehr Platz nutzen */
  .main-container {
    max-width: 1600px;
  }

  /* Teams: 4 Spalten */
  .teams-grid {
    grid-template-columns: repeat(4, minmax(280px, 1fr));
  }

  /* News: 3 Spalten (konsistent mit sg-premium) */
  .news-grid {
    grid-template-columns: repeat(3, minmax(320px, 1fr));
  }

  /* POTM: 4 Spalten */
  .potm-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
  }

  /* Download-Center: 3 Spalten */
  .dlc-grid {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
  }

  /* Sportstätten: 3 Spalten */
  .loc-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Sponsor-Cards: 4 Spalten */
  .sponsor-cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Kader-Übersicht: 5 Spalten */
  .kader-overview {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* Countdown: größte Einheiten */
  .cdw-unit__value {
    width: 88px;
    height: 88px;
    font-size: 2.4rem;
  }

  /* Galerie: 5 Spalten */
  .gallery-container {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
  }

  /* Swiper-Slider größer */
  .nhs-swiper {
    height: clamp(400px, 45vw, 700px);
  }
}


/* ==========================================================================
   6. ULTRA-WIDE (min-width: 1920px)
   Maximale Grid-Breiten; verhindert extreme Streckung.
   ========================================================================== */

@media (min-width: 1920px) {

  .main-container {
    max-width: 1800px;
  }

  .teams-grid {
    grid-template-columns: repeat(5, minmax(260px, 1fr));
  }

  .news-grid,
  .sg-news-grid {
    grid-template-columns: repeat(4, minmax(300px, 1fr));
  }

  .potm-grid {
    grid-template-columns: repeat(5, minmax(180px, 1fr));
  }

  .kader-overview {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .sponsor-cards-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .gallery-container {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }

  .nhs-swiper {
    height: clamp(500px, 40vw, 800px);
  }
}


/* ==========================================================================
   7. TABELLEN – Horizontales Scrollen auf Mobile (max-width: 767px)
   Spielplan-Tabellen haben viele Spalten → scrollen statt quetschen.
   ========================================================================== */

@media (max-width: 767px) {

  /* Tabellen-Wrapper: horizontales Scrollen */
  .table-responsive,
  .spielplan-wrapper,
  .liga-tabelle-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg, 0.5rem);
  }

  /* Spielplan und Liga-Tabelle: Mindestbreite sichern */
  .spielplan-table,
  .liga-tabelle table,
  table.table {
    min-width: 480px;
  }

  /* Galerie: 2 Spalten auf Mobile */
  .gallery-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Sportstätten-Bild: etwas kleiner */
  .loc-card__img-wrap {
    height: 160px;
  }
}


/* ==========================================================================
   8. FOOTER – Responsive Stacking (max-width: 640px)
   Footer-Bottom-Leiste und Legal-Links werden gestapelt.
   ========================================================================== */

@media (max-width: 640px) {

  /* Footer-Bottom: Flex-Richtung umkehren */
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-2, 0.5rem);
    padding-bottom: var(--space-4, 1rem);
  }

  /* Legal-Links zentrieren */
  .footer-legal-links {
    justify-content: center;
    gap: var(--space-3, 0.75rem);
    flex-wrap: wrap;
  }

  /* Footer-Logo etwas kleiner */
  .footer-logo {
    height: 36px;
  }

  /* Footer-Social: Zentrieren */
  .footer-social {
    justify-content: center;
  }
}


/* ==========================================================================
   9. SCROLL-OFFSET FÜR ANCHOR-LINKS (alle Breakpoints)
   sg-nav ist position:fixed (height:70px) → Anker müssen darunter starten.
   Ergänzt bestehende Regeln aus main.css.
   ========================================================================== */

/* Alle Abschnitte mit ID als mögliche Anker-Ziele */
section[id],
div[id].anchor-target,
.spielplan-hero,
.section-hero {
  scroll-margin-top: 80px;
}


/* ==========================================================================
   10. PWA INSTALL BANNER – Responsive Korrekturen
   Auf sehr kleinen Screens verdeckt der Banner zu viel Fläche.
   ========================================================================== */

@media (max-width: 480px) {

  .pwa-install-banner {
    padding: 0.75rem;
  }

  .pwa-install-content {
    gap: 0.5rem;
  }

  .pwa-install-icon {
    display: none;
    /* Spart Platz auf kleinen Screens */
  }

  .pwa-install-text {
    font-size: 0.85rem;
  }
}


/* ==========================================================================
   11. COOKIE BANNER – Mobile Layout
   ========================================================================== */

@media (max-width: 576px) {

  .cookie-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .cookie-content .btn {
    width: 100%;
    justify-content: center;
  }
}


/* ==========================================================================
   12. PRINT – Ergänzende Ausblendungen
   Ergänzt bestehende Print-Regeln in main.css.
   ========================================================================== */

@media print {

  /* sg-nav und Mobile-Elemente ausblenden */
  .sg-nav,
  .sg-nav__mobile,
  .bottom-nav,
  .social-fixed,
  .pwa-install-banner,
  .cookie-banner,
  .cdw-section,
  .spslider-section {
    display: none !important;
  }

  .main-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  /* Lesbare Tabellen im Druck */
  table {
    min-width: auto !important;
    font-size: 10pt;
  }
}
