/**
 * TermaTech mobile menu
 *
 * Top row:
 * - Language switcher left
 * - Close button right
 *
 * Open WPML dropdown:
 * - Full width of mobile menu
 */

@media (max-width: 1024px) {

    /* =========================================================
       Main container
       ========================================================= */

    .jet-mobile-menu__container-inner {
        position: relative !important;

        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;

        width: 100% !important;
        max-width: 100% !important;

        box-sizing: border-box;
    }

    .jet-mobile-menu__container-inner {
        align-content: space-between !important;
    }


    /* =========================================================
       Language switcher – left
       ========================================================= */

    .jet-mobile-menu__before-template {
        order: 1;

        position: static !important;

        flex: 0 0 auto !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;

        box-sizing: border-box;
    }

    .jet-mobile-menu__before-template-content {
        position: static !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    /* =========================================================
       Elementor wrappers
       ========================================================= */

    /*
     * Vigtigt:
     *
     * Elementor-containere er normalt position: relative.
     * Hvis de forbliver relative, bliver WPML-dropdownens
     * width:100% kun 45px / flagets bredde.
     *
     * Derfor fjernes positioneringskonteksten hele vejen ned.
     */

    .jet-mobile-menu__before-template .elementor,
    .jet-mobile-menu__before-template .e-con,
    .jet-mobile-menu__before-template .e-con-inner,
    .jet-mobile-menu__before-template .elementor-widget,
    .jet-mobile-menu__before-template .elementor-widget-container,
    .jet-mobile-menu__before-template .wpml-elementor-ls,
    .jet-mobile-menu__before-template .wpml-ls,
    .jet-mobile-menu__before-template .wpml-ls-legacy-dropdown,
    .jet-mobile-menu__before-template .wpml-ls > ul,
    .jet-mobile-menu__before-template .wpml-ls > ul > li {
        position: static !important;
    }


    .jet-mobile-menu__before-template .elementor,
    .jet-mobile-menu__before-template .e-con,
    .jet-mobile-menu__before-template .e-con-inner,
    .jet-mobile-menu__before-template .elementor-widget,
    .jet-mobile-menu__before-template .elementor-widget-container {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    /* =========================================================
       WPML top level
       ========================================================= */

    .jet-mobile-menu__before-template .wpml-elementor-ls,
    .jet-mobile-menu__before-template .wpml-ls,
    .jet-mobile-menu__before-template .wpml-ls-legacy-dropdown {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        box-sizing: border-box;
    }


    .jet-mobile-menu__before-template .wpml-ls > ul,
    .jet-mobile-menu__before-template .wpml-ls-legacy-dropdown > ul {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    .jet-mobile-menu__before-template .wpml-ls > ul > li,
    .jet-mobile-menu__before-template .wpml-ls-legacy-dropdown > ul > li {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    /* Active language */
    .jet-mobile-menu__before-template .wpml-ls-item-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;

        width: auto !important;
        min-width: 45px !important;
        max-width: none !important;
        height: 45px;

        margin: 0 !important;
        padding: 0 !important;

        box-sizing: border-box;
    }


    /* =========================================================
       Close button – right
       ========================================================= */

    .jet-mobile-menu__controls {
        order: 2;

        flex: 0 0 auto !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 0 0 auto !important;
        padding: 0 !important;

        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;

        box-sizing: border-box;
    }

    .jet-mobile-menu__back {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    /* =========================================================
       WPML dropdown – FULL WIDTH
       ========================================================= */

    .jet-mobile-menu__before-template .wpml-ls-sub-menu {
        position: absolute !important;

        top: 45px !important;
        left: 0 !important;
        right: 0 !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        margin: 50px 0 0 0 !important;
        padding: 0 !important;

        box-sizing: border-box;

        z-index: 9999 !important;
    }


    .jet-mobile-menu__before-template .wpml-ls-sub-menu > li {
        display: block !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;

        box-sizing: border-box;
    }


    .jet-mobile-menu__before-template .wpml-ls-sub-menu > li > a {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        min-height: 45px;

        margin: 0 !important;

        box-sizing: border-box;
    }


    /* JS-controlled open state */
    .jet-mobile-menu__before-template
    .wpml-ls-item-legacy-dropdown.tt-wpml-open
    > .wpml-ls-sub-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }


    /* =========================================================
       Main menu
       ========================================================= */

    .jet-mobile-menu__body {
        order: 3;

        flex: 0 0 100% !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        box-sizing: border-box;
    }


    /* =========================================================
       After template
       ========================================================= */

    .jet-mobile-menu__after-template {
        order: 4;

        flex: 0 0 100% !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        box-sizing: border-box;
    }
}

@media (max-width: 1024px) {

    /* Fjern WPML's grå baggrund bag det aktive flag */
    .jet-mobile-menu__before-template .wpml-ls-current-language,
    .jet-mobile-menu__before-template .wpml-ls-current-language > a,
    .jet-mobile-menu__before-template .wpml-ls-item-toggle,
    .jet-mobile-menu__before-template .wpml-ls-item-toggle:hover,
    .jet-mobile-menu__before-template .wpml-ls-item-toggle:focus,
    .jet-mobile-menu__before-template .wpml-ls-item-toggle:active {
        background: transparent !important;
        background-color: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

}

@media (max-width: 1024px) {

    /* Hele mobilmenuen er reference for den absolutte dropdown */
    .jet-mobile-menu__container-inner {
        position: relative !important;
    }

    /* VIGTIGT: må ikke være position: relative */
    .jet-mobile-menu__before-template {
        position: static !important;
        z-index: 20 !important;
    }

    /* Dropdownen måler nu 100% af hele container-inner */
    .jet-mobile-menu__before-template .wpml-ls-sub-menu {
        position: absolute !important;

        top: 45px !important;
        left: 0 !important;
        right: 0 !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        margin: 30% 0 0 0 !important;
        padding: 0 !important;

        box-sizing: border-box;

        z-index: 30 !important;
    }

    /* Resten skal ligge under dropdownen */
    .jet-mobile-menu__body {
        z-index: 1 !important;
    }

    .jet-mobile-menu__after-template {
        z-index: 1 !important;
    }
}