@import '../../../../styles/admin-config-pages.css';

/* ============================================================
   AdminKuaishouCloudFulfillment — 蓝色主题覆盖 & 双栏映射布局
   模板已统一使用 admin-config-pages.css 共享类名
   ============================================================ */

/* ---------- 页面容器 & CSS 自定义属性 ---------- */
.admin-panel {
  --panel-ink: var(--text-primary);
  --panel-muted: var(--text-secondary);
  --panel-border: var(--border-default);
  --panel-soft: #f6f8fb;
  --panel-line: #dce3ec;
  --accent: var(--color-primary);
  --accent-strong: var(--color-primary-dark);
  --warn: var(--color-warning);
  --danger: var(--color-danger);

  display: grid;
  gap: var(--space-4);
}

/* ---------- 标题颜色覆盖 ---------- */
.section-title-row h3 {
  color: #1d3555;
}

.section-title-row p {
  color: #64748b;
  line-height: 1.55;
}

/* ---------- chip 标签 (蓝色) ---------- */
.mini-stat-chip,
.overview-note {
  color: #175cd3;
}

/* ---------- 卡片圆角覆盖 ---------- */
.overview-card,
.table-card,
.empty-block,
.error-copy {
  border-radius: 20px;
  box-shadow: none;
}

.overview-file code {
  background: rgba(15, 23, 42, 0.05);
  color: #1d3555;
}

/* ---------- 概览统计覆盖 ---------- */
.overview-stat {
  border-radius: 16px;
}

.overview-stat span {
  color: #64748b;
}

.overview-stat strong {
  color: #1d3555;
  font-size: var(--text-2xl);
}

/* ---------- 91卡券查询工具栏 ---------- */
.lookup-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 130px 180px;
  gap: 12px;
  align-items: end;
}

/* ---------- 字段块 ---------- */
.field-block span {
  color: #1d3555;
}

.field-help,
.toolbar-hint,
.cell-subtle {
  color: #64748b;
}

.field-wide {
  grid-column: span 2;
}

.field-block :deep(.el-input-number),
.field-block :deep(.el-select) {
  width: 100%;
}

/* ---------- 文本输入 (蓝色聚焦环) ---------- */
.text-input {
  min-height: 36px;
  color: #1d3555;
}

.textarea-input {
  min-height: 72px;
  resize: vertical;
}

/* ---------- 校验/错误覆盖 ---------- */
.validation-banner,
.binding-inline-error {
  background: #fff5f4;
  border: 1px solid rgba(180, 35, 24, 0.14);
  color: #b42318;
  font-size: var(--text-sm);
}

.error-copy {
  color: #b42318;
}

/* ---------- 表格覆盖 ---------- */
.data-table th,
.data-table td {
  padding: 11px 10px;
}

.data-table th {
  color: #64748b;
  font-size: var(--text-xs);
}

.cell-stack strong {
  color: #1d3555;
}

/* ---------- 绑定卡片覆盖 ---------- */
.binding-card {
  border-radius: 16px;
  box-shadow: none;
}

.binding-title-row {
  color: #1d3555;
}

.binding-subtle {
  color: #64748b;
}

.binding-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.collapse-button {
  color: #1d3555;
  cursor: pointer;
}

.binding-collapsed-preview {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: #64748b;
  font-size: var(--text-xs);
}

.checkbox-line {
  color: #1d3555;
  font-size: var(--text-sm);
}

.binding-actions {
  margin-top: 12px;
}

.toolbar-hint {
  margin: 10px 0 0;
}

.empty-inline {
  padding: 14px;
  color: #64748b;
  text-align: center;
}

/* ---------- 双栏映射编辑器 (快手 Cloud 独有) ---------- */
.mapping-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.mapping-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.mapping-panel--external {
  background: rgba(239, 246, 255, 0.72);
}

.mapping-panel--internal {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 93, 216, 0.16);
}

.mapping-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.mapping-panel-head strong {
  color: #1d3555;
  font-size: 15px;
}

.mapping-panel-head span {
  color: #64748b;
  font-size: var(--text-xs);
}

.mapping-grid,
.mapping-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.mapping-arrow {
  display: grid;
  place-items: center;
  color: #175cd3;
  font-size: var(--text-xs);
  font-weight: 700;
}

.mapping-arrow span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: rgba(15, 93, 216, 0.08);
  border: 1px solid rgba(15, 93, 216, 0.14);
}

.mapping-extra {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(86, 108, 138, 0.18);
}

.overview-label {
  color: #64748b;
  font-size: var(--text-xs);
}

/* ---------- Element Plus 蓝色主题覆盖 ---------- */
.admin-panel :deep(.el-button) {
  min-height: 34px;
  border-radius: var(--radius-full);
}

.admin-panel :deep(.el-button--primary) {
  --el-button-bg-color: #3a91f7;
  --el-button-border-color: #3a91f7;
  --el-button-hover-bg-color: #0f5dd8;
  --el-button-hover-border-color: #0f5dd8;
}

.admin-panel :deep(.el-input__wrapper),
.admin-panel :deep(.el-textarea__inner),
.admin-panel :deep(.el-select__wrapper) {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 0 0 1px var(--panel-line) inset;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.admin-panel :deep(.el-input__wrapper:hover),
.admin-panel :deep(.el-textarea__inner:hover),
.admin-panel :deep(.el-select__wrapper:hover) {
  box-shadow: 0 0 0 1px rgba(15, 107, 95, 0.38) inset;
}

.admin-panel :deep(.el-input__wrapper.is-focus),
.admin-panel :deep(.el-textarea__inner:focus),
.admin-panel :deep(.el-select__wrapper.is-focused) {
  box-shadow:
    0 0 0 1px var(--accent) inset,
    0 0 0 3px rgba(15, 107, 95, 0.12);
}

.admin-panel :deep(.is-disabled .el-input__wrapper),
.admin-panel :deep(.el-input__wrapper.is-disabled),
.admin-panel :deep(.el-select__wrapper.is-disabled) {
  background: #f8fafc;
  color: #64748b;
}

.admin-panel :deep(.el-textarea__inner[readonly]),
.admin-panel :deep(.el-input__wrapper.is-readonly) {
  background: #f8fafc;
  color: #64748b;
}

.admin-panel :deep(.el-input-number .el-input__wrapper) {
  padding-left: 8px;
}

.admin-panel :deep(.el-input-number__decrease),
.admin-panel :deep(.el-input-number__increase) {
  border-color: var(--panel-line);
  background: #f8fafc;
}

.admin-panel :deep(.el-switch.is-checked .el-switch__core) {
  border-color: var(--accent);
  background-color: var(--accent);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .overview-stats,
  .lookup-toolbar,
  .binding-grid,
  .mapping-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mapping-arrow {
    display: none;
  }

  .field-wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .section-title-row,
  .section-header-tools,
  .binding-actions,
  .binding-header {
    flex-direction: column;
    align-items: stretch;
  }

  .overview-stats,
  .lookup-toolbar,
  .binding-grid,
  .mapping-editor,
  .mapping-grid,
  .mapping-extra {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }
}
