/* ==========================================================================
   CROSOFTFILM WEBCLIENT - FILTER DROPDOWN COMPONENT
   Reusable Inline Popover Dropdown (Disney+ / Steam Style)
   Component Scope: .ns-filter-dropdown
   ========================================================================== */

.ns-filter-dropdown {
    position: relative;
    flex-shrink: 0;
}

/* 1. Trigger Button */
.ns-filter-dropdown .dropdown-btn,
.ns-filter-dropdown .ns-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #d1d5db;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.ns-filter-dropdown .dropdown-btn:hover,
.ns-filter-dropdown .ns-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.ns-filter-dropdown .dropdown-btn.is-active,
.ns-filter-dropdown .ns-dropdown-btn.is-active {
    background: rgba(229, 9, 20, 0.12);
    border-color: rgba(229, 9, 20, 0.4);
    color: #ffffff;
}

.ns-filter-dropdown .dropdown-btn.is-active .dropdown-value,
.ns-filter-dropdown .ns-dropdown-btn.is-active .ns-dropdown-value {
    color: #f87171;
    font-weight: 600;
}

.ns-filter-dropdown .dropdown-label,
.ns-filter-dropdown .ns-dropdown-label {
    color: #9ca3af;
}

.ns-filter-dropdown .dropdown-value,
.ns-filter-dropdown .ns-dropdown-value {
    color: #ffffff;
}

.ns-filter-dropdown .dropdown-chevron,
.ns-filter-dropdown .ns-dropdown-chevron {
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.ns-filter-dropdown.open .dropdown-chevron,
.ns-filter-dropdown.open .ns-dropdown-chevron {
    transform: rotate(180deg);
}

.ns-filter-dropdown.open .dropdown-btn,
.ns-filter-dropdown.open .ns-dropdown-btn {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

/* 2. Dropdown Menu Popup */
.ns-filter-dropdown .dropdown-menu,
.ns-filter-dropdown .ns-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 160px;
    max-height: 280px;
    overflow-y: auto;
    background: #1b1822;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    padding: 4px;
    z-index: 1050;
}

.ns-filter-dropdown.open .dropdown-menu,
.ns-filter-dropdown.open .ns-dropdown-menu {
    display: block;
    animation: nsDropdownFadeIn 0.15s ease-out;
}

@keyframes nsDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 3. Items */
.ns-filter-dropdown .dropdown-item,
.ns-filter-dropdown .ns-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12.5px;
    color: #d1d5db;
    border-radius: 4px;
    text-decoration: none !important;
    transition: all 0.12s ease;
    white-space: nowrap;
}

.ns-filter-dropdown .dropdown-item:hover,
.ns-filter-dropdown .ns-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.ns-filter-dropdown .dropdown-item.selected,
.ns-filter-dropdown .ns-dropdown-item.selected {
    color: #ef4444;
    font-weight: 600;
    background: rgba(229, 9, 20, 0.1);
}

/* 4. Responsive Mobile Dropdown (Thả xuống ngay dưới nút như Desktop) */
@media (max-width: 768px) {

    .ns-filter-dropdown .dropdown-menu,
    .ns-filter-dropdown .ns-dropdown-menu {
        max-width: min(260px, calc(100vw - 24px));
    }

    /* Dropdown ở cuối hàng căn sang phải để tránh tràn mép phải */
    .ns-filter-dropdown:last-child .dropdown-menu,
    .ns-filter-dropdown:nth-last-child(2) .dropdown-menu {
        left: auto;
        right: 0;
    }
}