/* =========================================================
 * 鼎牌照明 - 产品管理后台样式
 * ========================================================= */

.admin-body {
  background: var(--bg-soft);
  min-height: 100vh;
}

/* ====== 顶栏 ====== */
.admin-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 100);
  background: var(--white);
  border-bottom: 1px solid var(--ink-200);
}
.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
}
.admin-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.admin-save-state {
  font-size: var(--fs-12);
  color: var(--success);
  font-weight: var(--fw-medium);
}
.admin-save-state::before { content: "● "; }

/* ====== 主区 ====== */
.admin-main { padding: var(--sp-8) 0 var(--sp-16); }

/* 提示条 */
.admin-tip {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: rgba(30, 58, 138, .06);
  border: 1px solid rgba(30, 58, 138, .15);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
  color: var(--ink-700);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
}
.admin-tip svg { flex-shrink: 0; color: var(--brand-navy); margin-top: 3px; }
.admin-tip code {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--brand-orange-dark);
}
.admin-tip strong { color: var(--brand-navy); }

/* ====== 两栏布局 ====== */
.admin-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--sp-6);
  align-items: start;
}
@media (max-width: 1100px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-panel {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--ink-200);
  background: var(--ink-50);
}
.admin-panel__head h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-20);
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.admin-count {
  background: var(--brand-navy);
  color: var(--white);
  font-size: var(--fs-12);
  font-family: var(--font-sans);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semi);
}

/* ====== 列表 ====== */
.admin-search {
  position: relative;
  margin: var(--sp-5) var(--sp-6) var(--sp-3);
}
.admin-search svg {
  position: absolute;
  left: 0.8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
}
.admin-search input { padding-left: 2.3rem; }

.admin-cats {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0 var(--sp-6) var(--sp-4);
}
.admin-cat {
  font-size: var(--fs-12);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--ink-100);
  color: var(--ink-700);
  transition: all var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}
.admin-cat:hover { color: var(--brand-navy); }
.admin-cat.is-active {
  background: var(--brand-navy);
  color: var(--white);
}

.admin-list__items {
  max-height: 62vh;
  overflow-y: auto;
  padding: 0 var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
@media (max-width: 1100px) {
  .admin-list__items { max-height: 40vh; }
}

.admin-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.admin-item:hover { background: var(--ink-50); border-color: var(--ink-200); }
.admin-item.is-active {
  background: rgba(30, 58, 138, .06);
  border-color: rgba(30, 58, 138, .3);
}
.admin-item__thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ink-100);
  display: grid;
  place-items: center;
  color: var(--ink-300);
  font-family: var(--font-serif);
  font-size: var(--fs-20);
}
.admin-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-item__body { flex: 1; min-width: 0; }
.admin-item__name {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-item__meta {
  font-size: var(--fs-12);
  color: var(--ink-400);
  margin-top: 2px;
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.admin-item__meta .dot { color: var(--brand-gold); }
.admin-item__del {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--ink-400);
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease);
}
.admin-item__del:hover { background: rgba(220, 38, 38, .1); color: var(--error); }

/* ====== 表单 ====== */
.admin-form { padding-bottom: var(--sp-8); }
.admin-form form { padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-5); }
.admin-form .field { display: block; }
.admin-form .field em { color: var(--error); font-style: normal; }

.admin-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.admin-subhead .field { margin-bottom: 0; }

/* 动态行 */
.dyn-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.dyn-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.dyn-row .kv { display: flex; gap: var(--sp-2); flex: 1; }
.dyn-row .kv input { flex: 1; }
.dyn-row .kv .k { max-width: 130px; }
.dyn-row__del {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--ink-400);
  background: var(--ink-100);
  transition: all var(--dur-fast) var(--ease);
}
.dyn-row__del:hover { background: rgba(220, 38, 38, .12); color: var(--error); }

