header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 40px 100px;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.5s;
}

header.sticky {
    background: var(--logo-blue);
    padding: 10px 20px;
    font-family: "Mariupol-Bold", sans-serif;
    font-size: 0.95rem;
    /*font-size: 0.8rem;*/
}

header .header-image {
    display: inline-block;
    height: 2rem;
    padding-right: 1rem;
}

header .inside-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: calc(1460px - 40px);
    padding: 0 20px;
}

header .logo {
    color: var(--background);
    font-size: 1.4em;
    text-decoration: none;
    display: flex;
    align-items: center;
    max-width: 50%;
    margin: 0 !important;
}

header .navigation {
    width: 85%;
    max-width: 500px;
    position: relative;
    display: flex;
    justify-content: space-between;
}

header ul {
    margin-top: 20px !important;
}

header .navigation li {
    list-style: none;
    margin-left: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

header .navigation li a {
    text-decoration: none;
    color: #fff;
    font-weight: 300;
}

header.sticky .navigation li a {
    color: var(--background);
}

header .navigation li a:hover {
    color: var(--background);
}

header .burger-menu {
    display: none;
}

header .burger-icon {
    cursor: pointer;
    padding: 0 10px;
}

.admin-menu {
    position: fixed;
    right: 20px;
    top: 100px;
    padding: 15px;
    background-color: var(--secondary-background);
    border-radius: 10px;
    z-index: 10;
    opacity: 0.7;
}

.admin-menu:hover {
    opacity: 1;
}

.admin-menu a {
    background-color: var(--logo-blue);
    color: var(--background);
    padding: 10px;
    border-radius: 10px;
}

#ml-languageButton {
    padding: 0 !important;
    background: var(--logo-blue) !important;
    color: var(--background) !important;
    border: none !important;
}

header .navigation .line {
    display: none;
}

.btn-support {
    background-color: #FFC107 !important; /* Жовтий колір */
    color: #000 !important; /* Чорний текст */
    padding: 8px 20px !important;
    border-radius: 5px;
    font-weight: bold !important;
}

@media (max-width: 1120px) {
    header.sticky {
        padding: 10px 0px;
    }
}

@media (max-width: 991px) {
    header .navigation {
        max-width: unset;
    }
    
    #ml-languageButton {
        font-size: 1rem !important;
        padding: 10px !important;
    }

    header .navigation .line {
        display: flex;
    }
    
    .priority {
        background-color: var(--logo-blue);
    }
    
    header .navigation {
        display: none;
    }
    
    header .navigation.active {
        width: 100%;
        height: calc(100% - 40px);
        padding-bottom: 70px !important;
        overflow-y: scroll;
        position: fixed;
        padding-top: 40px !important;
        left: 0;
        top: 40px;
        display: flex;
        justify-content: start;
        align-items: center;
        flex-direction: column;
        background: var(--logo-blue);
        padding: 0;
    }
    
    header .navigation li {
        margin-left: 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    header .navigation li a {
        font-size: 2em;
    }
    
    header .menuToggle {
        position: relative;
        height: 40px;
        width: 40px;
        background: url(../../images/icons/menu.svg);
        background-size: 30px;
        background-repeat: no-repeat;
        background-position: center;
        cursor: pointer;
    }
    
    header .menuToggle.active {
        background: url(../../images/icons/close.svg);
        background-size: 30px;
        background-repeat: no-repeat;
        background-position: center;
    }
    
    header.sticky .line {
        height: 1px;
        background: var(--background);
        width: 75%;
        margin: 10px;
        padding: 0.5px;
    }
}

@media (max-width: 750px) {
    header .burger-menu {
        display: block;
    }
    
    header .priority {
        z-index: 3;
    }
    
    header .navigation {
        z-index: 2;
    }
    
    header .nav__links {
        display: none;
        flex-direction: column;
        background-color: rgba(255, 255, 255, 0.95);
        position: absolute;
        top: 60px;
        right: 0;
        width: 100%;
    }
    
    header .nav__links.active {
        display: flex;
        gap: 1rem;
        list-style: none;
        box-sizing: border-box;
        margin: 0 0 0 0;
        color: var(--background);
    }
    
    header .nav__links li {
        padding: 1em;
        margin-left: 4.5em;
    }
    
    header p {
        margin-bottom: 1rem;
    }
    
    header .logo {
        max-width: calc(90% - 40px);
    }
    
    .admin-menu {
        opacity: 1;
        bottom: 20px;
        top: unset;
    }
}

