/* ============================================
   大屏自适应数据配置中台 — 自定义样式
   ============================================ */

/* ---------- 导航菜单 ---------- */
.nav-item.active {
  background: rgba(0, 82, 217, 0.15);
  border-left: 3px solid #0052D9;
  padding-left: 17px; /* 补偿border宽度 */
}

/* ---------- Modal 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden {
  display: none;
}
.modal-container {
  background: #FFFFFF;
  border-radius: 12px;
  width: 720px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #E5E7EB;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #E5E7EB;
}

/* ---------- Drawer 抽屉 ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1001;
  display: flex;
  justify-content: flex-end;
}
.drawer-overlay.hidden {
  display: none;
}
.drawer-container {
  background: #FFFFFF;
  width: 640px;
  max-width: 90vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #E5E7EB;
}
.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* ---------- Toast 提示 ---------- */
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  color: #374151;
  animation: toastIn 0.3s ease;
  max-width: 380px;
}
.toast.success { border-left: 3px solid #2BA471; }
.toast.error { border-left: 3px solid #D54941; }
.toast.warning { border-left: 3px solid #E37318; }
.toast.info { border-left: 3px solid #0594FA; }
.toast.removing {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ---------- 条件组合器 ---------- */
.condition-group {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.condition-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.condition-row:last-child {
  margin-bottom: 0;
}
.condition-row select,
.condition-row input {
  height: 36px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 14px;
  color: #374151;
  background: #FFFFFF;
}
.condition-row select:focus,
.condition-row input:focus {
  outline: none;
  border-color: #0052D9;
  box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}
.condition-row .field-select { width: 160px; }
.condition-row .operator-select { width: 120px; }
.condition-row .value-input { flex: 1; min-width: 120px; }
.condition-row .delete-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #6B7280;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.condition-row .delete-btn:hover {
  color: #D54941;
  background: #FEE2E2;
}

.and-or-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 12px;
  background: #E8F0FE;
  color: #0052D9;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 8px 0 8px 16px;
  user-select: none;
  transition: background 0.15s;
}
.and-or-toggle:hover {
  background: #D0E2FD;
}

.add-condition-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px dashed #0052D9;
  color: #0052D9;
  background: transparent;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}
.add-condition-btn:hover {
  background: #E8F0FE;
}

/* 嵌套分组指示线 */
.condition-group.nested {
  border-left: 3px solid #0052D9;
  margin-left: 20px;
}

/* ---------- 大屏模拟演示舱 ---------- */
.cockpit-container {
  background: #0F172A;
  border-radius: 12px;
  padding: 24px;
  min-height: 500px;
}
.cockpit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.cockpit-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.cockpit-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(5, 148, 250, 0.4);
  box-shadow: 0 0 20px rgba(5, 148, 250, 0.15);
}
.cockpit-card.clickable::after {
  content: "点击查看明细";
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
}
.cockpit-card.no-click {
  cursor: default;
  opacity: 0.8;
}
.cockpit-card .card-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}
.cockpit-card .card-value {
  font-size: 36px;
  font-weight: 700;
  color: #0594FA;
  line-height: 1.2;
}
.cockpit-card .card-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 6px;
}

/* ---------- 表格通用样式 ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
}
.data-table thead {
  background: #F9FAFB;
}
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  border-bottom: 1px solid #E5E7EB;
  white-space: nowrap;
}
.data-table td {
  padding: 10px 16px;
  font-size: 14px;
  color: #374151;
  border-bottom: 1px solid #E5E7EB;
}
.data-table tbody tr:hover {
  background: #F9FAFB;
}

/* ---------- 标签样式 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-default { background: #F3F4F6; color: #374151; }
.tag-form { background: #E8F0FE; color: #0052D9; }
.tag-excel { background: #E6F7EE; color: #2BA471; }
.tag-api { background: #FFF3E0; color: #E37318; }
.tag-active { background: #E6F7EE; color: #2BA471; }
.tag-inactive { background: #FEE2E2; color: #D54941; }

/* ---------- 表单通用样式 ---------- */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}
.form-label .required {
  color: #D54941;
  margin-left: 2px;
}
.form-input {
  width: 100%;
  height: 36px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
  color: #374151;
  background: #FFFFFF;
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: #0052D9;
  box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}
