/**
 * 主持人筛选自定义下拉组件
 */

/* ========== 容器 ========== */
.host-filter-dropdown {
    position: relative;
    /* 不设 z-index：打开的用户下拉菜单(var(--z-sheet,200))必须盖住本控件，
       否则「全部主持人」会穿模浮在菜单上。bug-004 的"菜单不吞外部点击"
       由 AccessibleDropdown 的 pointerdown capture 关闭保证，与层级无关。 */
}

/* ========== Trigger 按钮 ========== */
.host-filter-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: var(--tap-control-min-h);
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.host-filter-trigger:hover {
    color: var(--neutral-800);
    background-color: var(--neutral-100);
}

.host-filter-trigger.active {
    color: var(--brand-primary);
    background-color: var(--brand-primary-soft);
}

/* a11y: 键盘焦点可见环 */
.host-filter-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-primary-soft);
}

.host-filter-chevron {
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.host-filter-trigger.active .host-filter-chevron {
    transform: rotate(180deg);
}

/* 选中了具体主持人时的视觉强调 */
.host-filter-trigger.has-selection {
    color: var(--brand-primary);
}

.host-filter-trigger.has-selection .host-filter-selected-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    margin-right: 2px;
}

/* ========== 下拉面板 ========== */
.host-filter-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: var(--z-dropdown, 155);
    overflow: hidden;
}

.host-filter-panel.show {
    display: block;
    animation: hostFilterFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hostFilterFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== 列表容器 ========== */
.host-filter-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 6px;
}

/* 自定义滚动条 */
.host-filter-list::-webkit-scrollbar {
    width: 5px;
}

.host-filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.host-filter-list::-webkit-scrollbar-thumb {
    background: var(--neutral-200);
    border-radius: 3px;
}

.host-filter-list::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-300);
}

/* ========== 列表项 ========== */
.host-filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.host-filter-item:hover {
    background: var(--neutral-50);
}

/* a11y: 选项键盘焦点可见环（roving focus） */
.host-filter-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-primary-soft);
}

.host-filter-item.selected {
    background: var(--brand-primary-soft);
}

.host-filter-item.selected::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--brand-primary);
}

/* ========== 头像 ========== */
.host-filter-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
}

/* "全部主持人" 的图标头像 */
.host-filter-avatar.all-hosts {
    background: var(--neutral-100);
    color: var(--neutral-500);
}

.host-filter-avatar.all-hosts svg {
    width: 16px;
    height: 16px;
}

/* ========== 用户信息 ========== */
.host-filter-info {
    flex: 1;
    min-width: 0;
}

.host-filter-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-800);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-filter-username {
    font-size: 11px;
    color: var(--neutral-400);
    line-height: 1.3;
    margin-top: 1px;
}

/* ========== 统计徽章 ========== */
.host-filter-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.host-filter-stat {
    font-size: 11px;
    color: var(--neutral-400);
    line-height: 1.3;
    white-space: nowrap;
}

.host-filter-stat-recent {
    color: var(--brand-primary);
    font-weight: 500;
}

/* ========== 分隔线 ========== */
.host-filter-divider {
    height: 1px;
    background: var(--neutral-100);
    margin: 4px 8px;
}

/* ========== 选中指示器 ========== */
.host-filter-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--brand-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.host-filter-item.selected .host-filter-check {
    opacity: 1;
}

/* ========== "全部主持人" 项样式 ========== */
.host-filter-item.all-item .host-filter-name {
    font-weight: 500;
}

.host-filter-item.all-item .host-filter-stats {
    display: none;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .host-filter-dropdown {
        min-width: 0;
    }

    .host-filter-trigger {
        width: 100%;
        justify-content: center;
    }

    .host-filter-panel {
        position: fixed;
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        min-width: auto;
        max-height: 60vh;
        border-radius: 20px 20px 20px 20px;
        box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
    }

    .host-filter-panel.show {
        animation: hostFilterSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes hostFilterSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* 遮罩层 */
    .host-filter-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: calc(var(--z-dropdown, 155) - 1);
        backdrop-filter: blur(2px);
    }

    .host-filter-backdrop.show {
        display: block;
        animation: hostFilterBackdropIn 0.2s ease;
    }

    @keyframes hostFilterBackdropIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}
