/* Menu dọc chính */
.wc-product-categories-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

/* Item cha cấp 1 */
.wc-product-categories-tree > li.cat-parent {
    position: relative; /* Quan trọng: làm gốc tọa độ cho submenu */
    margin: 0;
    border-bottom: 1px solid #eee;
}

/* Link chung */
.wc-product-categories-tree a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    transition: all 0.3s ease;
    background-color: #fff;
}

/* Hover cho link */
.wc-product-categories-tree a:hover {
    background-color: #f0f0f0;
    color: #c00;
}

/* Submenu - mặc định ẩn và nằm bên phải */
.wc-product-categories-tree .cat-children {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    left: 100%;           /* Đẩy sát bên phải item cha */
    top: 0;               /* Căn đầu với item cha */
    width: 250px;         /* Chiều rộng submenu - bạn có thể chỉnh */
    background-color: #fff;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 999;
}

/* Khi hover vào item cha → hiện submenu bên phải */
.wc-product-categories-tree .cat-parent:hover > .cat-children {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Item con trong submenu */
.wc-product-categories-tree .cat-child {
    border-bottom: 1px solid #eee;
    margin-left: 0;
}

/* Link con */
.wc-product-categories-tree .cat-children a {
    padding: 10px 15px;
    font-size: 14px;
    color: #555;
    white-space: nowrap; /* Tránh xuống dòng nếu tên dài */
}

/* Hover link con */
.wc-product-categories-tree .cat-children a:hover {
    background-color: #f5f5f5;
    color: #c00;
}

/* Thêm mũi tên chỉ sang phải cho item cha có submenu */
.wc-product-categories-tree .cat-parent > a::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

/* Nếu danh mục cha có submenu → hiển thị mũi tên */
.wc-product-categories-tree .cat-parent:has(> .cat-children) > a::after {
    content: "▶";
}

/* Optional: Xoay mũi tên khi hover vào item cha có submenu */
.wc-product-categories-tree .cat-parent:has(> .cat-children):hover > a::after {
    transform: translateY(-50%) rotate(90deg);
}
/* Responsive - trên mobile thì chuyển về kiểu dọc (tránh submenu bay ra ngoài màn hình) */
@media (max-width: 768px) {
    .wc-product-categories-tree .cat-children {
        position: static;
        left: auto;
        top: auto;
        width: 100%;
        box-shadow: none;
        border: none;
        border-top: 1px solid #eee;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none; /* Ẩn mặc định */
    }
    
    .wc-product-categories-tree .cat-parent:hover > .cat-children {
        display: block; /* Hiện xuống dưới trên mobile */
    }
    
    .wc-product-categories-tree .cat-children a {
        padding-left: 30px;
    }
    
    .wc-product-categories-tree .cat-parent > a::after {
        content: "▼";
    }
}