/**
 * Mobile Bottom Menu CSS
 * Версия: 6.0 - SVG иконки, сохранение функциональности
 */

/* Базовое скрытие на десктопе */
#mobile-bottom-menu {
    display: none;
}

/* Мобильные стили (до 767px) */
@media only screen and (max-width: 767px) {
    
    /* Скрываем десктопное меню */
    .navbar,
    .navigation .navbar,
    .nav-collapse,
    .nav-collapse .nav,
    .navbar .btn-navbar {
        display: none !important;
    }
    
    .header-search {
        display: none !important;
    }
    
    /* Скрываем YJ Vertical Menu */
    #yj-vertical-menu,
    #yjsg-vertical-menu,
    .yj-vertical-menu,
    .yjsg-vertical-menu,
    .yj-vertical-menu-container,
    .yjsg-menu-vertical,
    .module_yjverticalmenu,
    .mod_yjverticalmenu,
    [class*="yj-vertical"],
    [class*="yjsg-vertical"],
    [id*="yj-vertical"],
    [id*="yjsg-vertical"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        z-index: -9999 !important;
    }
    
    .yj-vertical-menu-wrapper,
    .yjsg-vertical-menu-wrapper,
    .vertical-menu-wrapper {
        display: none !important;
    }
    
    .position-7,
    .position-vertical,
    .left-column .module,
    .sidebar .module {
        display: none !important;
    }
    
    /* ----- ОСНОВНОЙ БЛОК НИЖНЕГО МЕНЮ ----- */
    #mobile-bottom-menu {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #1a1a1a;
        background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
        justify-content: space-around;
        align-items: center;
        height: 65px;
        z-index: 9999;
        box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.5);
        border-top: 2px solid #ff6600;
        padding: 0 5px;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        flex-direction: row !important;
        flex-wrap: nowrap;
    }
    
    /* ----- ПУНКТЫ МЕНЮ (ГОРИЗОНТАЛЬНО) ----- */
    .menu-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer;
        padding: 5px 4px;
        color: #888;
        transition: all 0.3s ease;
        flex: 1;
        height: 100%;
        text-decoration: none;
        border: none;
        background: transparent;
        font-size: 10px;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        text-align: center;
    }
    
    .menu-item:active {
        transform: scale(0.92);
    }
    
    /* ----- ИКОНКИ (SVG через фон) ----- */
    .menu-item i {
        display: block !important;
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        margin: 0 auto 3px !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        transition: all 0.3s ease !important;
        flex-shrink: 0 !important;
    }
    
    /* Убираем все псевдоэлементы */
    .icon-home::before,
    .icon-list::before,
    .icon-star::before,
    .icon-telegram::before,
    .icon-phone::before {
        content: none !important;
        display: none !important;
    }
    
    /* ----- ОБЫЧНЫЕ ИКОНКИ (серые) ----- */
    .icon-home { 
        background-image: url('../images/icons/home.svg') !important; 
    }
    .icon-list { 
        background-image: url('../images/icons/menu.svg') !important; 
    }
    .icon-star { 
        background-image: url('../images/icons/star.svg') !important; 
    }
    .icon-telegram { 
        background-image: url('../images/icons/telegram.svg') !important; 
    }
    .icon-phone { 
        background-image: url('../images/icons/phone.svg') !important; 
    }
    
    /* ----- АКТИВНЫЕ ИКОНКИ (оранжевые) ----- */
    .menu-item.active .icon-home { 
        background-image: url('../images/icons/home-active.svg') !important; 
    }
    .menu-item.active .icon-list { 
        background-image: url('../images/icons/menu-active.svg') !important; 
    }
    .menu-item.active .icon-star { 
        background-image: url('../images/icons/star-active.svg') !important; 
    }
    .menu-item.active .icon-telegram { 
        background-image: url('../images/icons/telegram-active.svg') !important; 
    }
    .menu-item.active .icon-phone { 
        background-image: url('../images/icons/phone-active.svg') !important; 
    }
    
    /* ----- ТЕКСТ ПОД ИКОНКОЙ ----- */
    .menu-item span {
        display: block !important;
        font-size: 9px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        font-weight: 500 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        color: inherit !important;
    }
    
    /* ----- АКТИВНЫЙ ПУНКТ ----- */
    .menu-item.active {
        color: #ff6600 !important;
    }
    
    .menu-item.active i {
        transform: scale(1.05);
    }
    
    /* Индикатор активного пункта (полоска сверху) */
    .menu-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 3px;
        background: #ff6600;
        border-radius: 0 0 3px 3px;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            transform: translateX(-50%) scaleX(0);
            opacity: 0;
        }
        to {
            transform: translateX(-50%) scaleX(1);
            opacity: 1;
        }
    }
    
    /* ----- ВЫПАДАЮЩЕЕ МЕНЮ (оверлей) ----- */
    #mobile-overlay-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.75);
        z-index: 10000;
        display: none;
        animation: fadeIn 0.3s ease;
    }
    
    .mobile-menu-content {
        position: absolute;
        bottom: 65px;
        left: 0;
        right: 0;
        background: #1a1a1a;
        background: linear-gradient(0deg, #1a1a1a 0%, #2a2a2a 100%);
        max-height: 70vh;
        overflow-y: auto;
        padding: 20px 25px 30px;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-menu-content::-webkit-scrollbar {
        width: 5px;
    }
    .mobile-menu-content::-webkit-scrollbar-track {
        background: #2a2a2a;
    }
    .mobile-menu-content::-webkit-scrollbar-thumb {
        background: #ff6600;
        border-radius: 10px;
    }
    
    /* ----- КНОПКА ЗАКРЫТИЯ МЕНЮ ----- */
    .menu-close {
        color: #fff;
        font-size: 28px;
        text-align: right;
        cursor: pointer;
        margin-bottom: 15px;
        padding: 5px;
        transition: all 0.3s ease;
        width: 40px;
        margin-left: auto;
        opacity: 0.7;
    }
    
    .menu-close:hover {
        opacity: 1;
        transform: rotate(90deg);
    }
    
    .menu-close:active {
        transform: scale(0.9);
    }
    
    /* ----- ОСНОВНОЕ МЕНЮ ----- */
    .mobile-main-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .mobile-main-menu > li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .mobile-main-menu > li:last-child {
        border-bottom: none;
    }
    
    .mobile-main-menu > li > a {
        display: block;
        color: #fff;
        padding: 15px 10px;
        text-decoration: none;
        font-size: 16px;
        font-weight: 400;
        transition: all 0.3s ease;
        position: relative;
        padding-left: 15px;
    }
    
    .mobile-main-menu > li > a:hover,
    .mobile-main-menu > li > a:active {
        color: #ff6600;
        padding-left: 25px;
        background: rgba(255, 102, 0, 0.08);
    }
    
    .mobile-main-menu > li.active > a {
        color: #ff6600;
        font-weight: 600;
        padding-left: 25px;
    }
    
    /* ----- ПОДМЕНЮ ----- */
    .mobile-submenu {
        list-style: none;
        padding: 0;
        margin: 0 0 0 15px;
        border-left: 2px solid #ff6600;
        display: none;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 0 0 0 5px;
    }
    
    .mobile-submenu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .mobile-submenu li:last-child {
        border-bottom: none;
    }
    
    .mobile-submenu a {
        display: block;
        padding: 12px 10px 12px 20px;
        font-size: 14px;
        color: #aaa;
        text-decoration: none;
        transition: all 0.3s ease;
        position: relative;
    }
    
    .mobile-submenu a:hover,
    .mobile-submenu a:active {
        color: #ff6600;
        padding-left: 30px;
        background: rgba(255, 102, 0, 0.05);
    }
    
    .mobile-submenu .active > a {
        color: #ff6600;
        font-weight: 500;
    }
    
    .menu-item-open > .mobile-submenu {
        display: block;
        animation: submenuSlide 0.3s ease;
    }
    
    @keyframes submenuSlide {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* ----- ОТСТУП ДЛЯ КОНТЕНТА ----- */
    body {
        padding-bottom: 75px !important;
    }
}

/* ============================================
   ПЛАНШЕТЫ
   ============================================ */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
    #mobile-bottom-menu {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #1a1a1a !important;
        border-top: 2px solid #ff6600 !important;
        height: 70px !important;
        justify-content: space-around !important;
        align-items: center !important;
        z-index: 9999 !important;
        padding: 0 10px !important;
        flex-direction: row !important;
    }
    
    .menu-item i {
        width: 32px !important;
        height: 32px !important;
    }
    
    .menu-item span {
        font-size: 11px !important;
    }
    
    body {
        padding-bottom: 80px !important;
    }
    
    /* Скрываем YJ Vertical Menu на планшетах */
    #yj-vertical-menu,
    #yjsg-vertical-menu,
    .yj-vertical-menu,
    .module_yjverticalmenu {
        display: none !important;
    }
    
    .position-7 {
        display: none !important;
    }
    
    .navbar,
    .navigation .navbar,
    .nav-collapse {
        display: none !important;
    }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */
@media print {
    #mobile-bottom-menu,
    #mobile-overlay-menu {
        display: none !important;
    }
}