/* Responsive Design for Mobile & Desktop */

/* Mobile Styles für Controls */
@media (max-width: 768px) {
    #controls {
        top: 10px;
        left: 10px;
        right: 10px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    #backButton {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    #controls {
        top: 5px;
        left: 5px;
        right: 5px;
    }

    #backButton {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Mobile Error & Loading Styles */
@media (max-width: 768px) {
    #errorMessage {
        top: 80px;
        left: 10px;
        right: 10px;
        max-width: none;
        font-size: 14px;
    }

    #loadingIndicator {
        font-size: 14px;
        width: 90vw;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    #errorMessage {
        top: 90px;
        left: 5px;
        right: 5px;
        font-size: 16px;
    }

    #loadingIndicator {
        font-size: 16px;
        width: 95vw;
        max-width: 320px;
    }
}

/* Tablet Styles (1024px and down) */
@media (max-width: 1024px) {
    #tooltip {
        width: 85vw !important;
        height: 75vh !important;
        max-width: none !important;
        min-width: unset !important;
        max-height: none !important;
        min-height: unset !important;
        font-size: 26px;
    }

        #tooltip .tooltip-header {
            height: 36px;
            padding: 8px 16px;
            font-size: 18px;
        }

        #tooltip .tooltip-content {
            padding: 24px;
            font-size: 26px;
            line-height: 1.6;
            height: calc(100% - 46px);
        }
}

/* Mobile Styles (768px and down) */
@media (max-width: 768px) {
    #tooltip {
        width: 95vw !important;
        height: 85vh !important;
        font-size: 28px;
    }

        #tooltip .tooltip-header {
            height: 44px;
            padding: 10px 20px;
            font-size: 20px;
        }
}

/* Small Mobile (480px and down) */
@media (max-width: 480px) {
    #tooltip {
        width: 98vw !important;
        height: 90vh !important;
        font-size: 30px;
    }

        #tooltip .tooltip-header {
            height: 48px;
            padding: 12px 24px;
            font-size: 22px;
        }
}

/* Mobile Close Button Sizes */
@media (max-width: 1024px) {
    #tooltip .close {
        width: 32px;
        height: 28px;
        font-size: 16px;
        margin-left: 16px;
    }
}

@media (max-width: 768px) {
    #tooltip .close {
        width: 40px;
        height: 36px;
        font-size: 20px;
        margin-left: 20px;
    }
}

@media (max-width: 480px) {
    #tooltip .close {
        width: 44px;
        height: 40px;
        font-size: 22px;
        margin-left: 24px;
    }
}

/* Content scaling for different screen sizes */
@media (max-width: 1024px) {
    #tooltip h1, #tooltip h2, #tooltip h3, #tooltip h4 {
        font-size: 30px;
        margin-top: 18px;
        margin-bottom: 14px;
    }

    #tooltip th, #tooltip td {
        padding: 14px 18px;
        font-size: 24px;
    }

    #tooltip a {
        font-size: 26px;
        padding: 4px 0;
        display: inline-block;
    }

    #tooltip p, #tooltip em, #tooltip strong {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    #tooltip h1, #tooltip h2, #tooltip h3, #tooltip h4 {
        font-size: 32px;
        margin-top: 20px;
        margin-bottom: 16px;
    }

    #tooltip th, #tooltip td {
        padding: 16px 20px;
        font-size: 26px;
    }

    #tooltip a {
        font-size: 28px;
        padding: 6px 0;
    }

    #tooltip p, #tooltip em, #tooltip strong {
        font-size: 28px;
    }

    #tooltip .tooltip-content {
        padding: 28px;
        font-size: 28px;
        line-height: 1.7;
        height: calc(100% - 54px);
    }
}

@media (max-width: 480px) {
    #tooltip h1, #tooltip h2, #tooltip h3, #tooltip h4 {
        font-size: 34px;
        margin-top: 22px;
        margin-bottom: 18px;
    }

    #tooltip th, #tooltip td {
        padding: 18px 22px;
        font-size: 28px;
    }

    #tooltip a {
        font-size: 30px;
        padding: 8px 0;
    }

    #tooltip p, #tooltip em, #tooltip strong {
        font-size: 30px;
    }

    #tooltip .tooltip-content {
        padding: 32px;
        font-size: 30px;
        line-height: 1.8;
        height: calc(100% - 58px);
    }
}

/* ----------- MEDIA TOOLTIP DYNAMIC HEIGHT (ganz am Ende einfügen) ----------- */
@media (max-width: 1024px) {
    #tooltip.transparent-bg {
        height: auto !important;
        min-height: unset !important;
        max-height: 80vh !important;
    }

        #tooltip.transparent-bg .tooltip-content {
            height: auto !important;
            min-height: unset !important;
            max-height: none !important;
        }
}

@media (max-width: 768px) {
    #tooltip.transparent-bg {
        height: auto !important;
        min-height: unset !important;
        max-height: 70vh !important;
    }

        #tooltip.transparent-bg .tooltip-content {
            height: auto !important;
            min-height: unset !important;
            max-height: none !important;
        }
}

@media (max-width: 480px) {
    #tooltip.transparent-bg {
        height: auto !important;
        min-height: unset !important;
        max-height: 60vh !important;
    }

        #tooltip.transparent-bg .tooltip-content {
            height: auto !important;
            min-height: unset !important;
            max-height: none !important;
        }
}

@media (max-width: 700px) {
    #connected-nodes-bar {
        padding: 3px 2vw 3px 2vw !important;
        gap: 5px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: flex-start !important;
        min-height: unset !important;
        height: auto !important;
        overflow-x: auto !important;
        background: transparent !important;
    }

        #connected-nodes-bar button {
            font-size: 13px !important;
            padding: 7px 10px 7px 10px !important;
            margin: 2px !important;
            min-width: 82px !important;
            max-width: 45vw !important;
            white-space: normal !important;
            box-sizing: border-box !important;
            text-align: center !important;
            line-height: 1.2 !important;
        }
}

/* Für ganz kleine Devices noch kompakter */
@media (max-width: 430px) {
    #connected-nodes-bar button {
        font-size: 11px !important;
        padding: 6px 4px 6px 4px !important;
        min-width: 62px !important;
        max-width: 80vw !important;
    }
}

@media (max-width: 360px) {
    #connected-nodes-bar button {
        font-size: 10px !important;
        padding: 4px 2px 4px 2px !important;
        min-width: 54px !important;
        max-width: 98vw !important;
    }
}

#connected-nodes-bar {
    justify-content: center !important;
}
