/* 遮罩层 */
.filter-overlay {
    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;
    /*backdrop-filter: blur(1px);*/
}

.filter-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 抽屉样式 */
.filter-drawer {
    position: fixed;
    top: 0;
    left: -400px;
    width: 380px;
    height: 100vh;
    background: white;
    z-index: 9999;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-drawer.active {
    left: 0;
}

.filter-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.filter-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.filter-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 5px;
    transition: color 0.3s;
}

.filter-close-btn:hover {
    color: #333;
}

/* 抽屉内容 */
.filter-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 滚动锁定 */
body.filter-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* 过滤表单样式 */
.filter-section {
    margin-bottom: 30px;
}

.filter-section h4 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.filter-options {
    display: flex;
    flex-direction: column;  
}

.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0px 0;
    font-size: 14px;
    color: #555;
    transition: color 0.3s;
}

.filter-option:hover {
    color: #333;
}

.filter-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid #ddd;
}

.count {
    margin-left: auto;
    color: #999;
    font-size: 13px;
}

/* 按钮样式 */
.filter-actions {
    display: flex;
    gap: 10px;
    /*margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;*/
}

.filter-apply-btn,
.filter-reset-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

#filter-form .button{
    display:none;
}
.filter-apply-btn {
    background: var(--background-color) !important;
    color: white;
}

.filter-apply-btn:hover {
    background: #555;
}

.filter-reset-btn {
    background: #f5f5f5;
    color: #666;
}
.filter-reset-btn:focus,
.filter-reset-btn:hover {
    background:var(--background-color) !important;;
}


/* 隐藏原生复选框 */
.custom-checkbox-input-drawer {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* 创建自定义复选框 */
.custom-checkbox-checkmark-drawer {
  position: absolute;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 1px;
  transition: all 0.3s ease;
}
.filter-selected-content-drawer .bottom-line{
    border-bottom: 1px solid #e8e8e1;
    width: 100%;
    height: 1px;
    margin-top: 15px;
}
.woocommerce-ordering-sort{
    white-space: nowrap;
    padding: 8px 15px;
    line-height: 35px;
    height: 200px;
    right: 0;
    border: solid 1px #eee;
    display: table-column;
    width: 100%;
    position: relative !important;
}

/* 鼠标悬停效果 */
.custom-checkbox-container-drawer:hover .custom-checkbox-input-drawer~.custom-checkbox-checkmark-drawer {
  background-color: #fff;
  border-color: rgb(234, 236, 236);
}

/* 选中状态 */
.custom-checkbox-input-drawer:checked~.custom-checkbox-checkmark-drawer {
  background-color: #fff;
  border: 1px solid rgb(221, 221, 221);
}

/* 创建勾选标记（隐藏状态） */
.custom-checkbox-checkmark-drawer:after {
  content: "";
  position: absolute;
  display: none;
  left: 2px;
  top: 3px;
  width: 11px;
  background:var(--background-color);
  height: 11px;
  border: solid white;
  border-width: 0 1px 1px 0;
  transform: rotate(90deg);
}

/* 显示勾选标记（选中时） */
.custom-checkbox-input-drawer:checked~.custom-checkbox-checkmark-drawer:after {
  display: block;
}

.filter-drawer,
.filter-overlay {
    display: none;
}

/* 响应式设计 */
@media (max-width: 920px) {
    .filter-drawer {
        width: 100%;
        max-width: 340px;
        left: -340px;
        display: block;
    }
    .filter-overlay {
        display: block;
    }
    .filter-section {
        margin-bottom: 15px;
    }
}

/* 加载状态样式 */
.filter-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.filter-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误消息样式 */
.filter-error-message {
    background: #ffeded;
    color: #d8000c;
    padding: 12px 20px;
    margin: 0 0 20px 0;
    border-left: 4px solid #ff6b6b;
    border-radius: 4px;
    font-size: 14px;
}

/* 抽屉滚动条美化 */
.filter-content::-webkit-scrollbar {
    width: 6px;
}

.filter-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.filter-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .filter-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-close-btn,
    .filter-apply-btn{
        min-height: 44px;
        min-width: 44px;
    }
}

/* 打印样式 */
@media print {
    .filter-drawer,
    .filter-overlay {
        display: none !important;
    }
    
    body.filter-open {
        position: static !important;
        overflow: visible !important;
    }
}