* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', Arial, sans-serif;
}

body {
    font-size: 16px;
    line-height: 1.35;
    background-color: var(--background-dark-grey);
}

/* Шапка */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 61px;
    background-color: var(--background-dark-grey);
    z-index: 990;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: background-color 0.3s ease; /* Добавляем переход для плавности */
}

/* Добавляем класс для затемнения шапки */
.header.dimmed {
    background-color: var(--background-darker);
}

.header-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    transition: opacity 0.3s ease; /* Добавляем переход для плавности */
}

/* Затемнение контейнера шапки */
.header-container.dimmed {
    opacity: 0.5;
    pointer-events: none; /* Отключаем взаимодействие с элементами */
}

/* Логотип */
.logo-container {
    display: flex;
    align-items: center;
    height: 45px;
    background-color: var(--background-medium-grey);
    border-radius: 12px;
    padding: 0 10px;
    transition: all 0.1s ease;
    width: 120px;
}

.logo-container:hover {
    background-color: var(--background-darkish);
}

.logo-img {
    margin: 0 auto;
    height: auto;
    width: auto;
}

/* Навигация - главный блок */
.nav-links {
    display: none;
}

/* Телефон */
.phone-link {
    display: none;
    color: var(--color-white);
    text-decoration: none;
    font-size: 20px;
    padding: 12px 20px;
    background-color: var(--accent-green);
    border-radius: 12px;
    transition: all 0.1s ease;
}

/* Мобильное меню */
.mobile-menu-btn {
    display: block;
    width: 45px;
    height: 45px;
    background-color: var(--background-medium-grey);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    position: relative;
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Добавляем переход */
}

/* Скрываем кнопку при активном меню */
.mobile-menu-btn.hidden {
    opacity: 0;
    visibility: hidden;
}

.mobile-menu-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background-color: var(--accent-green);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding-top: 61px;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: calc(100vh - 61px);
    position: relative;
}

.mobile-menu-link {
    color: var(--color-white);
    text-decoration: none;
    font-size: 24px;
    padding: 12px 0;
    transition: all 0.1s ease;
}

.mobile-menu-link:hover {
    opacity: 0.8;
}

/* Оверлей для мобильного меню */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Кнопка закрытия */
.mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1002;
}

.mobile-menu-close::before,
.mobile-menu-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background-color: var(--color-white);
}

.mobile-menu-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.mobile-menu-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Подменю */
.submenu {
    padding-left: 15px;
    display: none;
}

.submenu.active {
    display: block;
}

.submenu-link {
    color: var(--color-white);
    text-decoration: none;
    display: block;
    font-size: 18px;
    padding: 10px 0;
}

/* Десктопная версия */
@media (min-width: 960px) {
    .header {
        height: 76px;
        background-color: var(--background-dark-grey);
        padding: 0 15px;
    }
    
    .logo-container {
        height: 60px;
        width: auto;
        padding: 0 15px;
    }
    
    .logo-img {
        height: 40px;
        width: auto;
    }
    
    /* Навигация для десктопа */
    .nav-links {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .nav-item {
        position: relative !important;
    }
    
    /* Простое выпадающее меню */
    .nav-link, .dropdown-toggle {
        color: var(--color-white);
        text-decoration: none;
        font-size: 20px;
        padding: 12px 15px;
        display: flex;
        align-items: center;
        height: 45px;
        transition: all 0.1s ease;
    }
    
    .nav-link:hover, 
    .dropdown-toggle:hover {
        background-color: #5a5c5a;
        color: #ffffff;
    }
    
    .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 15px;
        min-width: 220px;
        background-color: var(--background-medium-grey);
        box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        padding: 15px;
        z-index: 9999;
    }
    
    .dropdown-item {
        color: var(--color-white);
        font-size: 16px;
        padding: 8px 15px;
        display: block;
        text-decoration: none;
        transition: all 0.1s ease;
        border-radius: 5px;
    }
    
    .dropdown-item:hover {
        color: var(--color-light-grey);
        background-color: transparent;
    }
    
    .dropdown:hover .dropdown-menu {
        display: block;
    }
    
    .phone-link {
        display: block;
        color: var(--color-white);
        text-decoration: none;
        font-size: 16px;
        transition: all 0.1s ease;
    }
    
    .mobile-menu-btn {
        display: none;
    }
    
    .mobile-menu {
        display: none;
    }
    
    .mobile-menu-overlay {
        display: none;
    }
}

