/**
 * Sort Dropdown Fix
 * Sửa lỗi hiển thị dropdown sắp xếp giá
 */

/* Container cho sort - FIX BỊ CHE */
.rental-service__sort-by {
    position: relative;
    display: inline-block;
    cursor: pointer;
    z-index: 100; /* ⭐ Tăng z-index để không bị che */
}

.rental-service__sort-by .label {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.rental-service__sort-by:hover .label,
.rental-service__sort-by.open .label {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* Rotate icon khi dropdown mở */
.rental-service__sort-by.open .label i {
    transform: rotate(180deg);
}

/* Dropdown container - FIX BỊ CHE */
.block-sorted-by {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 9999 !important; /* ⭐ Tăng z-index CỰC CAO để không bị che */
    min-width: 200px;
    display: none; /* Thay vì opacity/visibility để tránh giựt */
    pointer-events: none;
}

/* Show dropdown khi active - FIX GIỰT GIẬT */
.block-sorted-by.show {
    display: block;
    pointer-events: auto;
}
/* Dropdown list */
.ul-sorted-by {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
}

/* Dropdown items - FIX GIỰT GIẬT */
.btn-sorted-by {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.btn-sorted-by:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.btn-sorted-by.active {
    background-color: #e7f3ff;
    color: #007bff;
    font-weight: 500;
}

.btn-sorted-by span {
    white-space: nowrap;
}

/* Icon cho active item */
.btn-sorted-by__display-select {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
}

.btn-sorted-by.active .btn-sorted-by__display-select::before {
    content: '✓';
    color: #007bff;
    font-weight: bold;
}

/* Quick sort variant */
.btn-quick-sort {
    cursor: pointer;
    user-select: none;
}

/* Version 2 style */
.btn-sorted-by-ver-2 {
    position: relative;
    padding-left: 36px;
}

.btn-sorted-by-ver-2::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    /* transition: all 0.2s ease; */
}

.btn-sorted-by-ver-2.active::before {
    border-color: #007bff;
    background-color: #007bff;
}

.btn-sorted-by-ver-2.active::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background-color: #ffffff;
    border-radius: 50%;
}

/* Section row note integration */
.section-row-note {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.section-row-note .block-note {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-row-note .block-note .icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-row-note .block-note .label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .block-sorted-by {
        right: auto;
        left: 0;
        min-width: 250px;
    }

    .rental-service__sort-by .label {
        padding: 6px 10px;
        font-size: 13px;
    }

    .btn-sorted-by {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Animation đã được define ở trên - không cần duplicate */

/* Fix overflow issues - QUAN TRỌNG để dropdown không bị clip */
.section-block-title {
    position: relative;
    overflow: visible !important; /* ⭐ Force visible */
    z-index: 1; /* Lower than dropdown */
}

.section-product-content {
    position: relative;
    overflow: visible !important; /* ⭐ Force visible */
}

/* Fix panel có thể che dropdown */
.product-category-panel {
    position: relative;
    z-index: 1; /* Lower than sort dropdown */
}

.section-block-title-vendor {
    position: relative;
    overflow: visible !important;
    z-index: 1;
}

/* Đảm bảo parent containers không clip dropdown */
.block-note {
    position: relative;
    overflow: visible !important;
}

.section-row-note {
    position: relative;
    overflow: visible !important;
}

/* Ensure dropdown is above other content - REMOVED DUPLICATE */
/* Đã set z-index ở trên rồi */