/* ===== 管理页面样式 ===== */

.admin-body {
  overflow-y: auto;
  background: var(--bg-primary);
}

.admin-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-header-left h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}
.admin-header-left h1::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  margin-top: 8px;
  background: var(--signal);
  box-shadow: 0 0 8px rgba(34,211,238,0.5);
}

.admin-header-left p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ===== 多维筛选栏 ===== */
.admin-toolbar {
  padding: 12px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.toolbar-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.toolbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.toolbar-search input:focus {
  border-color: var(--signal);
  box-shadow: 0 0 10px rgba(34,211,238,0.25);
  background-color: var(--bg-tertiary);
}

.toolbar-search::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
}

.toolbar-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-filters select {
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  min-width: 100px;
  transition: var(--transition);
}

.toolbar-filters select:focus {
  border-color: var(--signal);
  box-shadow: 0 0 10px rgba(34,211,238,0.25);
  background-color: var(--bg-tertiary);
}

/* 筛选信息行 */
.toolbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.filter-count::before {
  content: "📋 ";
}

.btn-reset {
  font-size: 0.8rem;
  padding: 4px 10px;
}

/* ===== 可排序表头 ===== */
.data-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}

.data-table th[data-sort]:hover {
  color: var(--signal);
  background: rgba(34,211,238,0.08);
}

.data-table th.sort-active {
  color: var(--signal);
}

.data-table th .sort-icon {
  display: inline-block;
  width: 14px;
  margin-left: 4px;
  font-size: 0.7rem;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.data-table th.sort-active .sort-icon {
  opacity: 1;
}

/* ===== 数据表格 ===== */
.admin-content {
  padding: 24px 32px;
}

/* 桌面端角标位置适配（overflow:hidden 容器内嵌角标） */
.frame-corner.data-table-wrap::before,
.frame-corner.data-table-wrap::after {
  z-index: 5;
}
.frame-corner.data-table-wrap::before {
  top: 6px;
  left: 6px;
}
.frame-corner.data-table-wrap::after {
  bottom: 6px;
  right: 6px;
}
.frame-corner.modal::before {
  top: 6px;
  left: 6px;
}
.frame-corner.modal::after {
  bottom: 6px;
  right: 6px;
}

.data-table-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(42,63,95,0.4);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: rgba(34,211,238,0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* 单元格内容 */
.cell-name {
  font-weight: 600;
  color: var(--text-primary);
}

.cell-short {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.cell-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.keyword-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--signal);
  font-family: var(--font-mono);
}

.cell-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.cell-type.public { background: rgba(34,211,238,0.12); color: var(--signal); }
.cell-type.state { background: rgba(245,158,11,0.12); color: var(--amber); }
.cell-type.private { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.cell-type.central { background: rgba(239,68,68,0.15); color: var(--accent-red); }

.cell-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
}

.cell-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.cell-status.active { color: var(--accent-green); }
.cell-status.active .dot { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.cell-status.inactive { color: var(--text-muted); }
.cell-status.inactive .dot { background: var(--text-muted); }

.cell-actions {
  display: flex;
  gap: 6px;
}

.cell-actions .btn {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* 数据行可点击提示 */
.data-table tbody tr[data-id] {
  cursor: pointer;
}

.data-table tbody tr[data-id]:hover {
  background: rgba(34,211,238,0.06);
  box-shadow: inset 3px 0 0 rgba(34,211,238,0.4);
}

/* ===== 供应商抽屉 ==== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 5vh;
  right: 0;
  width: 600px;
  max-width: 90vw;
  max-height: 90vh;
  height: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

.drawer-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.drawer-stats {
  display: flex;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(17,24,39,0.5);
  flex-shrink: 0;
}

.drawer-stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.drawer-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.drawer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.drawer-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.drawer-empty-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}

.drawer-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-tertiary);
  z-index: 2;
}

.drawer-table th {
  padding: 10px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-table th:nth-child(1) { width: 22%; }
.drawer-table th:nth-child(2) { width: 14%; }
.drawer-table th:nth-child(3) { width: 12%; }
.drawer-table th:nth-child(4) { width: 28%; }
.drawer-table th:nth-child(5) { width: 14%; }
.drawer-table th:nth-child(6) { width: 10%; }

.drawer-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(42,63,95,0.3);
  color: var(--text-primary);
  vertical-align: middle;
  overflow: hidden;
}

.drawer-table tbody tr {
  transition: background 0.15s;
}

.drawer-table tbody tr:hover {
  background: rgba(34,211,238,0.04);
}

.drawer-row-clickable {
  cursor: pointer;
}

.drawer-row-clickable:hover {
  background: rgba(34,211,238,0.08) !important;
  box-shadow: inset 2px 0 0 rgba(34,211,238,0.5);
}

.drawer-supplier-name {
  font-weight: 600;
}

.drawer-inner-badge {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(52,211,153,0.15);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: 4px;
  font-size: 0.65rem;
  color: #34d399;
  margin-left: 6px;
}

.drawer-amount {
  font-family: var(--font-mono);
  color: var(--signal);
  font-weight: 600;
  white-space: nowrap;
}

.drawer-project {
  word-break: break-all;
  white-space: normal;
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
}

@media (max-width: 768px) {
  .drawer {
    width: 100%;
    max-width: 100%;
  }

  .drawer-stats {
    gap: 16px;
    padding: 12px 16px;
  }

  .drawer-stat-value {
    font-size: 1rem;
  }

  .drawer-table th,
  .drawer-table td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .drawer-project {
    max-width: 100px;
  }
}

/* ===== 供应商详情面板（替代 ccgp SPA 验证码跳转） ===== */
.drawer-detail-panel {
  display: none;
  flex-direction: column;
  height: 100%;
}

.drawer-detail-panel.open {
  display: flex;
}

.drawer-detail-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--signal);
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.drawer-detail-back:hover {
  background: var(--bg-primary);
}

.drawer-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.drawer-detail-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
  line-height: 1.5;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drawer-detail-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.drawer-detail-body {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-secondary);
  word-break: break-all;
}

.drawer-detail-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.82rem;
}

.drawer-detail-body td,
.drawer-detail-body th {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}

.drawer-detail-body th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

.drawer-detail-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.drawer-detail-actions .btn {
  font-size: 0.82rem;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 12px;
}

.pagination-btn {
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--signal);
  color: var(--text-primary);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--signal-dim);
  color: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 10px rgba(34,211,238,0.25);
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

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

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 16px;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--accent-red);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--signal);
  box-shadow: 0 0 10px rgba(34,211,238,0.25);
  background-color: var(--bg-tertiary);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  cursor: pointer;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  margin-top: 4px;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== 确认弹窗 ===== */
.confirm-modal .modal-body {
  text-align: center;
  padding: 32px 24px;
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.confirm-text {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease-out;
  max-width: 360px;
}

.toast.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.info {
  background: linear-gradient(135deg, #0e7490, #155e75);
}

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

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .admin-header {
    padding: 16px 20px;
  }

  .admin-toolbar {
    padding: 8px 20px;
  }

  .toolbar-filters select {
    font-size: 0.8rem;
    padding: 6px 8px;
    min-width: 80px;
  }

  .admin-content {
    padding: 16px 20px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .cell-actions {
    flex-direction: column;
  }

  .modal {
    margin: 0 16px;
  }
}