/* 图片上传 */
.admin-upload {
  border: 2px dashed var(--ink-300);
  border-radius: var(--radius);
  padding: var(--sp-5);
  background: var(--ink-50);
  transition: border-color var(--dur-fast) var(--ease);
}
.admin-upload:hover { border-color: var(--brand-gold); }
.admin-upload__preview {
  margin-bottom: var(--sp-4);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 260px;
  border: 1px solid var(--ink-200);
}
.admin-upload__preview img { width: 100%; display: block; }
.admin-upload__ops { display: flex; flex-direction: column; gap: var(--sp-2); }
.admin-upload__hint { font-size: var(--fs-12); color: var(--ink-500); }
.admin-upload__note { font-size: var(--fs-12); color: var(--ink-400); line-height: var(--lh-normal); }
.admin-upload__note code {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--brand-orange-dark);
}

/* 按钮组 */
.admin-form__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--ink-200);
}
.btn--danger-ghost {
  color: var(--error);
  border: 1.5px solid var(--error);
  background: transparent;
}
.btn--danger-ghost:hover { background: var(--error); color: var(--white); }

/* 空列表 */
.admin-empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--ink-400);
  font-size: var(--fs-14);
}


/* ====== 后台手机端响应式（2026-08-19，必须手机可用） ====== */
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr !important; gap: 1rem; }
  .admin-sidebar, .admin-main { width: 100%; min-width: 0; }
  .admin-header { flex-direction: column; align-items: stretch !important; gap: .5rem; }
  .admin-header h1 { font-size: 1.2rem; }
  .admin-subhead { flex-direction: column !important; align-items: stretch !important; gap: .75rem; }
  .admin-subhead .field { width: 100%; }
  .admin-subhead .field input,
  .admin-subhead .field select,
  .admin-subhead .field textarea { width: 100%; }
  .admin-list__head { display: none; }
  .admin-list__item { grid-template-columns: 1fr !important; gap: .35rem; padding: .85rem !important; border: 1px solid var(--ink-200); border-radius: var(--radius-sm); margin-bottom: .5rem; }
  .admin-list__item .admin-list__act { justify-content: flex-start; flex-wrap: wrap; gap: .35rem; }
  .form, .card, .admin-card, .admin-main, .admin-sidebar > * { padding: 1rem; }
  .kv { grid-template-columns: 1fr !important; gap: .35rem; }
  .kv .k { max-width: none !important; width: 100%; }
  .kv .v, .kv input, .kv textarea, .kv select { width: 100%; }
  .field label { font-size: var(--fs-14); }
  .field input, .field select, .field textarea { font-size: 16px; padding: .75rem .85rem; width: 100%; }
  textarea { min-height: 120px; }
  .dyn-row { flex-wrap: wrap; }
  .dyn-row .kv { flex: 1 1 100% !important; flex-direction: column; align-items: stretch; }
  .dyn-row .kv .k, .dyn-row .kv input { max-width: none !important; width: 100% !important; }
  .dyn-row__del { width: 100% !important; height: 40px; margin-top: .25rem; }
  .admin-upload { padding: 1rem; }
  .upload-preview img, .upload-preview .ph { max-width: 100%; height: auto; }
  .btn { width: 100%; padding: .9rem 1rem; font-size: 1rem; }
  .admin-actions { flex-direction: column !important; gap: .5rem; }
  .admin-actions .btn { width: 100%; }
  .admin-header__actions { flex-direction: column !important; align-items: stretch; width: 100%; gap: .5rem; }
  .admin-header__actions .btn { width: 100%; }
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .admin-tab { white-space: nowrap; flex-shrink: 0; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .admin-tagbar { flex-wrap: wrap; }
  .form-grid, .form-row { grid-template-columns: 1fr !important; }
  .modal__panel { width: calc(100vw - 1.5rem); max-width: none; margin: 1rem .75rem; }
  h1, h2, h3 { word-break: break-word; }
}
