/* === 自定义下拉框样式 (替代原生Select) === */
.custom-select-container {
    position: relative;
    width: 100%;
    cursor: pointer;
    flex: 1;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    /* PC端高度 */
    padding: 0 10px;
    font-size: 14px;
    color: #334155;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-user-select: none;
    user-select: none;
}

/* 选项列表 */
.custom-options {
    position: absolute;
    left: 0;
    width: 100%;
    /* 默认与父容器同宽 */
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    max-height: 280px;
    overflow-y: auto;
    /* 滚动条美化 */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.custom-options.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-options::-webkit-scrollbar {
    width: 6px;
}

.custom-options::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.custom-option {
    padding: 12px 16px;
    text-align: center;
    transition: all 0.2s;
    color: #475569;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: #f8fafc;
    color: var(--luxury-gold);
}

.custom-option.selected {
    background: rgba(197, 160, 89, 0.08);
    color: var(--luxury-gold);
    font-weight: 600;
}

/* PC 端默认向下弹出，位置微调 */
.custom-options {
    top: 100%;
    margin-top: 8px;
}

/* === 手机端适配 (强制上拉) === */
@media (max-width: 767px) {
    .custom-select-trigger {
        height: 34px;
        font-size: 12px;
    }

    /* 核心修复：改变定位基准 */
    .custom-select-container {
        position: static;
        /* 让菜单相对于外层的 .filter-dropdown-item 定位 */
    }

    .custom-options {
        top: auto;
        bottom: 100%;
        margin-bottom: 5px;
        /* 稍微留一点，防止视觉上和按钮重叠得太生硬，5px刚好 */
        margin-top: 0;

        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
        transform: translateY(10px);

        min-width: 33vw;
        /* 强制为屏幕的1/3宽度 */
        width: auto;
        white-space: nowrap;
    }

    .custom-options.open {
        transform: translateY(0);
    }

    /* === 智能对齐：防止菜单超出屏幕 === */
    /* 第一个区域（地区）：左对齐 */
    .filter-dropdown-item:first-child .custom-options {
        left: 0;
        right: auto;
    }

    /* 第二个区域（服务）：居中对齐 */
    .filter-dropdown-item:nth-child(2) .custom-options {
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        /* 注意这里transform会覆盖上面的，所以要补上动画初始态 */
    }

    .filter-dropdown-item:nth-child(2) .custom-options.open {
        transform: translateX(-50%) translateY(0);
    }

    /* 第三个区域（价格）：右对齐 */
    .filter-dropdown-item:last-child .custom-options {
        left: auto;
        right: 0;
    }
}