/* Widget Positioning Fix for Mobile/Tablet - HIGH PRIORITY */

/* Force cart footer to have space for widgets */
@media screen and (max-width: 1024px) {
    /* Create space above cart footer */
    body {
        padding-bottom: 0 !important;
    }

    /* Stack widgets vertically - WAY above cart footer with MAXIMUM priority */
    body .accessibility-widget,
    html body .accessibility-widget {
        bottom: 150px !important;
        right: 20px !important;
        z-index: 90000 !important;
        position: fixed !important;
    }

    body .pwa-install-widget,
    html body .pwa-install-widget {
        bottom: 205px !important;
        right: 20px !important;
        z-index: 89999 !important;
        position: fixed !important;
    }

    body .back-to-top,
    html body .back-to-top {
        bottom: 260px !important;
        right: 20px !important;
        z-index: 89998 !important;
        position: fixed !important;
        display: flex !important; /* Force display if hidden */
    }

    /* Force button sizes */
    body .accessibility-toggle,
    body .pwa-install-button,
    body .back-to-top,
    html body .accessibility-toggle,
    html body .pwa-install-button,
    html body .back-to-top {
        width: 45px !important;
        height: 45px !important;
        bottom: inherit !important; /* Don't let other styles override bottom */
    }

    /* Panels must also be higher */
    body .accessibility-panel,
    html body .accessibility-panel {
        bottom: 205px !important;
        right: 20px !important;
        left: 20px !important;
        width: auto !important;
        max-width: 380px !important;
        z-index: 90001 !important;
    }

    body .pwa-install-popup,
    html body .pwa-install-popup {
        bottom: 265px !important;
        right: 20px !important;
        left: 20px !important;
        width: auto !important;
        max-width: 380px !important;
        z-index: 89999 !important;
    }

    /* Cart footer z-index */
    .cart-footer,
    .fixed.bottom-0,
    div[class*="warenkorb" i],
    div[class*="Warenkorb" i],
    button[class*="warenkorb" i] {
        z-index: 100000 !important;
    }
}

/* For very small screens (phones) - even more specific */
@media screen and (max-width: 480px) {
    body .accessibility-widget,
    html body .accessibility-widget {
        bottom: 140px !important;
        right: 15px !important;
    }

    body .pwa-install-widget,
    html body .pwa-install-widget {
        bottom: 190px !important;
        right: 15px !important;
    }

    body .back-to-top,
    html body .back-to-top {
        bottom: 240px !important;
        right: 15px !important;
    }

    /* Smaller buttons */
    body .accessibility-toggle,
    body .pwa-install-button,
    body .back-to-top {
        width: 42px !important;
        height: 42px !important;
    }
}

/* Extra small mobile (iPhone SE, etc.) */
@media screen and (max-width: 375px) {
    body .accessibility-widget,
    html body .accessibility-widget {
        bottom: 130px !important;
        right: 12px !important;
    }

    body .pwa-install-widget,
    html body .pwa-install-widget {
        bottom: 175px !important;
        right: 12px !important;
    }

    body .back-to-top,
    html body .back-to-top {
        bottom: 220px !important;
        right: 12px !important;
    }

    body .accessibility-toggle,
    body .pwa-install-button,
    body .back-to-top {
        width: 40px !important;
        height: 40px !important;
    }
}

/* Landscape tablets - horizontal layout */
@media screen and (max-width: 1024px) and (orientation: landscape) and (min-width: 768px) {
    body .accessibility-widget {
        bottom: 150px !important;
        right: 20px !important;
    }

    body .pwa-install-widget {
        bottom: 150px !important;
        right: 75px !important;
    }

    body .back-to-top {
        bottom: 150px !important;
        right: 130px !important;
    }
}

/* OVERRIDE ALL OTHER STYLES - Nuclear option */
@media screen and (max-width: 1024px) {
    div.accessibility-widget:not(#fake-id),
    div.pwa-install-widget:not(#fake-id),
    a.back-to-top:not(#fake-id),
    button.back-to-top:not(#fake-id) {
        position: fixed !important;
    }

    /* Force widgets above everything except cart */
    div.accessibility-widget:not(#fake-id) {
        bottom: 150px !important;
        right: 20px !important;
    }

    div.pwa-install-widget:not(#fake-id) {
        bottom: 205px !important;
        right: 20px !important;
    }

    a.back-to-top:not(#fake-id),
    button.back-to-top:not(#fake-id) {
        bottom: 260px !important;
        right: 20px !important;
    }
}