﻿/* ======================= */
/* 悬浮筛选面板 - 公共样式 */
/* ======================= */

/* 隐藏原始筛选区域以节约空间 */
.bili-filter {
    display: none !important;
}

/* 悬浮筛选按*/
.floating-filter-btn {
    position: fixed;
    right: 24px; /* 移动到右上方 */
    top: 80px; /* 从底部移动到顶部 */
    width: 48px;
    height: 48px;
    background: #2C2C2C; /* 默认深灰色背*/
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 16px rgba(44, 44, 44, 0.3);
    cursor: move; /* 改为拖拽光标 */
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none; /* 防止选中文本 */
}

.floating-filter-btn:hover {
    background: #3C3C3C; /* 悬停时稍微亮一*/
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 44, 44, 0.4);
}

/* 激活状- 整个变黄发光 */
.floating-filter-btn.active {
    background: #FFD016 !important;
    box-shadow: 0 4px 20px rgba(255, 208, 22, 0.6);
    transform: translateY(-2px);
}

.floating-filter-btn.active:hover {
    background: #E6C212 !important;
    box-shadow: 0 6px 24px rgba(255, 208, 22, 0.8);
}

.floating-filter-btn.dragging {
    transition: none; /* 拖拽时禁用过渡效*/
    z-index: 1001;
    transform: scale(1.1);
    cursor: grabbing; /* 拖拽时的光标 */
}

.floating-filter-btn i {
    font-size: 18px;
    color: #FFD016; /* 默认黄色灯泡 */
    transition: all 0.3s ease;
}

/* 激活状态下的图标变黑色 */
.floating-filter-btn.active i {
    color: #2C2C2C;
}