.form-textarea {
  width: 100%;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: #374151;
  background: #FFFFFF;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}
.form-textarea:focus {
  outline: none;
  border-color: #0052D9;
  box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}
.form-error {
  font-size: 12px;
  color: #D54941;
  margin-top: 4px;
}

/* ---------- 按钮通用样式 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  white-space: nowrap;
}
.btn-primary {
  background: #0052D9;
  color: #FFFFFF;
}
.btn-primary:hover { background: #0041B0; }
.btn-secondary {
  background: #FFFFFF;
  color: #1F2937;
  border: 1px solid #D1D5DB;
}
.btn-secondary:hover { background: #F9FAFB; }
.btn-danger {
  background: #D54941;
  color: #FFFFFF;
}
.btn-danger:hover { background: #C0352F; }
.btn-text {
  background: transparent;
  color: #0052D9;
  padding: 0 8px;
}
.btn-text:hover { background: #E8F0FE; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 16px; }

/* ---------- 卡片列表 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.card-item {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.15s;
}
.card-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.card-item .card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 8px;
}
.card-item .card-meta {
  font-size: 13px;
  color: #6B7280;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.card-item .card-actions {
  display: flex;
  gap: 8px;
}

/* ---------- 发布链接样式 ---------- */
.publish-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 12px;
}
.publish-link-box .link-url {
  flex: 1;
  font-size: 13px;
  color: #166534;
  font-family: monospace;
  word-break: break-all;
}
.publish-link-box .copy-btn {
  flex-shrink: 0;
}

/* ---------- 白名单编辑区 ---------- */
.whitelist-editor {
  margin-top: 16px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  background: #FFFFFF;
}
.whitelist-editor .wl-title {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.whitelist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.whitelist-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #E8F0FE;
  color: #0052D9;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
}
.whitelist-tag .remove-uid {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.whitelist-tag .remove-uid:hover { opacity: 1; }
.whitelist-add {
  display: flex;
  gap: 8px;
}
.whitelist-add input {
  flex: 1;
  height: 32px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 13px;
}

/* ---------- 分类Tag多选样式 ---------- */
.cat-tag-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  background: #FFFFFF;
}
.cat-tag-item:hover {
  border-color: #0052D9;
  color: #0052D9;
}
.cat-tag-selected {
  background: #E8F0FE;
  border-color: #0052D9;
  color: #0052D9;
  font-weight: 500;
}

/* ---------- 空态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #9CA3AF;
}
.empty-state iconify-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state .empty-text {
  font-size: 14px;
  margin-bottom: 8px;
}

/* ---------- 加载态 ---------- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E5E7EB;
  border-top-color: #0052D9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 分页器 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px 0 0;
}
.pagination .page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  font-size: 13px;
  color: #374151;
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.15s;
}
.pagination .page-btn:hover { border-color: #0052D9; color: #0052D9; }
.pagination .page-btn.active {
  background: #0052D9;
  color: #FFFFFF;
  border-color: #0052D9;
}
.pagination .page-btn:disabled {
  color: #9CA3AF;
  cursor: not-allowed;
}

/* ---------- Tab 切换 ---------- */
.tab-nav {
  display: flex;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 20px;
}
.tab-item {
  padding: 10px 20px;
  font-size: 14px;
  color: #6B7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-item:hover { color: #0052D9; }
.tab-item.active {
  color: #0052D9;
  border-bottom-color: #0052D9;
  font-weight: 500;
}

/* ---------- 上传拖拽区 ---------- */
.upload-zone {
  border: 2px dashed #D1D5DB;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #FAFBFC;
}
.upload-zone:hover {
  border-color: #0052D9;
  background: #E8F0FE;
}
.upload-zone iconify-icon {
  font-size: 40px;
  color: #9CA3AF;
  margin-bottom: 12px;
}
.upload-zone .upload-text {
  font-size: 14px;
  color: #6B7280;
}
.upload-zone .upload-hint {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 6px;
}

/* ---------- 无权限页面 ---------- */
.no-permission-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #F3F4F6;
  text-align: center;
  padding: 20px;
}
.no-permission-page iconify-icon {
  font-size: 64px;
  color: #9CA3AF;
  margin-bottom: 24px;
}
.no-permission-page .np-title {
  font-size: 20px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 8px;
}
.no-permission-page .np-desc {
  font-size: 14px;
  color: #6B7280;
  max-width: 400px;
}

/* ---------- 测试预览区 ---------- */
.test-preview {
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.test-preview .result-number {
  font-size: 28px;
  font-weight: 700;
  color: #166534;
}
.test-preview .result-label {
  font-size: 13px;
  color: #166534;
  margin-top: 4px;
}

/* ---------- 数据导入预览 ---------- */
.import-preview {
  margin-top: 16px;
}
.import-preview .preview-header {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 10px;
}
.import-preview .field-mapping {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mapping-row .excel-col {
  width: 120px;
  font-size: 13px;
  color: #6B7280;
}
.mapping-row .arrow {
  color: #9CA3AF;
}
.mapping-row select {
  flex: 1;
  height: 32px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 13px;
}
