/* Левое боковое mega-меню каталога */

.catalog-menu-container {
    position: relative;
    display: block;
}

/* Триггер-кнопка */
.catalog-trigger-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #364259;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    margin-left: 5px;
    min-height: 40px;
    min-width: 40px;
    justify-content: center;
}

.catalog-trigger-button:hover {
    background: #2d3748;
}

.catalog-trigger-icon {
    font-size: 20px;
    line-height: 1;
}

.catalog-trigger-text {
    display: none;
}

/* Overlay */
.catalog-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none;
}

.catalog-menu-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

/* Контейнер меню */
.catalog-menu-wrap {
	font-family: 'Roboto', sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    width: 90%;
    max-width: 1200px;
    height: 100vh;
    background: white;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.catalog-menu-wrap.active {
    display: flex;
    transform: translateX(0);
}

.catalog-menu-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Контейнер для двух колонок */
.catalog-menu-columns-wrapper {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    /* flex: 1 автоматически займет оставшееся пространство после header */
}

/* Левая колонка */
.catalog-menu-left-column {
    width: 100px;
    min-width: 100px;
    background: #f8f9fa;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* Скрытие скроллбара - все браузеры */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE и Edge */
}

/* Скрытие скроллбара для WebKit браузеров (Chrome, Safari, Opera) */
.catalog-menu-left-column::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

.catalog-menu-left-column::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
}

.catalog-menu-left-column::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

/* Скрытие скроллбара для всех дочерних элементов */
.catalog-menu-left-column * {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE и Edge */
}

.catalog-menu-left-column *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

.catalog-menu-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1c2526;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.catalog-menu-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-menu-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.catalog-menu-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.catalog-menu-categories {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    /* Убираем overflow-y отсюда - прокрутка должна быть только на родителе .catalog-menu-left-column */
    overflow: visible;
}

.category-item.level0 {
    border-bottom: 1px solid #e2e8f0;
}

.category-item.level0:last-child {
    border-bottom: none;
}

.category-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
}

.category-link:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.category-item.active .category-link {
    background: white;
    color: #1e293b;
    font-weight: 600;
}

.category-item.active .category-link::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #d8153c;
}

.category-item.active .category-link {
    background: white;
    color: #1e293b;
    font-weight: 600;
}

.category-item.active .category-icon {
    border-color: #e2e8f0;
}

.category-icon {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
}

.category-icon-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 20px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
}

.category-name {
    font-size: 13px;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    word-wrap: break-word;
}

.category-arrow {
    display: none; /* Скрываем стрелку при вертикальной компоновке */
}

/* Правая колонка */
.catalog-menu-right-column {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    padding: 30px 40px;
    min-width: 0; /* Позволяет flex-элементу сжиматься */
    height: 100%;
}

.menu-sub-items-block {
    display: none;
    animation: fadeIn 0.3s ease;
}

.menu-sub-items-block.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.submenu-header {
    margin-bottom: 24px;
}

.submenu-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.submenu-quick-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.quick-link {
    width: 100%;
    padding: 8px 16px;
    background: #d8153c;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    display: block;
    box-sizing: border-box;
}

.quick-link:hover {
    background: #b81233;
    opacity: 0.9;
}

.quick-link-main {
    /* Основная ссылка "Все Кольца" - на всю ширину */
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.quick-links-grid .quick-link {
    /* Высота в половину от .subcategory-item */
    /* .subcategory-item: изображение (aspect-ratio: 1) + padding названия (12px * 2 = 24px) */
    /* Ширина карточки в grid из 4 колонок: (100% - 3 * 20px gap) / 4 */
    /* Высота карточки = ширина карточки + 24px */
    /* Половина = (ширина карточки + 24px) / 2 */
    height: calc(((100% - 60px) / 4 + 24px) / 2);
    min-height: 60px; /* Минимальная высота для читаемости */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c2526;
    color: #fff;
    line-height: 1.4;
}

.quick-links-grid .quick-link:hover {
    background: #2a3537;
    opacity: 0.9;
}

/* Grid подкатегорий */
.submenu-categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.subcategory-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #1e293b;
    transition: transform 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.subcategory-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.subcategory-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subcategory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.subcategory-item:hover .subcategory-image img {
    transform: scale(1.05);
}

.subcategory-name {
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.subcategory-count {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

/* Аккордеоны фильтров */
.submenu-filters {
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    column-gap: 30px;
}

.filter-accordion {
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.filter-accordion:last-child {
    border-bottom: none;
}

.filter-accordion-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    user-select: none;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    list-style: none;
    transition: color 0.2s ease;
}

.filter-accordion-title:hover {
    color: #3b82f6;
}

.filter-accordion-title::-webkit-details-marker {
    display: none;
}

.accordion-icon {
    font-size: 18px;
    color: #94a3b8;
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
}

details[open] .accordion-icon {
    transform: rotate(45deg);
    color: #3b82f6;
}

.filter-accordion-content {
    padding: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-link {
    padding: 8px 12px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-link:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Мобильная адаптация */
@media (max-width: 1024px) {
    .catalog-menu-wrap {
        width: 85%;
        max-width: 600px;
    }
    
    .catalog-menu-left-column {
        width: 240px;
        min-width: 240px;
    }
    
    .submenu-categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
}

@media (max-width: 768px) {
    .catalog-menu-wrap {
        width: 100%;
        max-width: 100%;
    }
    
    /* Оставляем две колонки даже на мобильных */
    .catalog-menu-columns-wrapper {
        flex-direction: row;
    }
    
    .catalog-menu-left-column {
        width: 110px;
        min-width: 110px;
        border-right: 1px solid #e2e8f0;
    }
    
    .catalog-menu-right-column {
        padding: 20px 16px;
    }
    
    .submenu-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .submenu-filters {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .submenu-title {
        font-size: 24px;
    }
    
    .category-icon {
        width: 60px;
        height: 60px;
    }
    
    .category-icon-placeholder {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .category-name {
        font-size: 15px;
    }
}

/* Доступность */
.catalog-menu-wrap:focus-within {
    outline: none;
}

.category-link:focus,
.quick-link:focus,
.filter-link:focus,
.catalog-trigger-button:focus {
    outline-offset: 2px;
}

/* Временные классы для скрытия элементов - можно удалить позже */

/* Скрытие категорий 9-18 */
.temp-hide-category {
    display: none !important;
}

/* Скрытие subcategory-item с картинками (кроме "Помолвочные" и "Белое золото") */
.temp-hide-subcategory {
    display: none !important;
}

/* 
ИНСТРУКЦИЯ ПО ОТКРЫТИЮ ЭЛЕМЕНТОВ:

1. Открыть все категории 9-18:
   - Удалите из CSS: .temp-hide-category { ... }
   ИЛИ удалите классы temp-hide-category из HTML

2. Открыть все subcategory-item:
   - Удалите из CSS: .temp-hide-subcategory { ... }
   ИЛИ удалите классы temp-hide-subcategory из HTML

3. Полностью убрать скрытие:
   - Удалите все классы temp-hide-* из HTML
   - Удалите все CSS правила выше
*/
