/* Mobile Home Filters - 移动端首页筛选器抽屉样式 */

/* 默认隐藏移动端组件 */
.mobile-home-filters-trigger,
.mobile-home-filters-overlay,
.mobile-home-filters-drawer {
    display: none;
}

/* 移动端显示 */
@media (max-width: 768px) {

    /* 隐藏PC端筛选器 */
    .home-filters-container {
        display: none !important;
    }

    /* 触发按钮 */
    .mobile-home-filters-trigger {
        display: block;
        width: 100%;
        margin: 1rem 0 0 0;
        padding: 1rem 2rem;
        background: var(--theme-color, #D7183D);
        color: white;
        border: none;
        border-radius: 4px;
        font-size: 1.1rem;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(215, 24, 61, 0.3);
        transition: all 0.3s ease;
    }

    .mobile-home-filters-trigger:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(215, 24, 61, 0.4);
    }

    .mobile-home-filters-trigger i {
        margin-right: 0.75rem;
        font-size: 1rem;
    }

    /* 遮罩层 */
    .mobile-home-filters-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    .mobile-home-filters-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* 抽屉容器 */
    .mobile-home-filters-drawer {
        display: block;
        position: fixed;
        top: 0;
        right: -100%;
        width: 90%;
        max-width: 400px;
        height: 100vh;
        background: white;
        z-index: 9999;
        padding: 0;
        overflow-y: auto;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        transition: right 0.3s ease-in-out;
    }

    .mobile-home-filters-drawer.show {
        right: 0;
    }

    /* 抽屉头部 */
    .mobile-home-filters-header {
        position: sticky;
        top: 0;
        background: white;
        padding: 1.5rem;
        border-bottom: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 10;
    }

    .mobile-home-filters-header h3 {
        margin: 0;
        font-size: 1.2rem;
        color: #333;
        font-weight: 600;
    }

    .mobile-home-filters-header h3 i {
        margin-right: 0.5rem;
        color: var(--theme-color, #D7183D);
    }

    /* 关闭按钮 */
    .mobile-home-filters-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #666;
        cursor: pointer;
        padding: 0.5rem;
        line-height: 1;
        border-radius: 50%;
        transition: all 0.2s ease;
    }

    .mobile-home-filters-close:hover {
        color: var(--theme-color, #D7183D);
        background: #f8f9fa;
    }

    /* 表单容器 */
    #mobile-home-filter-form {
        padding: 1.5rem 1.5rem 6rem;
        /* 增加底部padding为按钮区域和客服按钮留空间 */
    }

    /* 筛选组 */
    .mobile-filter-group {
        margin-bottom: 1.5rem;
        padding: 1rem;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }

    .mobile-filter-group label {
        display: block;
        font-weight: 600;
        color: #333;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    .mobile-filter-group .form-control {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 0.9rem;
        background: white;
        transition: border-color 0.2s ease;
    }

    .mobile-filter-group .form-control:focus {
        border-color: var(--theme-color, #D7183D);
        box-shadow: 0 0 0 0.2rem rgba(215, 24, 61, 0.15);
        outline: none;
    }

    /* 自定义下拉框样式 */
    .mobile-custom-select {
        position: relative;
        width: 100%;
    }

    .mobile-custom-select-trigger {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 0.9rem;
        background: white;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: border-color 0.2s ease;
    }

    .mobile-custom-select-trigger:hover,
    .mobile-custom-select-trigger.active {
        border-color: var(--theme-color, #D7183D);
    }

    .mobile-custom-select-arrow {
        transition: transform 0.2s ease;
        color: #666;
    }

    .mobile-custom-select-trigger.active .mobile-custom-select-arrow {
        transform: rotate(180deg);
    }

    .mobile-custom-select-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border: 1px solid #ddd;
        border-top: none;
        border-radius: 0 0 6px 6px;
        max-height: 200px;
        overflow-y: auto;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.2s ease;
    }

    .mobile-custom-select-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .mobile-custom-select-option {
        padding: 0.75rem;
        cursor: pointer;
        border-bottom: 1px solid #f0f0f0;
        transition: background-color 0.2s ease;
    }

    .mobile-custom-select-option:last-child {
        border-bottom: none;
    }

    .mobile-custom-select-option:hover {
        background-color: #f8f9fa;
    }

    .mobile-custom-select-option.selected {
        background-color: var(--theme-color, #D7183D);
        color: white;
    }

    /* 隐藏原生select */
    .mobile-filter-group .form-select {
        display: none;
    }

    /* Model Code 输入框 */
    .mobile-model-code-inputs {
        display: flex;
        gap: 0.5rem;
    }

    .mobile-model-code-inputs .form-select {
        flex: 1;
    }

    /* 价格输入框 */
    .mobile-price-inputs {
        display: flex;
        gap: 0.5rem;
    }

    .mobile-price-inputs .form-control {
        flex: 1;
    }

    /* Mileage 滑动条 */
    .mobile-mileage-filter {
        background: #f8f9fa;
    }

    .mobile-mileage-range-label {
        font-weight: normal;
        color: var(--theme-color, #D7183D);
        font-size: 0.8rem;
    }

    .mobile-mileage-range-container {
        margin-top: 1rem;
    }

    .mobile-mileage-dual-slider {
        position: relative;
        height: 40px;
        margin: 20px 0;
    }

    .mobile-mileage-slider-track {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 6px;
        background: #e9ecef;
        border-radius: 3px;
        transform: translateY(-50%);
    }

    .mobile-mileage-slider-range {
        position: absolute;
        height: 100%;
        background: var(--theme-color, #D7183D);
        border-radius: 3px;
    }

    .mobile-mileage-slider {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        width: 100%;
        height: 6px;
        background: transparent;
        transform: translateY(-50%);
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
    }

    .mobile-mileage-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: var(--theme-color, #D7183D);
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .mobile-mileage-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: var(--theme-color, #D7183D);
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .mobile-mileage-slider-min {
        z-index: 1;
    }

    .mobile-mileage-slider-max {
        z-index: 2;
        pointer-events: none;
    }

    .mobile-mileage-slider-max::-webkit-slider-thumb {
        pointer-events: all;
    }

    .mobile-mileage-slider-max::-moz-range-thumb {
        pointer-events: all;
    }

    /* 按钮组 */
    .mobile-filter-actions {
        display: flex;
        gap: 1rem;
        padding: 1.5rem 1.5rem 2.5rem;
        /* 增加底部padding为客服按钮留空间 */
        background: white;
        border-top: 1px solid #eee;
        position: sticky;
        bottom: 0;
        margin: 0 -1.5rem -1.5rem;

    }

    .mobile-filter-actions .btn {
        flex: 1;
        padding: 0.75rem 1rem;
        font-weight: 600;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

    .mobile-filter-actions .btn-primary {
        background: var(--theme-color, #D7183D);
        border-color: var(--theme-color, #D7183D);
        font-size: 0.85rem;
    }

    .mobile-filter-actions .btn-primary:hover {
        background: #B01530;
        border-color: #B01530;
        transform: translateY(-1px);
    }

    .mobile-filter-actions .btn-outline-secondary {
        border-color: #6c757d;
        color: #6c757d;
        font-size: 0.85rem;
    }

    .mobile-filter-actions .btn-outline-secondary:hover {
        background: #6c757d;
        color: white;
        transform: translateY(-1px);
    }

    /* 移动端抽屉内按钮图标间距 */
    .mobile-filter-actions .btn i {
        margin-right: 0.75rem;
        font-size: 1rem;
    }
}

/* 桌面端完全隐藏移动端组件 */
@media (min-width: 769px) {

    .mobile-home-filters-trigger,
    .mobile-home-filters-overlay,
    .mobile-home-filters-drawer {
        display: none !important;
    }
}