﻿/* ============================================
   /portal/assets/css/portal_filter_mobile.css
   ============================================ */

/* ============================
   ⭐ 手机端筛选抽屉（全部包在 @media 内）
   ============================ */
@media (max-width: 768px) {

/************************************
 * 搜索页筛选抽屉 - 基础布局
 ************************************/

/* ⭐ 搜索页筛选抽屉：下滑上滑仅靠此段CSS代码就可以做到，不会穿过导航栏 */ 
/* ⭐ 从导航栏底部往下展开”的抽屉必须用 height 动画，不能用 transform。
transform 永远会穿透导航栏。固定高度的不要JS代码，，PC端需要JS代码，是因为不是固定高度 */
.search-filter-wrapper {
    position: fixed;
    top: var(--portal-nav-total);
    left: 0;
    right: 0;

    height: 0;                 /* ⭐ 初始收起 */
    max-height: 55vh;          /* ⭐ 最大高度 */
    overflow: hidden;          /* ⭐ 内容不会穿过导航栏 */

    background: #fff;
    z-index: 2600;      /* 这不是调高度的，是来决定抽屉和遮罩谁在上面、谁在下面（层级顺序），须大于遮罩的这个值，才在上*/

    display: flex;
    flex-direction: column;

    transition: height .25s ease-out;
    pointer-events: none;
}

body.filter-open .search-filter-wrapper {
    height: 55vh;              /* ⭐ 从导航栏底部往下展开 */
    pointer-events: auto;
}

/* ⭐ ----------筛选抽屉下滑上滑代码结束-------分割线------------*/ 

.search-filter-wrapper .search-filter-mega {
    flex: 1 1 auto;
    display: flex;
    min-height: 0; /* ⭐ 防止子元素溢出 */
}

/************************************
 * 左侧筛选项列表
 ************************************/
 
.filter-left {
    flex: 0 0 100px;   /* ⭐ 左侧栏固定宽度，禁止压缩 */
    width: 100px;      /* ⭐ 兼容旧内核 */
    max-width: 100px;  /* ⭐ 防止安卓强行压缩 */
    background: #f7f7f7;
    border-right: 1px solid #eee;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px;   /* ⭐ 必须加：给左侧栏底部“留出一块空白区域”，避免内容被底部固定悬浮按钮挡住。 */
}

.filter-left-item {
    padding: 12px 10px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    cursor: pointer;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.filter-left-item + .filter-left-item {
    border-top: 1px solid #f0f0f0;
}

/* ⭐ 左侧选中态 */
.filter-left-item.active {
    background: #ffffff;
    color: #ff4444;
    border-left-color: #ff4444;
    font-weight: 500;
}

/************************************
 * 右侧分组内容区域
 ************************************/
.filter-right {
    flex: 1 1 auto;
	min-width: 0;   /* ⭐ 防止右侧撑破布局 */
    overflow-y: auto;
    padding: 10px 12px 120px; /* ⭐ 给底部按钮留足空间 */
    box-sizing: border-box;   /* ⭐ 防止内容进入按钮下方 */
    -webkit-overflow-scrolling: touch;
}

.filter-group {
    margin-bottom: 18px;
}

.filter-group-title {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
}

/* ⭐ 选项容器：多行换行 */
.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ⭐ 单个选项 Tag */
.filter-options span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
    color: #555;
    background: #f5f5f5;
    border-radius: 14px;
    border: 1px solid #f0f0f0;
    min-width: 64px;
    box-sizing: border-box;
}

/* ⭐ 选中态 */
.filter-options span.selected {
    color: #ff4444;
    background: #ffecec;
    border-color: #ff4444;
}

/************************************
 * 价格区间输入
 ************************************/
.filter-price-input {
    display: flex;
    align-items: center;
    margin-top: 10px;
    gap: 6px;
    min-width: 0;          /* ⭐ 必须：允许子项收缩 */
}

.filter-price-input input {
    flex: 1 1 0;           /* ⭐ 允许自动收缩 */
    min-width: 0;          /* ⭐ 必须：否则 input 会撑破容器 */
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-sizing: border-box;
}

.filter-price-input .dash {
    flex: 0 0 auto;        /* ⭐ 固定宽度，不参与挤压 */
    font-size: 12px;
    color: #999;
}

/************************************
 * 底部按钮区域
 ************************************/
.filter-bottom {
    position: absolute;          /* ⭐ 固定在筛选面板内部底部 */
    bottom: 0;
    left: 0;
    right: 0;

    height: 60px;                /* ⭐ 固定高度（右侧内容要预留空间） */
    padding: 8px 12px;

    background: #ffffff;
    display: flex;
    gap: 10px;

    border-top: 1px solid #eee;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.06); /* ⭐ 拼多多同款阴影 */

    z-index: 20;                 /* ⭐ 高于内容，但低于抽屉整体 */
}

.filter-reset {
    flex: 0 0 90px;
    height: 36px;
    border-radius: 18px;
    border: 1px solid #ddd;
    background: #ffffff;
    color: #666;
    font-size: 13px;
}

.filter-confirm {
    flex: 1 1 auto;
    height: 36px;
    border-radius: 18px;
    border: none;
    background: #ff4444;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

/************************************
 * 滚动条样式
 ************************************/
.filter-left,
.filter-right {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.filter-left::-webkit-scrollbar,
.filter-right::-webkit-scrollbar {
    width: 4px;
}

.filter-left::-webkit-scrollbar-thumb,
.filter-right::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 2px;
}
/************************************
 * ⭐ 筛选抽屉独立遮罩层（你要插入的）
 ************************************/
.filter-overlay {
    display: none;
    position: fixed;
    top: var(--portal-nav-total);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2500;             /* 这个不是调高度的，是来决定抽屉和遮罩谁在上面、谁在下面（层级顺序），遮罩需小于抽屉的这个值*/
}

body.filter-open .filter-overlay {
    display: block;
}

/* 搜索结果页：彻底禁用全局遮罩，交给各自抽屉自己的遮罩来管 */
body.search-page .portal-mobile-overlay {
    display: none !important;
}

/* 打开搜索结果抽屉时，强制隐藏筛选抽屉的遮罩 */
.search-info-wrapper.open ~ .filter-overlay {
    display: none !important;
}

/************************************
 * ⭐ 手机端筛选按钮定位（固定在第二层导航栏右侧）
 ************************************/
 
#search-filter-toggle {
    margin-left: auto;  /* ⭐ 关键：把它推到这一行的最右侧 */

    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;

    height: var(--portal-nav-second-height) !important;
    padding: 0 7px !important;

    background: #f3f4f6;
    border-radius: 0 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #333 !important;
    z-index: 2600;
}

#search-filter-toggle .filter-text {
    white-space: nowrap;
}

