/* ============================================
   Legal Documents Styling (AGB, Impressum, Datenschutz)
   ============================================ */

/* Override global h2 absolute positioning for legal documents */
.legal-document h2,
.legal-container h2,
.legal-content h2,
.legal-popup-content h2 {
    position: static !important;
    left: auto !important;
    text-align: left !important;
}

.legal-document h3,
.legal-container h3,
.legal-content h3,
.legal-popup-content h3 {
    position: static !important;
}

.legal-document {
    background: #f8f9fa;
    min-height: 100vh;
    padding: 40px 20px;
}

.legal-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 50px 60px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.legal-title {
    font-size: 2.5rem;
    color: #0047ab;
    margin-bottom: 30px;
    font-family: 'Rubik Dirt', cursive;
    text-align: center;
    border-bottom: 3px solid #0047ab;
    padding-bottom: 20px;
}

.legal-toc {
    background: #f8f9fa;
    padding: 25px 30px;
    border-radius: 8px;
    margin-bottom: 40px;
    border-left: 4px solid #0047ab;
}

.legal-toc h2 {
    font-size: 1.5rem;
    color: #0047ab;
    margin: 0 0 15px 0;
    font-family: 'Rubik Dirt', cursive;
}

.legal-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-toc li {
    margin: 8px 0;
}

.legal-toc a {
    color: #333;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s, padding-left 0.3s;
    display: inline-block;
}

.legal-toc a:hover {
    color: #0047ab;
    padding-left: 10px;
}

.legal-content {
    line-height: 1.8;
    color: #333;
}

.legal-content h2 {
    font-size: 1.6rem !important;
    color: #0047ab !important;
    margin-top: 50px !important;
    margin-bottom: 25px !important;
    font-family: 'Rubik Dirt', cursive !important;
    padding-top: 30px !important;
    padding-bottom: 10px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-top: 2px solid #e9ecef !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    clear: both !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    display: block !important;
}

.legal-content h2:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.legal-content h3 {
    font-size: 1.3rem !important;
    color: #0047ab !important;
    margin-top: 30px !important;
    margin-bottom: 18px !important;
    padding-top: 10px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    position: relative !important;
    left: 0 !important;
    display: block !important;
}

.legal-content p {
    margin: 15px 0;
    font-size: 1rem;
    text-align: justify;
    clear: both;
}

.legal-content h2 + p,
.legal-content h3 + p {
    margin-top: 15px;
}

.legal-content ul, .legal-content ol {
    margin: 15px 0 15px 30px;
    padding: 0;
}

.legal-content li {
    margin: 8px 0;
    line-height: 1.8;
}

.legal-content strong {
    color: #0047ab;
}

.legal-content a {
    color: #0047ab;
    text-decoration: underline;
}

.legal-content a:hover {
    color: #003580;
}

/* Responsive Design für Legal Documents */
@media (max-width: 768px) {
    .legal-container {
        padding: 30px 25px;
    }

    .legal-title {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    .legal-toc {
        padding: 20px;
    }

    .legal-content h2 {
        font-size: 1.3rem;
        margin-top: 40px;
        margin-bottom: 20px;
        padding-top: 25px;
        line-height: 1.3;
    }

    .legal-content h3 {
        font-size: 1.1rem;
        margin-top: 25px;
        margin-bottom: 15px;
        line-height: 1.3;
    }

    .legal-content p {
        font-size: 0.95rem;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .legal-document {
        padding: 20px 10px;
    }

    .legal-container {
        padding: 20px 15px;
    }

    .legal-title {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    .legal-toc {
        padding: 15px;
    }

    .legal-toc h2 {
        font-size: 1.1rem;
    }

    .legal-content h2 {
        font-size: 1.1rem;
        margin-top: 35px;
        margin-bottom: 18px;
        padding-top: 20px;
        line-height: 1.3;
    }

    .legal-content h3 {
        font-size: 1rem;
        margin-top: 20px;
        margin-bottom: 12px;
        line-height: 1.3;
    }

    .legal-content p {
        font-size: 0.9rem;
    }

    .legal-content ul, .legal-content ol {
        margin-left: 20px;
    }
}

/* ============================================
   Legal Popup/Modal for Footer Links
   ============================================ */

.legal-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
}

.legal-popup-content {
    max-width: 900px;
    margin: 50px auto;
    background: white;
    padding: 40px 50px;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.legal-popup-content h1 {
    font-size: 2rem;
    color: #0047ab;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #0047ab;
    line-height: 1.3;
    word-wrap: break-word;
}

.legal-popup-content h2 {
    font-size: 1.4rem !important;
    color: #0047ab !important;
    margin-top: 40px !important;
    margin-bottom: 20px !important;
    padding-top: 25px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-top: 2px solid #e9ecef !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    clear: both !important;
    position: relative !important;
    left: 0 !important;
    display: block !important;
}

.legal-popup-content h2:first-of-type {
    margin-top: 20px;
}

.legal-popup-content h3 {
    font-size: 1.2rem !important;
    color: #0047ab !important;
    margin-top: 25px !important;
    margin-bottom: 15px !important;
    padding-top: 8px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    position: relative !important;
    left: 0 !important;
    display: block !important;
}

.legal-popup-content h4 {
    font-size: 1.1rem;
    color: #0047ab;
    margin-top: 20px;
    margin-bottom: 12px;
    line-height: 1.4;
    word-wrap: break-word;
}

.legal-popup-content p {
    margin: 12px 0;
    line-height: 1.7;
    text-align: justify;
    clear: both;
}

.legal-popup-content ul,
.legal-popup-content ol {
    margin: 15px 0 15px 30px;
    line-height: 1.7;
}

.legal-popup-content li {
    margin: 8px 0;
}

.legal-popup-content a {
    color: #0047ab;
    text-decoration: underline;
}

.legal-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.3s;
    z-index: 10;
}

.legal-popup-close:hover {
    color: #0047ab;
}

@media (max-width: 768px) {
    .legal-popup-content {
        margin: 20px;
        padding: 30px 20px;
    }

    .legal-popup-content h1 {
        font-size: 1.6rem;
    }

    .legal-popup-content h2 {
        font-size: 1.2rem;
        margin-top: 30px;
    }

    .legal-popup-content h3 {
        font-size: 1.1rem;
    }

    .legal-popup-content h4 {
        font-size: 1rem;
    }

    .legal-popup-content p {
        font-size: 0.95rem;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .legal-popup-content {
        margin: 10px;
        padding: 25px 15px;
    }

    .legal-popup-content h1 {
        font-size: 1.4rem;
    }

    .legal-popup-content h2 {
        font-size: 1.1rem;
        margin-top: 25px;
    }

    .legal-popup-content h3 {
        font-size: 1rem;
    }

    .legal-popup-content h4 {
        font-size: 0.95rem;
    }

    .legal-popup-content p {
        font-size: 0.9rem;
    }

    .legal-popup-close {
        font-size: 1.5rem;
        top: 10px;
        right: 15px;
    }
}