/* Мобильная версия */
@media (max-width: 959px) {
    .nav-links {
        display: none !important;
    }
    
    .phone-link {
        display: none !important;
    }
}

.social-links {
    margin-top: auto;
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px 0;
}

.header-container{
    padding: 0 15px;
}
.call-button {
    margin-top: 20px;
    text-align: center;
    color: var(--color-white);
    text-decoration: none;
    font-size: 24px;
    padding: 12px 0;
    background-color: var(--background-dark-grey);
    border-radius: 12px;
}

.menu-item:hover, .menu-item:focus {
    color: var(--color-light-grey);
}

.dropdown-menu:before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent var(--background-medium-grey) transparent;
}

#header-desktop {
    position: fixed;
    width: 100%;
    left: 0;
    top: 0;
    z-index: 990;
    height: 76px;
    background-color: var(--background-dark-grey);
}

#header-desktop .header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.logo-block {
    width: 200px;
    height: 60px;
    background-color: var(--background-medium-grey);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-block img {
    width: auto;
    height: auto;
}

.nav-block {
    width: 736px;
    height: 60px;
    background-color: var(--background-medium-grey);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 4px;
    gap: 4px;
}

.nav-button {
    flex: 1;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    background-color: var(--background-dark-grey);
    font-size: 20px;
    font-family: 'Roboto', Arial, sans-serif;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.1s ease-in-out;
    position: relative;
}

.nav-button:hover {
    background-color: #434443; /* Need a variable for this slightly darker grey */
}

/* Индикатор выпадающего меню */
.nav-button-dropdown {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Меню */
.nav-button .dropdown-menu {
    position: absolute; 
    top: calc(100% + 12px); 
    left: 50%;
    background-color: var(--background-medium-grey); 
    box-shadow: 0 5px 15px var(--shadow-dark-20);
    display: block; 
    visibility: hidden; 
    opacity: 0;
    z-index: 1090; 
    padding: 10px 10px;
    border-radius: 5px;
    text-align: center; 
    transform: translateX(-50%) translateY(-5px); 
    transition: opacity 0.2s ease, 
                visibility 0s linear 1.2s, /* Задержка 1 секунда перед скрытием */
                transform 0.2s ease;
}

/* Показ меню при наведении на кнопку */
.nav-button:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0); 
    transition-delay: 0s;
    pointer-events: auto;
}

/* Дополнительное правило для поддержания видимости при наведении на меню */
.dropdown-menu:hover {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}

/* Стрелка/уголок меню */
.dropdown-menu-corner {
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    background-color: var(--background-medium-grey);
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
}

/* Оформление списка */
.dropdown-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.dropdown-menu-item {
    /* У Tilda часто нет отступов между li, отступы у ссылок */
}

.dropdown-menu-link {
    display: block;
    padding: 6px 6px;
    color: #d4d4d4; /* Need a variable for this light grey text */
    text-decoration: none;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 14px; 
    font-weight: 400;
    transition: color 0.2s ease, background-color 0.2s ease;
    text-align: center;
    line-height: 1.4; 
    border-radius: 3px;
}

.dropdown-menu-link:hover {
    color: var(--color-white);
}

.phone-button {
    width: 216px;
    height: 60px;
    background-color: var(--accent-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-size: 20px;
    font-family: 'Roboto', Arial, sans-serif;
    text-decoration: none;
}

@media screen and (max-width: 1199px) {
    #header-desktop .header-container {
        max-width: 960px;
    }
    
    .nav-block {
        width: 516px;
    }
}

@media screen and (max-width: 959px) {
    #header-desktop {
        display: none;
    }
    .logo-img img{
        height: 100%;
        width: auto;
    }
}
