/* Мобильная версия сайта */

/* Мобильный хедер */
.mobile-header {
    display: none;
    width: 100%;
    padding: 15px 20px;
    box-sizing: border-box;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: auto;
}

/* Гамбургер-кнопка */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 17px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-btn span {
    width: 100%;
    height: 4px;
    background-color: red;
    border-radius: 0;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Убрана анимация превращения в крестик - иконка остается неизменной */

/* Поиск в мобильном хедере */
.mobile-search-form {
    flex: 1;
    margin: 0 15px;
    position: relative;
    width: 100%;
    max-width: 250px;
    flex-shrink: 5;
    min-width: 100px;
    display: flex;
    align-items: center;
    height: 24px;
}

.mobile-search {
    width: 100%;
    height: 20px;
    padding: 0 18px 0 12px;
    border: 2px solid #bbaca7;
    background: white;
    outline: none;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
    font-family: 'Akrobat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #423730;
    box-sizing: border-box;
    line-height: 20px;
}

.mobile-search-form::before {
    content: '';
    position: absolute;
    right: 2px;
    top: 2.5px;
    width: 18px;
    height: 80%;
    background:
        linear-gradient(45deg, transparent 43%, #bbaca7 47%, #bbaca7 53%, transparent 57%) top,
        linear-gradient(-45deg, transparent 43%, #bbaca7 47%, #bbaca7 53%, transparent 57%) bottom;
    background-size: 100% 50%;
    background-repeat: no-repeat;
    z-index: 5;
    pointer-events: none;
}

/* Правая часть хедера */
.mobile-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-eng {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #423730;
    height: 24px;
    line-height: 24px;
    display: flex;
    align-items: center;
}

.mobile-icons-group {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 24px;
}

.mobile-icons-group span {
    display: flex;
    align-items: center;
    height: 24px;
}

.mobile-icons-group img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Выпадающее меню */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-menu {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    left: 0;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    padding: 4px 26px;
    box-sizing: border-box;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 8px 8px 25px rgba(0, 0, 0, 0.25);
    clip-path: polygon(0 0, calc(100% - 60px) 0, 100% 80px, 100% 100%, 0 100%);
    border: 2px solid #000000;
    z-index: 1003;
    overflow: hidden;
    pointer-events: auto;
}

.mobile-menu-large {
    width: 34vw;
    min-width: 33vw;
    max-width: 35vw;
}

.mobile-menu-small {
    display: none;
    width: 45vw;
    min-width: 45vw;
    max-width: 45vw;
    padding: 4px 26px;
}

.mobile-menu-large::before {
    content: '';
    position: absolute;
    top: calc(10% - 25px);
    left: calc(100% - 60px);
    width: 120px;
    height: 2px;
    background: #000000;
    transform-origin: left center;
    transform: translateY(-50%) rotate(53deg);
    pointer-events: none;
    z-index: 1004;
}

.mobile-menu-small::before {
    content: '';
    position: absolute;
    top: calc(10% + 10px);
    right: -23px;
    width: 110px;
    height: 2px;
    background: #000000;
    transform-origin: center;
    transform: translateY(-50%) rotate(53deg);
    pointer-events: none;
    z-index: 1004;
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateY(0);
    opacity: 1;
}

.mobile-menu-item {
    display: block;
    padding: 6px 0;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #423730;
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap;
    line-height: 1.1;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
    color: #a39794;
}

/* Нижнее мобильное меню */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32px; /* 56px / 1.75 ≈ 32px */
    background: #e1dddc;
    display: none;
    align-items: center;
    justify-content: flex-start; /* элементы слева с промежутками */
    padding: 0 8px;
    gap: 6px; /* расстояние между кнопками */
    box-sizing: border-box;
    z-index: 1100;
    letter-spacing: 0.08em;
}

/* Красный прямоугольник слева */
.mobile-bottom-nav::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2vw;
    height: 100%;
    background: #d92202;
    z-index: 1;
}

/* Убираем красный прямоугольник при активной кнопке каталога */
.mobile-bottom-nav:has(.bottom-nav-item.active-dropdown)::before {
    display: none;
}

.bottom-nav-item {
    text-transform: uppercase;
    background: transparent;
    border: none;
    padding: 0px 4px; /* небольшой padding для комфорта */
    font-family: 'Akrobat-SemiBold', sans-serif;
    font-size: 14px; /* максимально увеличенный размер текста */
    font-weight: 600; /* средняя жирность вместо максимальной */
    color: #423730;
    letter-spacing: -0.01em; /* отрицательное межбуквенное расстояние для большей плотности */
    cursor: pointer;
    white-space: nowrap; /* предотвращает перенос текста */
    overflow: visible; /* текст может выходить за границы */
    line-height: 1; /* компактная высота строки */
    /* flex свойства заданы индивидуально для каждой кнопки */
}

/* Минимальная ширина для каждой категории с возможностью растягивания */
.bottom-nav-item[data-nav="catalog"] { min-width: 80px; flex: 1; }
.bottom-nav-item[data-nav="gallery"] { min-width: 100px; flex: 2; } /* ИНТЕРЬЕРЫ - больше места и приоритет */
.bottom-nav-item[data-nav="about"] { min-width: 75px; flex: 1; }
.bottom-nav-item[data-nav="services"] { min-width: 65px; flex: 1; }
.bottom-nav-item[data-nav="blog"] { min-width: 50px; flex: 0.8; } /* БЛОГ - меньше места */
.bottom-nav-item[data-nav="partners"] { min-width: 90px; flex: 1.2; }

.bottom-nav-item.active {
    color: #a41a1a;
}

.bottom-nav-item.active-dropdown {
    background: #a41a1a;
    color: #ffffff;
    padding-top: 8px;
    padding-bottom: 16px;
    margin-top: -4px;
    margin-bottom: -12px;
    border-radius: 0;
}

.mobile-catalog-dropdown {
    position: fixed;
    transform-origin: left bottom;
    top: auto;
    bottom: 70px;
    left: 13px;
    width: 200vw;
    max-width: 200px;
    min-width: 200px;
    background: #ffffff;
    border: 2px solid #433730;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15);
    clip-path: polygon(0 0, calc(100% - 80px) 0, 100% 80px, 100% 100%, 0 100%);
    transform: translate3d(0, 120%, 0);
    transition: transform 0.25s ease;
    z-index: 1099;
    padding: 14px 24px 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-catalog-dropdown::before {
    content: '';
    position: absolute;
    top: -18px;
    right: -48px;
    width: 140px;
    height: 3px;
    background: #433730;
    transform-origin: left center;
    transform: rotate(45deg);
    pointer-events: none;
}

.mobile-catalog-dropdown button {
    background: transparent;
    border: none;
    text-align: left;
    text-transform: lowercase;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: #423730;
    padding: 0;
    cursor: pointer;
    width: 100%;
}

.mobile-catalog-dropdown button:hover {
    color: #a41a1a;
}

.mobile-catalog-dropdown.active {
    transform: translate3d(0, 0, 0);
}

.mobile-catalog-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 1098;
}

.mobile-catalog-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Адаптивность - показываем мобильный хедер только на мобильных устройствах */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .mobile-menu-large {
        display: flex;
    }

    /* Скрываем десктопный хедер и меню на мобильных */
    .header-row,
    .menu-wrapper {
        display: none;
    }

    /* Скрываем иконки соцсетей на мобильных */
    #social-icons {
        display: none;
    }

    body {
        padding-bottom: 46px; /* 70px - 24px (разница в высоте меню) */
    }

    .mobile-bottom-nav {
        display: flex;
        gap: 4px;
    }

    .mobile-catalog-dropdown {
        left: 20px;
        bottom: 20px; /* 56px - 20px (разница в высоте меню) */
        width: 50vw;
    }

    .gallery-section {
        padding-bottom: 0;
        margin-bottom: -15px;
    }

    .mobile-uslugi-contact,
    .catalog-mobile-contact,
    .global-info-wrapper,
    .mobile-global-contact {
        margin-bottom: -20px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .mobile-header {
        padding: 12px 15px;
    }

    .mobile-search-form {
        max-width: 150px;
        margin: 0 10px;
    }

    .mobile-search {
        font-size: 12px;
        padding: 6px 10px;
    }

    .mobile-header-right {
        gap: 10px;
    }

    .mobile-eng {
        font-size: 14px;
    }

    .mobile-icons-group {
        gap: 8px;
    }

    .mobile-icons-group img {
        width: 20px !important;
        height: 20px !important;
    }

    .mobile-menu-large {
        display: none;
    }

    .mobile-menu-small {
        display: flex;
    }

    .mobile-menu-small .mobile-menu-item {
        font-size: 18px;
        padding: 6px 0;
    }

    .mobile-bottom-nav {
        padding: 0 4px;
        height: 28px; /* еще меньше для очень маленьких экранов */
        gap: 2px; /* меньшее расстояние между кнопками */
    }

    .bottom-nav-item {
        font-family: 'Akrobat-SemiBold', sans-serif;
        font-size: 12px; /* максимально увеличенный размер текста для маленьких экранов */
        font-weight: 600; /* средняя жирность вместо максимальной */
        letter-spacing: -0.01em; /* отрицательное межбуквенное расстояние для большей плотности */
        padding: 0px 2px; /* небольшой padding */
        white-space: nowrap; /* предотвращает перенос текста */
        overflow: visible; /* текст может выходить за границы */
        line-height: 1; /* компактная высота строки */
        /* flex свойства заданы индивидуально для каждой кнопки */
    }

    /* Минимальная ширина для очень маленьких экранов с возможностью растягивания */
    .bottom-nav-item[data-nav="catalog"] { min-width: 62px; flex: 1; }
    .bottom-nav-item[data-nav="gallery"] { min-width: 80px; flex: 2; } /* ИНТЕРЬЕРЫ - адаптировано и приоритет */
    .bottom-nav-item[data-nav="about"] { min-width: 50px; flex: 1; }
    .bottom-nav-item[data-nav="services"] { min-width: 51px; flex: 1; }
    .bottom-nav-item[data-nav="blog"] { min-width: 37px; flex: 0.8; } /* БЛОГ - меньше места */
    .bottom-nav-item[data-nav="partners"] { min-width: 73px; flex: 1.2; }

    body {
        padding-bottom: 42px; /* для очень маленьких экранов: 70px - 28px */
    }

    .mobile-catalog-dropdown {
        left: 10px;
    }

    .gallery-section {
        padding-bottom: 0;
        margin-bottom: -15px;
    }

    .mobile-uslugi-contact,
    .catalog-mobile-contact,
    .global-info-wrapper,
    .mobile-global-contact {
        margin-bottom: -20px;
    }
}

/* Прячем мобильное нижнее меню на десктопах */
@media (min-width: 769px) {
    .mobile-bottom-nav,
    .mobile-catalog-dropdown,
    .mobile-catalog-overlay {
        display: none !important;
    }
}

