/* ========== Admin Panel 管理后台 ========== */
.admin-page {
  min-height: calc(100vh - 64px);
  background: #f0f2f5;
}

/* ===== 登录界面 ===== */
.admin-login-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.admin-login-box {
  background: #fff;
  border-radius: 12px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.admin-login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.admin-login-logo img {
  max-height: 60px;
  margin-bottom: 12px;
}

.admin-login-logo h2 {
  font-size: 24px;
  color: #1a1a2e;
  font-weight: 700;
  letter-spacing: 2px;
}

.admin-login-form .form-group {
  margin-bottom: 20px;
}

.admin-login-form .form-group label {
  display: block;
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 600;
}

.admin-login-form .form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.admin-login-form .form-group input:focus {
  border-color: #2563eb;
  outline: none;
}

.login-error {
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 4px;
  transition: background 0.2s;
}

.btn-login:hover {
  background: #1d4ed8;
}

.admin-login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: #888;
  font-size: 14px;
}

.admin-login-back:hover {
  color: #2563eb;
}

/* 顶部标题栏右侧 */
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-user {
  font-size: 14px;
  color: #555;
  font-weight: 600;
}

.admin-logout-btn {
  padding: 6px 16px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-logout-btn:hover {
  background: #fecaca;
}

/* 顶部标题栏 */
.admin-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.admin-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-title-area {
  display: flex;
  align-items: center;
  gap: 20px;
}

.admin-back-link {
  color: #2563eb;
  font-size: 14px;
  font-weight: 600;
}

.admin-back-link:hover {
  text-decoration: underline;
}

.admin-main-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
}