#search-filter-toggle .filter-icon {
    font-size: 16px !important;
    font-weight: 500 !important;
}

/************************************
 * ⭐ 手机端必须显示第二层导航栏（横向排列导航 + 筛选按钮）
 ************************************/
.portal-menu-mobile-top {
    display: flex !important;
    align-items: center;          /* 垂直居中 */
	}

/************************************
 * ⭐ 面板宽度（左右两栏宽度限制）
 ************************************/	
	.search-filter-wrapper .search-filter-mega {
    width: 100%;        /* ⭐ 必须：锁死整体宽度 */
    max-width: 100%;    /* ⭐ 必须：防止 flex 子项撑破 */
	}

	.search-filter-wrapper {
    width: 100%;
    max-width: 100%;
	}

} /* ← 结束 @media (max-width: 768px) */

/************************************
 * ⭐ 小屏适配（360px 以下）
 ************************************/
@media (max-width: 360px) {
    .filter-left {
        width: 88px;
    }

    .filter-options span {
        min-width: 56px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .filter-bottom {
        padding: 6px 10px 8px;
    }

    .filter-reset,
    .filter-confirm {
        height: 34px;
        font-size: 12px;
    }
}

/* ⭐ PC 端强制隐藏手机筛选按钮和抽屉 */
@media (min-width: 769px) {
    .search-filter-wrapper,
    #search-filter-toggle {
        display: none !important;
    }
}