/* 悬浮筛选面*/
.floating-filter-panel {
    position: fixed;
    right: 24px;
    top: 140px; /* 调整到按钮下*/
    width: 350px;
    max-height: 550px;
    background: var(--light-bg) ; /* 改为浅色背景 */
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 999;
    transform: translateX(400px) scale(0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.floating-filter-panel.active {
    transform: translateX(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* 筛选面板内*/
.filter-panel-content {
    padding: 20px;
    color: #000; /* 改为黑色 */
    max-height: 400px;
    overflow-y: auto;
}

/* 筛选组样式 */
.filter-panel-group {
    margin-bottom: 24px;
}

.filter-panel-group:last-child {
    margin-bottom: 0;
}

.filter-panel-group:has(> .filter-select-container) {
    margin-bottom: 24px;
}

.filter-select-field-label {
    margin-bottom: 0;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: center;
    line-height: 1.2;
}

.filter-panel-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    overflow: hidden;
}

.filter-panel-row-single {
    grid-template-columns: 1fr;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

.filter-panel-row .filter-panel-group-inline {
    min-width: 0;
    margin-bottom: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.filter-panel-row-single .filter-panel-group-inline {
    padding: 0;
}

body[data-page="harmonized-data"] .filter-panel-content,
body.harmonized-data .filter-panel-content {
    max-height: calc(550px - 52px);
    overflow-y: auto;
    overflow-x: hidden;
}

body[data-page="harmonized-data"] .filter-panel-group:has(> .filter-select-container),
body.harmonized-data .filter-panel-group:has(> .filter-select-container) {
    min-width: 0;
}

body[data-page="harmonized-data"] .filter-select-container,
body.harmonized-data .filter-select-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body[data-page="harmonized-data"] .filter-select-header,
body.harmonized-data .filter-select-header {
    min-width: 0;
}

body[data-page="harmonized-data"] .filter-select-dropdown,
body.harmonized-data .filter-select-dropdown {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 1;
    flex-shrink: 0;
}

body[data-page="harmonized-data"] .filter-panel-row-single .filter-alignment-group,
body.harmonized-data .filter-panel-row-single .filter-alignment-group {
    flex-direction: row;
    gap: 20px;
}

body[data-page="harmonized-data"] .filter-panel-row-single .filter-option-item,
body.harmonized-data .filter-panel-row-single .filter-option-item {
    min-height: 28px;
    width: auto;
}

.filter-panel-row .filter-panel-group-inline + .filter-panel-group-inline {
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.filter-panel-row-single .filter-panel-group-inline + .filter-panel-group-inline {
    border-left: none;
}

.filter-panel-row .filter-alignment-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 100%;
}

.filter-panel-row .filter-option-item {
    padding: 0;
    min-height: 36px;
    justify-content: center;
    width: 100%;
}

.filter-panel-row .filter-option-label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
    color: #666;
}

.filter-panel-row .filter-option-icon-spacer {
    visibility: hidden;
}

.filter-panel-row .filter-option-label .material-icons,
.filter-panel-row .filter-option-label i:not(.filter-option-icon-spacer) {
    width: 1.25em;
    text-align: center;
    flex-shrink: 0;
    color: #666;
}

.filter-panel-row .filter-option-label .material-icons {
    font-size: 18px;
    line-height: 1;
}

.filter-panel-label {
    font-size: 14px;
    font-weight: 500;
    color: #000; /* 改为黑色 */
    margin-bottom: 12px;
    display: block;
}

.filter-frequency-color-box {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 14px 16px;
    overflow: hidden;
}

.filter-frequency-color-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-frequency-color-header .filter-panel-label {
    margin-bottom: 0;
    flex-shrink: 0;
}

.filter-frequency-color-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.filter-frequency-color-input {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(204, 204, 204, 0.4);
    border-radius: 6px;
    cursor: pointer;
    background: var(--light-bg);
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.15s ease;
}

.filter-frequency-color-input:hover {
    transform: scale(1.08);
}

.filter-frequency-color-input:active {
    transform: scale(1.02);
}

.filter-frequency-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 0;
}

.filter-frequency-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
    width: 100%;
    height: 100%;
}

.filter-frequency-color-input::-moz-color-swatch {
    border: none;
    border-radius: 5px;
}

.filter-frequency-color-value {
    font-size: 13px;
    color: #666;
    font-family: monospace;
}

.filter-frequency-color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.filter-frequency-color-custom {
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.filter-frequency-color-custom-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-frequency-preset-hint {
    margin-left: auto;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.filter-frequency-preset-hint #floating-frequency-preset-count {
    font-family: monospace;
}

.filter-frequency-color-preset-wrap {
    position: relative;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.filter-frequency-color-preset-wrap:hover .filter-frequency-color-preset-remove {
    opacity: 1;
}

.filter-frequency-color-preset {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--preset-swatch-color, #579C94) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.filter-frequency-color-preset-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #333;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-frequency-color-preset-remove:hover {
    background: #EF4444;
}

.filter-frequency-add-preset {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px dashed rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    background: transparent;
    color: #666;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-frequency-add-preset:hover:not(:disabled) {
    border-color: #FFD016;
    color: #000;
    background: rgba(255, 208, 22, 0.1);
}

.filter-frequency-add-preset:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.filter-frequency-color-preset:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-frequency-color-preset.active {
    border-color: #FFD016;
    box-shadow: 0 0 0 2px rgba(255, 208, 22, 0.45);
}

/* 字段选择器样*/
.filter-select-container {
    position: relative;
}

.filter-select-header {
    background: var(--light-bg);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 16px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.filter-select-header:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.02);
}

.filter-select-header .filter-select-field-label {
    margin-bottom: 0;
    align-self: center;
}

.filter-select-header-value {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.filter-select-text {
    flex: 1;
    min-width: 0;
    text-align: right;
    color: #000;
    font-size: 14px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-select-header-value .filter-select-text {
    flex: 1;
    text-align: right;
}

.filter-select-arrow {
    font-size: 12px;
    color: #000;
    transition: transform 0.2s;
    flex-shrink: 0;
    align-self: center;
}

.filter-select-container.active .filter-select-arrow {
    transform: rotate(180deg);
}

/* 下拉选项面板 */
.filter-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--light-bg);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 1001;
    max-height: 200px;
    overflow-y: auto;
}

.filter-select-container.active .filter-select-dropdown {
    display: block;
}

/* 搜索*/
.filter-search-input {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: transparent;
    color: #000;
    font-size: 14px;
    outline: none;
}

.filter-search-input::placeholder {
    color: #666; /* 占位符改为深灰色 */
}

/* 选项列表 */
.filter-options-list {
    padding: 8px 0;
}

.filter-option-item {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-option-checkbox {
    margin-right: 8px;
    accent-color: #D4BC5A;
    opacity: 0.85;
}

.filter-option-item:has(input:checked) .filter-option-checkbox {
    opacity: 1;
}

.filter-option-label {
    color: #666;
    font-size: 12px;
    flex: 1;
}

.filter-option-label .material-icons,
.filter-option-label i:not(.filter-option-icon-spacer) {
    color: #666;
}

/* 操作按钮*/
.filter-panel-actions {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    justify-content: center;
}

.filter-action-btn {
    padding: 8px 18px;
    min-width: 72px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.filter-action-btn:hover {
    background: rgba(255, 208, 22, 0.14);
    border-color: rgba(255, 208, 22, 0.55);
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(255, 208, 22, 0.18);
}

.filter-action-btn:active {
    transform: scale(0.97);
    box-shadow: none;
}

.filter-action-btn:focus-visible {
    outline: 2px solid rgba(255, 208, 22, 0.55);
    outline-offset: 2px;
}

.filter-action-btn.primary {
    background: #FFD016;
    border-color: #E6C212;
    color: #1a1a1a;
    box-shadow: 0 1px 4px rgba(255, 208, 22, 0.35);
}

.filter-action-btn.primary:hover {
    background: #FFDB33;
    border-color: #FFD016;
    color: #000;
    box-shadow: 0 4px 14px rgba(255, 208, 22, 0.42);
    transform: translateY(-1px);
}

.filter-action-btn.primary:active {
    background: #E6C212;
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(255, 208, 22, 0.28);
}

.filter-action-btn.primary:focus-visible {
    outline: 2px solid rgba(230, 194, 18, 0.85);
    outline-offset: 2px;
}

/* =============================== */
/* 浅色主题 */
/* =============================== */
/* 悬浮筛选按钮 - 现代简洁 */
[data-theme="light"] .floating-filter-btn {
    background: transparent !important; /* 纯白背景 */
    box-shadow: none !important; /* 精致阴影 */

}

[data-theme="light"] .floating-filter-btn:hover {
    background: #F9FAFB !important; /* 悬停时轻微灰色 */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .floating-filter-btn.active {
    background: #1F2937 !important; /* 激活时深灰色，更严肃 */
    box-shadow: 0 4px 16px rgba(31, 41, 55, 0.3) !important;
    border-color: #1F2937 !important;
}

[data-theme="light"] .floating-filter-btn.active:hover {
    background: #2C2C2C !important;
    box-shadow: 0 6px 20px rgba(31, 41, 55, 0.4) !important;
}

[data-theme="light"] .floating-filter-btn i {
    color: #2C2C2C !important; /* 默认中性灰色图标 */
}

[data-theme="light"] .floating-filter-btn.active i {
    color: #FFFFFF !important; /* 激活状态下的白色图标 */
}


/* 悬浮筛选面板 - 现代卡片风格 */
[data-theme="light"] .floating-filter-panel {
    background: #FFFFFF !important; /* 纯白背景 */
}

/* 字段选择器样式 - 现代输入框风格 */
[data-theme="light"] .filter-select-header {
    background: #FFFFFF !important; /* 轻微灰色背景 */
}



/* 下拉选项面板 - 现代下拉框 */
[data-theme="light"] .filter-select-dropdown {
    background: #FFFFFF !important;
}

/* 筛选搜索输入框 - 现代输入框 */
[data-theme="light"] .filter-search-input {
    background: #FFFFFF !important;
}
