/**
 * components.css — 弹窗/抽屉组件通用样式
 * 包含：Modal、Drawer、Toast、Tree、通用表单等
 */

/* ===========================================================
   Drawer（侧边抽屉）
   =========================================================== */
.drawer-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.5);
    display: none;
}
.drawer-overlay.open { display: block; }

.drawer {
    position: fixed; top: 0; left: -480px; bottom: 0; z-index: 201;
    width: 460px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: left 0.3s ease;
    display: flex; flex-direction: column;
}
.drawer.open { left: 0; }

.drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.drawer-header h3 { font-size: 16px; font-weight: 600; color: var(--fg); }
.drawer-close {
    background: none; border: none; color: var(--muted); font-size: 20px;
    cursor: pointer; padding: 4px;
}
.drawer-close:hover { color: var(--fg); }

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

.drawer-section { margin-bottom: 24px; }
.drawer-section:last-child { margin-bottom: 0; }

.drawer-section h4 {
    font-size: 13px; font-weight: 600;
    color: var(--fg-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.drawer-section .field-hint {
    font-size: 11px; color: var(--muted);
    margin-bottom: 10px;
}

/* 字段标签（列配置用） */
.drawer-section .field-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    margin: 0 8px 8px 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}
.drawer-section .field-tag:hover { border-color: var(--accent-dim); }
.drawer-section .field-tag.selected {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}
.drawer-section .field-tag .ck {
    width: 14px; height: 14px;
    border-radius: 3px;
    border: 1.5px solid var(--muted);
    display: grid; place-items: center;
    font-size: 10px;
    transition: all var(--transition);
}
.drawer-section .field-tag.selected .ck {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--fg);
}
.drawer-section .field-tag.disabled {
    opacity: 0.5; cursor: not-allowed;
}
.drawer-section .field-tag.disabled .ck {
    background: var(--surface-3);
    border-color: var(--border-light);
}

.drawer-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ===========================================================
   Modal（模态弹窗）
   =========================================================== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.6);
    display: none;
    place-items: center;
}
.modal-overlay.open { display: grid; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none; border: none; color: var(--muted); font-size: 20px;
    cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--fg); }

.modal-body { padding: 20px 24px; }
.modal-body .section-label {
    font-size: 13px; color: var(--fg-secondary); margin-bottom: 10px;
}

/* 导出格式选择 */
.export-format-grid {
    display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 24px;
}
.export-format-row { display: grid; gap: 10px; }
.export-format-row.two { grid-template-columns: 1fr 1fr; }
.export-format-row.four { grid-template-columns: repeat(4, 1fr); }

.export-option {
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 13px;
}
.export-option:hover { border-color: var(--accent-dim); }
.export-option.selected { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.export-option .eo-icon { font-size: 20px; margin-bottom: 4px; }

.export-config { margin-bottom: 16px; }
.export-config .config-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
}
.export-config .config-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
}
.export-config .config-row label {
    font-size: 13px; color: var(--fg-secondary); cursor: pointer;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ===========================================================
   Toast 通知系统
   =========================================================== */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 999;
    display: flex; flex-direction: column; gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===========================================================
   Tab 标签栏
   =========================================================== */
.tab-bar {
    display: flex; align-items: stretch;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    gap: 0;
}

.tab-item {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--fg-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    user-select: none;
    position: relative;
}
.tab-item:hover { color: var(--fg); background: var(--surface-2); }
.tab-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab-item .badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 11px;
    border-radius: 10px;
    background: var(--accent-glow);
    color: var(--accent);
}
.tab-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.tab-item.disabled:hover { background: transparent; color: var(--fg-secondary); }

/* ===========================================================
   图片预览弹窗
   =========================================================== */
.image-preview-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.85);
    display: none;
    place-items: center;
    cursor: zoom-out;
}
.image-preview-overlay.open { display: grid; }
.image-preview-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.image-preview-overlay .preview-close {
    position: absolute; top: 20px; right: 20px;
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background var(--transition);
}
.image-preview-overlay .preview-close:hover {
    background: rgba(255,255,255,0.2);
}
.image-preview-overlay .preview-error {
    color: #fff;
    font-size: 15px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
}

/* ===========================================================
   进度条（导入/迁移）
   =========================================================== */
.progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-text {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* ===========================================================
   空状态提示
   =========================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: var(--muted);
    font-size: 14px;
    gap: 12px;
}
.empty-state .empty-icon {
    font-size: 48px;
    opacity: 0.3;
}
