/**
 * RECHTLICHE SEITEN - MOBILE LAYOUT OPTIMIERUNG
 *
 * Gilt für: impressum.html, datenschutz.html, agb.html
 *
 * Fixes:
 * 1. Kein abgeschnittener Text in Cards
 * 2. Kleinere Schrift auf Mobile wenn nötig
 * 3. Besseres Text-Wrapping
 * 4. Optimierte Touch-Targets
 * 5. Einheitliches Footer-Button-Layout
 */

/* ============================================
   DESKTOP - BASIS-STYLES
   ============================================ */

/* Kontakt-Info Boxen */
.kontakt-info,
.impressum-container,
.agb-container,
.datenschutz-container {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Alle Überschriften - besseres Line-Height */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3 !important;
    margin-bottom: 1rem !important;
}

/* Paragraphen und Listen */
p, ul, ol {
    line-height: 1.6 !important;
    margin-bottom: 1rem !important;
}

/* Links - besseres Wrapping */
a {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* ============================================
   FOOTER - EINHEITLICHE BUTTON-BREITEN
   ============================================ */

/* ALLE Footer-Buttons - einheitliche Größe */
/* WICHTIG: NUR für Footer-Links, NICHT für Accordion-Buttons */
footer a:not(.footer-accordion-header),
footer button:not(.footer-accordion-header) {
    font-size: 1rem !important;
    font-weight: 400 !important;
    padding: 0.5rem 0 !important;
    line-height: 1.8 !important;
    display: inline-block !important;
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
}

/* Footer-Accordion-Buttons - IMMER 100% Breite */
footer .footer-accordion-header {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
}

/* Footer-Listen Links - einheitlich */
footer ul li a,
footer ol li a {
    font-size: 1rem !important;
    font-weight: 400 !important;
    padding: 0.5rem 0 !important;
    line-height: 1.8 !important;
    display: inline-block !important;
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
}

/* Spezifische Button-Normalisierung */
footer a[href*="impressum.html"],
footer a[href*="datenschutz.html"],
footer a[href*="agb.html"],
footer a[href="/impressum.html"],
footer a[href="/datenschutz.html"],
footer a[href="/agb.html"] {
    font-size: 1rem !important;
    font-weight: 400 !important;
    padding: 0.5rem 0 !important;
    line-height: 1.8 !important;
    display: inline-block !important;
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
    text-decoration: none !important;
}

/* ============================================
   TABLET (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Body - kein horizontales Scrollen */
    body {
        overflow-x: hidden !important;
    }

    /* Container */
    .container,
    .impressum-container,
    .agb-container,
    .datenschutz-container {
        padding: 1rem !important;
        overflow-x: hidden !important;
    }

    /* Kontakt-Info Boxen */
    .kontakt-info {
        padding: 1.25rem !important;
        margin: 1rem 0 !important;
    }

    /* Überschriften - kleinere Schrift */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }

    h4 {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
    }

    /* Paragraphen und Listen */
    p, ul, ol, li {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }

    /* Tabellen - horizontal scrollbar */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: 0.85rem !important;
        width: 100% !important;
    }

    /* Tabellen-Zellen - besseres Wrapping */
    td, th {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 200px !important;
    }

    /* Strong und Bold - etwas kleiner */
    strong, b {
        font-size: inherit !important;
    }

    /* Footer */
    footer {
        padding: 2rem 1rem !important;
    }

    /* Footer-Grid - 2 Spalten statt 4 */
    footer [style*="grid-template-columns"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }

    /* Footer Überschriften */
    footer h3 {
        font-size: 1.2rem !important;
    }

    footer h4 {
        font-size: 1.1rem !important;
    }

    /* Footer Paragraphen */
    footer p {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }

    /* Footer Links - einheitliche Größe */
    footer a {
        font-size: 0.9rem !important;
        font-weight: 400 !important;
        line-height: 1.8 !important;
    }

    /* AGB-Button normalisiert */
    footer a[href*="agb.html"] {
        font-size: 0.9rem !important;
        font-weight: 400 !important;
        padding: 0.5rem 0 !important;
        display: inline-block !important;
    }
}

/* ============================================
   MOBILE (max-width: 576px)
   ============================================ */

@media (max-width: 576px) {
    /* Container - noch kompakter */
    .container,
    .impressum-container,
    .agb-container,
    .datenschutz-container {
        padding: 0.75rem !important;
    }

    /* Kontakt-Info */
    .kontakt-info {
        padding: 1rem !important;
    }

    /* Überschriften - noch kleiner */
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    h3 {
        font-size: 1.15rem !important;
    }

    h4 {
        font-size: 1rem !important;
    }

    /* Text - noch kleiner */
    p, ul, ol, li {
        font-size: 0.85rem !important;
    }

    /* Footer - 1 Spalte */
    footer [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* ============================================
   EXTRA SMALL MOBILE (max-width: 400px)
   ============================================ */

@media (max-width: 400px) {
    /* Container - minimal */
    .container,
    .impressum-container,
    .agb-container,
    .datenschutz-container {
        padding: 0.5rem !important;
    }

    /* Kontakt-Info */
    .kontakt-info {
        padding: 0.75rem !important;
    }

    /* Überschriften - minimal */
    h1 {
        font-size: 1.3rem !important;
    }

    h2 {
        font-size: 1.2rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    h4, h5, h6 {
        font-size: 1rem !important;
    }

    /* Text - minimal aber lesbar */
    p, ul, ol, li {
        font-size: 0.8rem !important;
        line-height: 1.5 !important;
    }

    /* Footer */
    footer {
        padding: 1.5rem 0.5rem !important;
    }

    footer p {
        font-size: 0.8rem !important;
    }

    footer a {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   VERHINDERE OVERFLOW
   ============================================ */

/* Alle Elemente - maximale Breite */
* {
    box-sizing: border-box !important;
}

/* Bilder und Media */
img, video, iframe {
    max-width: 100% !important;
    height: auto !important;
}

/* Pre und Code - horizontal scrollbar wenn nötig */
pre, code {
    overflow-x: auto !important;
    word-wrap: break-word !important;
    white-space: pre-wrap !important;
}
