/* Categories Menu Buttons - Green Button Style */
.categories-menu-buttons-wrapper {
    width: 100%;
    padding: 20px 0;
    margin: 20px 0;
}

.category-menu-item a span {
    font-size: 14px !important;
}

.categories-menu-buttons {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.category-menu-item {
    position: relative;
    margin: 0;
}

.category-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background-color: #237dc0; /* Green color */
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 100;
    font-size: 16px;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 130px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-button:hover {
    background-color: #1e6ba8; /* Darker blue on hover */
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.category-text {
    display: block;
    color: #ffffff;
}

.dropdown-arrow {
    margin-left: 8px;
    font-size: 12px;
    color: #ffffff;
    transition: transform 0.3s ease;
}

.category-menu-item.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.category-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 999;
    list-style: none;
    margin: 5px 0 0 0;
    padding: 8px 0;
    border-radius: 6px;
    overflow: hidden;
}

.category-menu-item.has-dropdown:hover .category-dropdown,
.category-menu-item.has-dropdown.active .category-dropdown {
    display: block;
}

.dropdown-item {
    margin: 0;
    padding: 0;
}

.dropdown-item a {
    display: block;
    padding: 10px 20px;
    color: #333333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
}

.dropdown-item a:hover {
    background-color: #f5f5f5;
    color: #237dc0;
    padding-left: 25px;
}

/* Nested Dropdown Support - For subcategories with their own children */
.dropdown-item {
    position: relative;
}

.dropdown-item.has-nested-dropdown {
    position: relative;
}

.dropdown-item.has-nested-dropdown > a {
    position: relative;
    padding-right: 30px;
}

.nested-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #666;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.dropdown-item.has-nested-dropdown:hover .nested-arrow,
.dropdown-item.has-nested-dropdown.active .nested-arrow {
    transform: translateY(-50%) rotate(90deg);
}

.nested-dropdown {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1001;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    border-radius: 6px;
    margin-left: 5px;
}

/* Show nested dropdown on hover */
.dropdown-item.has-nested-dropdown:hover .nested-dropdown,
.dropdown-item.has-nested-dropdown.active .nested-dropdown {
    display: block;
}

/* Support for nested dropdowns inside nested dropdowns (deeper levels) */
.nested-dropdown .dropdown-item {
    position: relative;
}

.nested-dropdown .dropdown-item.has-nested-dropdown > a {
    padding-right: 30px;
}

.nested-dropdown .nested-dropdown {
    z-index: 1002;
}

.nested-dropdown .dropdown-item a {
    padding: 10px 20px;
    color: #333333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    display: block;
}

.nested-dropdown .dropdown-item a:hover {
    background-color: #f5f5f5;
    color: #237dc0;
    padding-left: 25px;
}

/* Ensure nested dropdowns don't go off screen */
.category-dropdown {
    overflow: visible;
}

.nested-dropdown {
    overflow: visible;
}

/* Adjust nested dropdown position if it goes off screen (right side) */
.dropdown-item.has-nested-dropdown:hover .nested-dropdown,
.dropdown-item.has-nested-dropdown.active .nested-dropdown {
    /* Check if dropdown would go off screen - handled by JS if needed */
}

/* For RTL or when dropdown should appear on left side */
.dropdown-item.has-nested-dropdown .nested-dropdown.right-edge {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .categories-menu-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .category-menu-item {
        width: 100%;
    }
    
    .category-button {
        width: 100%;
        min-width: auto;
    }
    
    .category-dropdown {
        position: static;
        display: none;
        width: 100%;
        box-shadow: none;
        border: 1px solid #e0e0e0;
        margin-top: 5px;
    }
    
    .category-menu-item.has-dropdown.active .category-dropdown {
        display: block;
    }
    
    /* Nested dropdowns on mobile */
    .nested-dropdown {
        position: static;
        display: none;
        width: 100%;
        box-shadow: none;
        border: 1px solid #e0e0e0;
        margin-left: 0;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .dropdown-item.has-nested-dropdown.active .nested-dropdown {
        display: block;
    }
    
    .dropdown-item.has-nested-dropdown > a {
        padding-right: 20px;
    }
    
    .nested-arrow {
        right: 15px;
    }
    
    /* Nested dropdowns inside nested dropdowns on mobile */
    .nested-dropdown .nested-dropdown {
        position: static;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Indent nested items on mobile for better visual hierarchy */
    .nested-dropdown .dropdown-item a {
        padding-left: 30px;
    }
    
    .nested-dropdown .nested-dropdown .dropdown-item a {
        padding-left: 50px;
    }
}

/* RTL Support for Arabic */
body.rtl .category-dropdown {
    left: auto;
    right: 0;
}

body.rtl .dropdown-arrow {
    margin-left: 0;
    margin-right: 8px;
}

body.rtl .nested-dropdown {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 5px;
}

body.rtl .dropdown-item.has-nested-dropdown > a {
    padding-right: 20px;
    padding-left: 30px;
}

body.rtl .nested-arrow {
    right: auto;
    left: 15px;
}

