/* ========================================
   高级搜索组件样式表
   ======================================== */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --radius: 4px;
    --font-size-base: 13px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-main);
}

/* 容器 */
.app-container {
    width: 1280px;
    height: 850px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

/* 顶部筛选栏 */
.filter-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
}

/* 模式切换 */
.mode-switcher {
    cursor: default;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--primary);
    background: #eff6ff;
    font-weight: 500;
    font-size: 12px;
}

/* 搜索框 */
.search-input-group {
    position: relative;
    width: 260px;
}

.main-input {
    width: 100%;
    height: 32px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    transition: border-color 0.2s;
}

.main-input:hover {
    border-color: #9ca3af;
}

.main-input:focus {
    border-color: var(--primary);
    outline: none;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* 组合筛选控件 */
.filter-combo {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-height: 32px;
    background: white;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    padding-right: 24px;
}

.filter-combo:hover {
    border-color: #9ca3af;
}

.filter-combo.active,
.filter-combo.open,
.filter-combo:focus-within {
    border-color: var(--primary);
}

.filter-combo.open .combo-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.combo-label {
    background: #f9fafb;
    padding: 0 8px;
    font-size: 12px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
    height: 30px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-right: 4px;
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.combo-value {
    padding: 4px;
    font-size: var(--font-size-base);
    color: var(--text-main);
    min-width: 80px;
    max-width: 200px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.combo-input {
    border: none;
    outline: none;
    width: 240px;
    font-size: var(--font-size-base);
    padding: 0 4px;
}

.combo-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

#val-ext {
    max-width: none;
    flex-wrap: nowrap;
    overflow: visible;
}

.placeholder-text {
    color: var(--text-secondary);
}

.combo-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

/* Chips */
.value-chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e0e7ff;
}

.chip-remove {
    cursor: pointer;
    font-size: 10px;
    opacity: 0.6;
    margin-left: 4px;
}

.chip-remove:hover {
    opacity: 1;
    color: #dc2626;
}

/* 右侧操作区 */
.bar-actions {
    margin-left: auto;
    display: flex;
    gap: 16px;
    align-items: center;
}

.icon-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.icon-action:hover {
    color: var(--text-main);
    background: #f3f4f6;
}

/* 下拉菜单 */
.dropdown-panel {
    position: absolute;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    display: none;
    flex-direction: column;
    z-index: 200;
    width: 240px;
    top: 100%;
    margin-top: 4px;
}

.dropdown-panel.show {
    display: flex;
}

#dd-domain {
    width: 400px;
}

.dd-content {
    padding: 6px 0;
    max-height: 320px;
    overflow-y: auto;
}

.dd-group-title {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    background: #f9fafb;
}

.dd-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.dd-item:hover {
    background: #f3f4f6;
}

.dd-item.active {
    background: #eff6ff;
    color: var(--primary);
}

.dd-checkbox {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
}

.dd-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 级联菜单 */
.cascading-container {
    display: flex;
    height: 200px;
}

.cascading-col {
    width: 140px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 4px 0;
}

.cascading-col:last-child {
    border-right: none;
}

.cascading-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cascading-item:hover {
    background: #f3f4f6;
}

.cascading-item.active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 500;
}

.cascading-arrow {
    font-size: 10px;
    color: #9ca3af;
}

.cascading-item.active .cascading-arrow {
    color: var(--primary);
}

/* 内容区 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}

.group-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-title {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 列表表格 */
.list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.list-table th {
    text-align: left;
    padding: 12px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: white;
    white-space: nowrap;
}

.list-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-main);
    vertical-align: middle;
}

.list-table tr:hover {
    background: #fcfcfc;
}

.list-table tr.selected {
    background: #eff6ff;
}

/* 重要程度徽章 */
.imp-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
}

.imp-high {
    background: #fee2e2;
    color: #b91c1c;
}

.imp-med {
    background: #ffedd5;
    color: #c2410c;
}

.imp-low {
    background: #dcfce7;
    color: #15803d;
}

.action-btn-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}

.action-btn-link:hover {
    text-decoration: underline;
}

/* 底部栏 */
.modal-footer {
    padding: 10px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-btns {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.btn-default {
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-main);
}

.btn-default:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.match-highlight {
    color: var(--primary);
    font-weight: 600;
}

/* 分页 */
.page-size-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-main);
    outline: none;
    background: white;
    cursor: pointer;
}

.page-size-select:hover {
    border-color: #d1d5db;
}

.pagination-pager {
    display: flex;
    gap: 4px;
}

.pager-btn {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    background: white;
    color: var(--text-main);
    padding: 0 6px;
}

.pager-btn:hover:not(.disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.pager-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pager-btn.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: #f9fafb;
}

/* 抽屉 */
.drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    display: none;
}

.drawer-overlay.show {
    display: block;
}

.drawer-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: white;
    z-index: 910;
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.drawer-panel.show {
    transform: translateX(0);
}

.drawer-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* 模式列表项 */
.mode-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.mode-item:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mode-item.active {
    background: #eff6ff;
    border-color: var(--primary);
}

.mode-item.default {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
}

.mode-info {
    flex: 1;
    min-width: 0;
}

.mode-name-row {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-badge {
    font-size: 10px;
    background: #f59e0b;
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
}

.mode-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.mode-actions {
    opacity: 0;
    display: flex;
    gap: 4px;
    transition: opacity 0.2s;
}

.mode-item:hover .mode-actions {
    opacity: 1;
}

.mode-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 4px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-action-btn:hover {
    background: var(--primary);
    color: white;
}

.mode-action-btn.danger:hover {
    background: #ef4444;
}

.add-mode-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-mode-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f5ff;
}