/* Category Menu Styles */
.category-menu-container {
    position: relative;
    display: inline-block;
}

.category-menu-button {
    display: flex;
    align-items: center;
    background-color: #2a7a9e;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.category-menu-button:hover {
    background-color: #1c5d7a;
}

.category-icon {
    margin-right: 8px;
    font-size: 18px;
}

/* Dropdown Content */
.category-dropdown {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    width: 100%;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden; /* Contain overflowing content */
    /* Top and bottom will be set by JavaScript */
}

.dropdown-layout {
    display: flex;
    height: 100%; /* Make layout fill full height of parent */
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
}

.categories-sidebar {
    width: 300px;
    min-width: 300px;
    background-color: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    height: 100%; /* Ensure sidebar fills full height */
    /* Тонкий скроллбар для большего пространства */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

/* Стили скроллбара для webkit браузеров */
.categories-sidebar::-webkit-scrollbar {
    width: 6px;
}

.categories-sidebar::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.categories-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.categories-sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.main-categories {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.main-category-item {
    padding: 0;
}

.main-category-item a {
    display: block;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.main-category-item:hover a {
    background-color: #e8e8e8;
}

.main-category-item.active a {
    background-color: #e0f2ff;
    border-left-color: #2a7a9e;
    font-weight: 600;
    color: #2a7a9e;
}

/* Right Content Area */
.subcategories-content {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
    height: 100%;
    background-color: #fff;
}

.subcategory-columns {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px; /* Reduced from -15px */
}

.subcategory-column {
    width: 33.33%; /* Exactly 3 columns */
    padding: 0 10px 25px;
    box-sizing: border-box;
}

.subcategory-column h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #2a7a9e;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-top: 25px; /* Add more space before a new category heading */
}

/* First h4 in column should not have top margin */
.subcategory-column h4:first-child {
    margin-top: 0;
}

.subcategory-column h4 a {
    color: #2a7a9e;
    text-decoration: none;
}

.subcategory-column h4 a:hover {
    text-decoration: underline;
}

.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subcategory-list li {
    margin-bottom: 6px; /* Decreased from 8px */
}

.subcategory-list a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
}

.subcategory-list a:hover {
    color: #2a7a9e;
    text-decoration: underline;
}

/* View all link style */
.subcategory-list li.view-all {
    margin-top: 8px;
}

.subcategory-list li.view-all a {
    color: #2a7a9e;
    font-weight: 500;
    font-size: 13px;
}

.view-all-link {
    color: #2a7a9e;
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Show the dropdown when button is clicked */
.category-dropdown.active {
    display: block;
}

/* Overlay to close dropdown when clicking outside */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: #999;
}

.loading-indicator:after {
    content: "Loading...";
    font-style: italic;
}

.error, .no-subcategories {
    padding: 20px;
    text-align: center;
    color: #666;
}

.error {
    color: #e74c3c;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .categories-sidebar {
        width: 250px;
        min-width: 250px;
    }
}

@media (max-width: 992px) {
    .dropdown-layout {
        height: calc(100vh - 100px);
    }
    
    .subcategory-column {
        width: 50%;
    }
}

@media (max-width: 768px) {
    .category-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        max-height: none; /* Remove any max-height restriction */
    }
    
    .dropdown-layout {
        flex-direction: column;
        height: 100%;
    }
    
    .categories-sidebar {
        width: 100%;
        min-width: auto;
        max-height: 40%;
    }
    
    .subcategory-column {
        width: 50%;
    }
    
    .subcategories-content {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .subcategory-column {
        width: 100%;
    }
}