@media (max-width: 400px) {
    header .navigation li a, header .logo {
        font-size: 1rem;
    }
    
    header .menuToggle {
        background-size: 20px;
        background-position: right;
    }
}
  
@media (max-height: 500px) {
    header .navigation.active .line {
        display: none;
    }
}

/* ===== DESKTOP SUBMENU ===== */
@media (min-width: 991px) {
    .desktop-link {
        color: var(--background) !important;
    }
    
    /* робимо відносну позицію для псевдоелемента-мостика */
    .has-submenu {
        position: relative;
    }

    .has-submenu .submenu {
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 1400px;

        display: none;                /* за замовчуванням ховаємо */
        opacity: 0;                   /* для плавного переходу */
        transition: opacity 120ms ease;
        grid-template-columns: 260px 1fr;
        gap: 60px;

        background: #fff;
        padding: 50px 60px;
        box-shadow: 0 15px 40px rgba(0,0,0,0.15);
        z-index: 999;
        pointer-events: auto;
    }

    /* показ підменю — через клас .show */
    .has-submenu.show .submenu {
        display: grid;
        opacity: 1;
    }

    /* якщо користувач навів мишкою — також додаємо show (для сумісності з CSS hover) */
    .has-submenu:hover .submenu,
    .submenu:hover {
        display: grid;
        opacity: 1;
    }

    /* додатковий "місток" щоб курсор не вилазив в проміжок */
    .has-submenu::after {
        content: "";
        position: absolute;
        left: 0;
        top: 100%;
        width: 100%;
        height: 40px; /* регулюй при потребі */
        pointer-events: none; /* не блокує події */
    }

    /* LEFT SIDEBAR */
    .submenu-sidebar {
        font-size: 2.2rem;
        font-weight: 700;
        color: var(--logo-blue);
        border-left: 4px solid var(--logo-blue);
        padding-left: 20px;
        display: flex;
        align-items: flex-start;
    }

    /* RIGHT GRID */
    .submenu-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px 40px;
    }

    .submenu-content li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .submenu-content li a {
        display: block;
        font-size: 1.05rem;
        font-weight: 500;
        color: var(--logo-blue) !important;
        padding: 6px 0;
        text-align: left;
    }

    .submenu-content li a:hover {
        text-decoration: underline;
    }

    .mobile-submenu-toggle {
        display: none;
    }

    .has-submenu > .desktop-link {
        font-weight: 700;
        position: relative;
    }

    .has-submenu:hover > .desktop-link::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: -8px;
        width: 100%;
        height: 2px;
        background: white;
    }

    header.sticky .submenu {
        top: 50px;
    }

    /* Коли клас submenu-open (для планшетів) — теж відображаємо */
    .has-submenu.submenu-open .submenu {
        display: grid;
        opacity: 1;
    }
}

/* ===== MOBILE SUBMENU ===== */
@media (max-width: 991px) {
    .has-submenu {
        width: 100%;
        align-items: stretch;
        padding: 0 20px;
    }

    .has-submenu > .desktop-link {
        width: 100%;
        display: flex;
        justify-content: center;
        font-size: 1rem;
        color: var(--background) !important;
    }

    .has-submenu .submenu {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: none;

        display: none;
        opacity: 1;
        background: rgba(255,255,255,0.1);
        box-shadow: none;
        padding: 20px 10px;
        margin-top: 10px;
    }

    .has-submenu.submenu-open .submenu {
        display: block;
    }

    .submenu-sidebar {
        display: none;
    }

    .submenu-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .submenu-content li a {
        font-size: 1.2rem;
        color: white !important;
        text-align: center;
    }
    
    header.sticky .navigation li a {
        padding: 10px;
    }
    
    .submenu-content .line {
        height: 1px;
        background: var(--background);
        width: 100% !important;
        margin: 0 !important;
        opacity: 0.5;
    }
}

