/* Основной контейнер категорий */
#categories {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 60px;
    background-color: #222; /* Тёмный фон */
    margin-top: 80px;
    position: relative;
    overflow: visible;
    font-size: clamp(14px, 16px, 18px);
}

/* Стили для категории */
.category {
    padding: 12px 25px;
    margin: 5px;
    cursor: pointer;
    font-weight: 500;
    color: #fff; /* Белый текст */
    border: 1px solid #f1c40f; /* Жёлтый для активных элементов */
    border-radius: 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 1.05em;
}

.category:hover {
    background-color: #f1c40f; /* Жёлтый для активных элементов */
}

/* Стили для полноэкранного подменю */
.submenu {
    position: absolute;
    top: calc(100%);
    left: 0;
    right: 0;
    background: rgba(39, 39, 39, 0.98); /* Полупрозрачный фон подменю */
    padding: 20px 0 60px; /* Увеличенный отступ снизу для точек и кнопок */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.1s ease, visibility 0.2s ease;
    z-index: 1001;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.submenu.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Скрытие скроллбара для подменю */
.submenu::-webkit-scrollbar {
    display: none;
}

.submenu {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Контейнер для контента подменю (карусель) */
.submenu-content {
    display: flex;
    flex-wrap: wrap; /* Перенос колонок на следующую строку */
    justify-content: center;
    max-width: 90vw; /* Увеличено для отображения всех колонок */
    margin: 0 auto;
    gap: 20px;
    padding: 0 20px;
    overflow-x: hidden; /* Отключаем горизонтальную прокрутку */
    position: relative;
}

/* Стили для колонок в подменю */
.column {
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 200px;
    min-width: 180px;
    max-width: 240px;
    max-height: 300px;
    overflow-y: auto;
    position: relative;
}

/* Ограничение количества колонок в строке */
@media (max-width: 1200px) {
    .submenu-content {
        flex-wrap: wrap;
    }
    .column {
        flex: 0 0 calc(33.33% - 20px); /* 3 колонки в строке с учетом gap */
        max-width: calc(33.33% - 20px);
    }
}

@media (max-width: 768px) {
    .column {
        flex: 0 0 calc(50% - 20px); /* 2 колонки в строке */
        max-width: calc(50% - 20px);
    }
}

/* Скрытие скроллбара для колонок */
.column::-webkit-scrollbar {
    display: none;
}

.column {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Градиентный индикатор прокрутки (внизу) */
.column.has-scroll::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, transparent, rgba(100, 100, 100, 0.7)); /* Серый градиент */
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Градиентный индикатор прокрутки (вверху) */
.column.has-scroll-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, transparent, rgba(100, 100, 100, 0.7)); /* Серый градиент */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.column.has-scroll-top.scrolled::before {
    opacity: 1;
}

/* Стили для элементов подменю */
.subsubcategory {
    padding: 8px 0;
    transition: background-color 0.3s ease;
}

.subcategory a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.subsubcategory a {
    color: #d8d8d8;
    text-decoration: none;
    display: block;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    font-size: 0.95em;
}

.subsubcategory:hover a {
    color: #ffffff;
    text-shadow: 0 0 5px #ffffff,
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 20px rgba(255, 255, 255, 0.5);
}

.subcategory:hover a {
    color: #ffd700;
    text-shadow: 0 0 2px #ffd700, 0 0 5px #ffd700, 0 0 10px #ffd700, 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Стили для навигационных точек и кнопок карусели */
.carousel-controls {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

.dots-container {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: #f1c40f; /* Жёлтый для активной точки */
}

.carousel-button {
    width: 30px;
    height: 30px;
    background: #666;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.3s ease;
}

.carousel-button:hover {
    background: #f1c40f;
}

.carousel-button:disabled {
    background: #444;
    cursor: not-allowed;
}

/* Скрытие элементов с классом hidden_block */
.hidden_block {
    display: none;
}

/* Адаптивность для больших экранов */
@media (min-width: 1200px) {
    #categories {
        padding: 20px 60px;
    }

    .category {
        padding: 12px 25px;
        font-size: 1.05em;
    }

    .submenu-content {
        max-width: 90vw;
        gap: 30px;
        padding: 0 30px;
    }

    .column {
        flex: 0 0 220px;
        min-width: 200px;
        max-width: 260px;
    }

    .subsubcategory a {
        font-size: 1em;
    }
}

@media (min-width: 1600px) {
    #categories {
        padding: 25px 80px;
    }

    .category {
        padding: 14px 30px;
        font-size: 1.1em;
    }

    .submenu-content {
        max-width: 90vw;
        gap: 40px;
        padding: 0 40px;
    }

    .column {
        flex: 0 0 240px;
        min-width: 220px;
        max-width: 280px;
    }
}
