/* Copyright 2024 Oliver Smith, user0, Peter Mack *
 * SPDX-License-Identifier: MPL-2.0 */

@media (max-width: 700px) {
    @media not (-moz-bool-pref: "mcf.addressbarontop"),
        not (-moz-pref("mcf.addressbarontop")) {
        /* If the navbar is at the bottom, we need to set an offset to have
         * the notifications (like the one for installing addons) displayed
         * on-screen. */
        /* fixes for installing extensions */
        .popup-notification-panel  {
            margin-top: -280px !important;
            max-width: 98vw;
        }
        /* Additional fix for "Add $extension" menu */
        #notification-popup {
            margin-top: -330px !important;
            padding-left: 30px;
        }
        /* Menu that appears when long-pressing the back-button */
        #backForwardMenu {
            margin-top: -250px;
            height: 200px;
            min-height: 200px;
            max-width: 100vw !important;
        }
    }

    #downloadsPanel-mainView {
        max-width: calc(100vw - 10px);
    }

    /* Fix unified-extensions and protections menu */
    .panel-viewstack {
        height: 100vh !important;
        max-height: calc(100vh - 100px) !important;
        max-width: calc(100vw - 10px);
    }

    /* Allow extensions to use full popup */
    .webextension-popup-browser {
        height: 100% !important;
        min-height: 100% !important;
        width: 100vw !important;
        min-width: 100vw !important;
    }

    /* Hide some context menu items,
     * hide 'Customize Toolbar' in overflow menu */
    #context-inspect,
    #context-inspect-a11y,
    #context-savelinktopocket,
    #context-searchselect,
    #context-sendlinktodevice,
    #context-viewpartialsource-selection,
    #inspect-separator,
    #overflowMenu-customize-button {
        display: none !important
    }

    /* fix flickering of the protections, permissions,
     * widget overflow and identity popups, make seventh
     * column of date picker visible */
    #protections-popup,
    #permission-popup,
    #widget-overflow,
    #identity-popup,
    #date-picker {
        max-width: 100vw !important;
    }

    /* fix the protections popup gettting
     * too wide, making controls unaccessible */
    #protections-popup-mainView {
        min-width: 100vw !important;
        max-width: 100vw !important;
    }

    /* fix flicker on extension menus.
     * The compromise is that the overflow menu always use
     * all available height.
     * The -80px is here to prevent covering the main bars */
    #widget-overflow,
    #widget-overflow-mainView {
        height: calc(100vh - 80px) !important;
    }

    /* Adjust dialogues like "Confirm before closing multiple
     * tabs" or "Allow open in app" */
    .dialogFrame {
        max-width: 100%;
    }

}