.admin-reset-btn {
  padding: 8px 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-reset-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Tab 导航 */
.admin-tabs {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.admin-tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
}

.admin-tab {
  padding: 14px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #666;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab:hover {
  color: #2563eb;
}

.admin-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* 内容区 */
.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.admin-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

.panel-tip {
  padding: 0 24px 12px;
  font-size: 13px;
  color: #999;
}

/* 按钮 */
.btn-add {
  padding: 8px 18px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add:hover {
  background: #1d4ed8;
}

.btn-sm {
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-edit {
  background: #eff6ff;
  color: #2563eb;
}
.btn-edit:hover { background: #dbeafe; }

.btn-add-sub {
  background: #f0fdf4;
  color: #16a34a;
}
.btn-add-sub:hover { background: #dcfce7; }

.btn-copy {
  background: #faf5ff;
  color: #9333ea;
}
.btn-copy:hover { background: #f3e8ff; }

.btn-danger {
  background: #fef2f2;
  color: #ef4444;
}
.btn-danger:hover { background: #fee2e2; }

.btn-move {
  background: #f5f5f5;
  color: #666;
  width: 30px;
  padding: 5px 0;
  text-align: center;
}
.btn-move:hover { background: #e5e5e5; }
.btn-move:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-save {
  padding: 10px 28px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-save:hover { background: #1d4ed8; }

.btn-cancel {
  padding: 10px 28px;
  background: #f5f5f5;
  color: #666;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-cancel:hover { background: #efefef; }

/* ===== 分类列表 ===== */
.cat-list {
  padding: 8px 24px 24px;
}

.cat-item {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.cat-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fafbfc;
}

.cat-id {
  font-size: 12px;
  color: #999;
  font-weight: 600;
  min-width: 36px;
}

.cat-name {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}

.cat-en {
  font-size: 13px;
  color: #999;
}

.cat-children-count {
  font-size: 12px;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 10px;
}

.cat-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.cat-children {
  padding: 8px 16px 12px;
  background: #fff;
}

.cat-child-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #f8f8f8;
}

.cat-child-item:last-child {
  border-bottom: none;
}

.child-name {
  font-size: 14px;
  color: #555;
  font-weight: 600;
}

.child-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ===== 产品管理 ===== */
.prod-filter-bar {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
}

.prod-search-input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.prod-search-input:focus {
  border-color: #2563eb;
}

.prod-filter-select {
  height: 38px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
  min-width: 160px;
}

.prod-table-wrap {
  overflow-x: auto;
}

.prod-table {
  width: 100%;
  border-collapse: collapse;
}

.prod-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: #999;
  background: #fafbfc;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

.prod-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f8f8f8;
}

.prod-table tr:hover {
  background: #fafbfc;
}

.prod-thumb {
  width: 50px;
  height: 38px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
}

.prod-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.prod-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #ccc;
}

/* ===== 代理品牌管理 ===== */
.brand-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 8px 24px 24px;
}

.brand-admin-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.brand-admin-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.brand-admin-img {
  height: 90px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #f0f0f0;
}

.brand-admin-img img {
  max-width: 90%;
  max-height: 80px;
  object-fit: contain;
}

.brand-admin-name {
  padding: 8px 12px 4px;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  text-align: center;
}

.brand-admin-path {
  padding: 0 12px 8px;
  font-size: 11px;
  color: #aaa;
  text-align: center;
  word-break: break-all;
}

.brand-admin-actions {
  display: flex;
  gap: 4px;
  padding: 8px 12px 12px;
  justify-content: center;
}

.brand-preview {
  width: 180px;
  height: 88px;
  background: #f5f5f5;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto;
}

.brand-preview img {
  max-width: 95%;
  max-height: 78px;
  object-fit: contain;
  border-radius: 4px;
}

/* ===== 客户管理 ===== */
.client-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 8px 24px 24px;
}

.client-admin-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  transition: box-shadow 0.2s;
}

.client-admin-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.client-admin-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 10px;
}

.client-admin-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-box.modal-sm {
  max-width: 380px;
}

.modal-box.modal-lg {
  max-width: 760px;
}

.modal-box h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
  border-color: #2563eb;
}

.form-group textarea {
  resize: vertical;
  line-height: 1.6;
}

.prod-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

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

  .admin-title-area {
    gap: 12px;
  }

  .admin-main-title {
    font-size: 18px;
  }

  .admin-tabs-inner {
    padding: 0 8px;
    overflow-x: auto;
  }

  .admin-tab {
    padding: 12px 14px;
    font-size: 14px;
    white-space: nowrap;
  }

  .admin-content {
    padding: 12px;
  }

  .panel-header {
    padding: 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .cat-list {
    padding: 8px 12px 16px;
  }

  .cat-item-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .cat-actions {
    margin-left: 0;
    width: 100%;
  }

  .prod-filter-bar {
    flex-direction: column;
    padding: 12px 16px;
  }

  .prod-filter-select {
    min-width: auto;
  }

  .prod-table {
    font-size: 12px;
  }

  .prod-table th,
  .prod-table td {
    padding: 8px;
  }

  .brand-admin-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 12px 16px;
  }

  .client-admin-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 12px 16px;
  }

  .prod-form-grid {
    grid-template-columns: 1fr;
  }

  .modal-box {
    padding: 20px;
  }
}

/* ===== 图片上传区域 ===== */
.upload-area {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
}

.upload-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

.upload-preview {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

.upload-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-remove:hover {
  background: #dc2626;
}

.upload-path-input {
  margin-top: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  color: #888;
}

/* 多图上传 */
.multi-upload-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.multi-upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.multi-upload-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.multi-upload-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

.multi-upload-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px;
}

.multi-upload-actions .btn-sm {
  padding: 2px 6px;
  font-size: 12px;
  min-width: auto;
}

.upload-btn-add {
  width: auto;
  height: 40px;
  padding: 0 20px;
}

/* 客户卡片图片 */
.client-admin-img {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.client-admin-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.client-admin-img.placeholder {
  color: #ccc;
  font-size: 13px;
  background: #f9fafb;
  border-radius: 4px;
}

/* Quill 富文本编辑器 */
.quill-editor-container {
  min-height: 200px;
}

.quill-editor-container .ql-editor {
  min-height: 160px;
  font-size: 14px;
  line-height: 1.6;
}

.quill-editor-container .ql-toolbar {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.quill-editor-container .ql-container {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* 产品弹窗滚动 */
.modal-box.modal-lg {
  max-height: 90vh;
  overflow-y: auto;
}

/* 分类多选 */
.cat-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
}
.cat-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  min-width: 28%;
}
.cat-checkbox input {
  width: 15px;
  height: 15px;
  accent-color: #1e5799;
  cursor: pointer;
}

/* ===== 订单管理 ===== */
.loading-tip, .empty-tip { padding: 40px; text-align: center; color: #999; font-size: 14px; }
.order-list { display: flex; flex-direction: column; gap: 16px; padding: 16px 0; }
.order-card { border: 1px solid #eee; border-radius: 10px; padding: 18px; background: #fff; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-no { font-weight: 600; color: #333; font-size: 14px; }
.order-status { font-size: 12px; padding: 3px 12px; border-radius: 12px; background: #f0f0f0; color: #666; }
.order-status.st-0 { background: #fff4e5; color: #d48806; }
.order-status.st-1 { background: #e6f4ff; color: #1677ff; }
.order-status.st-2 { background: #f9f0ff; color: #722ed1; }
.order-status.st-3 { background: #e8f7ee; color: #18a058; }
.order-status.st-4 { background: #f5f5f5; color: #999; }
.order-meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: #555; margin-bottom: 6px; }
.order-meta b { color: #e53e3e; }
.order-addr, .order-logi { font-size: 12px; color: #888; line-height: 1.6; margin-bottom: 4px; }
.order-items { border-top: 1px dashed #eee; margin-top: 10px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.order-item-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #444; }
.order-item-img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.order-item-name { flex: 1; }
.order-item-price { color: #666; }
.order-card-actions { margin-top: 14px; display: flex; gap: 12px; justify-content: flex-end; }
.btn-ship { background: #1677ff; color: #fff; border: none; }
.btn-confirm { background: #18a058; color: #fff; border: none; }
.ship-order-no { color: #888; font-size: 12px; margin: 0 0 14px; }
