/* =========================================================
   星语酒业 官网管理后台样式
   酒红 + 金 · 简洁后台
   ========================================================= */
* { box-sizing: border-box; }
body.admin-body { margin: 0; font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: #F4EDE3; color: #1C1418; }

.hidden { display: none !important; }

/* ---------- 按钮 ---------- */
.btn, .btn-dark, .btn-line, .btn-danger, .btn-sm, .btn-logout {
  font-family: inherit; cursor: pointer; border-radius: 999px; font-size: 14px; transition: all .15s;
}
.btn-dark { background: #5C1A2B; color: #fff; border: none; padding: 12px 26px; font-weight: 600; }
.btn-dark:hover { background: #3C1019; }
.btn-line { background: #fff; border: 1.5px solid #E7DED6; color: #5A4F53; padding: 10px 20px; }
.btn-line:hover { border-color: #C19A4B; color: #3C1019; }
.btn-line:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { background: #fff; border: 1.5px solid #C0392B; color: #C0392B; padding: 9px 18px; }
.btn-danger:hover { background: #C0392B; color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-logout { background: transparent; border: 1px solid #E7DED6; color: #938A8D; padding: 9px 18px; width: 100%; margin-top: auto; }
.btn-logout:hover { color: #C0392B; border-color: #C0392B; }

/* ---------- 登录 ---------- */
.login-mask { position: fixed; inset: 0; background: linear-gradient(135deg, #2A0B12, #5C1A2B 55%, #3C1019); display: flex; align-items: center; justify-content: center; z-index: 200; }
.login-box { background: #fff; border-radius: 22px; padding: 44px 38px 38px; width: 360px; text-align: center; box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55); border-top: 4px solid #C19A4B; position: relative; }
.login-box::before { content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(193,154,75,0.12); border: 1.5px solid #C19A4B; }
.login-logo { font-family: "Noto Serif SC", serif; color: #3C1019; font-size: 30px; font-weight: 700; letter-spacing: .1em; margin-top: 34px; }
.login-sub { color: #938A8D; font-size: 13px; margin: 6px 0 24px; }
.login-box input { width: 100%; padding: 13px 16px; border: 1.5px solid #E7DED6; border-radius: 12px; font-size: 15px; margin-bottom: 16px; text-align: center; transition: border-color .15s, box-shadow .15s; }
.login-box input:focus { outline: none; border-color: #C19A4B; box-shadow: 0 0 0 3px rgba(193,154,75,0.18); }
.login-box .btn-dark { width: 100%; background: linear-gradient(135deg, #5C1A2B, #3C1019); box-shadow: 0 10px 24px -10px rgba(92,26,43,0.7); }
.login-box .btn-dark:hover { background: linear-gradient(135deg, #6E2033, #4A131F); }
.login-tip { color: #938A8D; font-size: 12px; margin: 14px 0 0; line-height: 1.6; }

/* ---------- 布局 ---------- */
.admin-menu-toggle { display: none; }
.admin-side-backdrop { display: none; }
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-side { background: #fff; border-right: 1px solid #E7DED6; padding: 22px 14px; display: flex; flex-direction: column; min-height: 0; }
.admin-brand { font-family: "Noto Serif SC", serif; font-weight: 700; color: #3C1019; font-size: 18px; padding: 6px 12px 18px; letter-spacing: .08em; }
.admin-menu { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; min-height: 0; }
.am { display: block; text-align: left; padding: 12px 16px; border-radius: 12px; color: #5A4F53; cursor: pointer; font-size: 14px; font-weight: 500; background: none; border: none; font-family: inherit; }
.am:hover { background: rgba(92,26,43,0.06); color: #5C1A2B; }
.am.active { background: rgba(92,26,43,0.1); color: #5C1A2B; font-weight: 700; }
.admin-main {
  padding: 28px 34px;
  overflow: auto;
  min-width: 0; /* 关键：避免 grid 子项被内容撑开 */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-pane { display: none; min-width: 0; box-sizing: border-box; }
.tab-pane.active { display: flex; flex-direction: column; height: 100%; }
#tab-preview.active { display: flex; flex-direction: column; height: 100%; }

/* 头部：明确左右 padding 与表单块对齐 */
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}
.pane-head h2 { font-family: "Noto Serif SC", serif; font-size: 22px; margin: 0; color: #3C1019; flex: 0 1 auto; min-width: 0; }
.pane-head > * { flex-shrink: 1; }

/* ---------- 产品管理两栏 ---------- */
.admin-cols { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-list-wrap { background: #fff; border: 1px solid #E7DED6; border-radius: 18px; padding: 16px; box-shadow: 0 4px 20px -12px rgba(28,20,24,0.12); }
.list-tools { margin-bottom: 10px; }
.list-tools input { width: 100%; padding: 10px 14px; border: 1px solid #E7DED6; border-radius: 12px; font-size: 13px; background: #FBF8F4; }
.list-hint { font-size: 12px; color: #938A8D; margin: 0 0 12px; padding-left: 2px; }
.product-rows { max-height: 70vh; overflow: auto; }
.prow { display: flex; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; position: relative; }
.prow:hover { background: rgba(92,26,43,0.04); }
.prow.active { background: rgba(92,26,43,0.08); border-color: #B0413E; }
.prow.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: #B0413E; border-radius: 0 3px 3px 0; }
.prow.active .prow-name { color: #B0413E; }
.prow-thumb { width: 40px; height: 56px; flex: none; border-radius: 8px; background: #FBF8F4; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #B0413E; overflow: hidden; }
.prow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prow-info { min-width: 0; flex: 1 1 auto; }
.prow-name { font-weight: 600; font-size: 14px; color: #3C1019; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prow-sub { font-size: 12px; color: #938A8D; margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.cat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.prow-ops { display: flex; flex-direction: column; gap: 4px; flex: none; }
.prow-ops .op { width: 26px; height: 22px; border: 1px solid #EADfD2; background: #fff; border-radius: 6px; cursor: pointer; color: #938A8D; font-size: 13px; line-height: 1; transition: all .15s; }
.prow-ops .op:hover { border-color: #B0413E; color: #B0413E; background: rgba(176,65,62,0.06); }
.mini { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(92,26,43,0.08); color: #8A2C40; font-size: 11px; font-weight: 500; }
.mini.hot { background: linear-gradient(135deg, #C19A4B, #D4AE5A); color: #3C1019; }

/* ---------- 编辑器 ---------- */
.editor-wrap { background: #fff; border: 1px solid #E7DED6; border-radius: 18px; padding: 24px; box-shadow: 0 4px 20px -12px rgba(28,20,24,0.12); }
.editor { max-width: 720px; margin: 0 auto; }
.editor-head { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid #F0E9E3; }
.editor-title { font-size: 18px; font-weight: 700; color: #3C1019; }
.editor-sub { font-size: 13px; color: #938A8D; margin-top: 4px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #5A4F53; margin-bottom: 6px; }
.field input[type=text], .field input[type=url], .field input[type=number], .field input[type=color],
.field textarea, .field select {
  width: 100%; padding: 11px 14px; border: 1px solid #E7DED6; border-radius: 12px; font-size: 14px; font-family: inherit; background: #FBF8F4; color: #1C1418;
}
.field input[type=color] { height: 44px; padding: 4px; cursor: pointer; }
.field textarea { resize: vertical; min-height: 80px; }
.field textarea.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }
.field-check { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #5A4F53; font-weight: 500; }
.checkline input { width: 17px; height: 17px; }
.editor-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- 上传 ---------- */
.upload-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; padding: 8px 12px; background: #FBF8F4; border-radius: 12px; }
.upload-row input[type=file] { flex: 1 1 200px; min-width: 0; font-size: 13px; padding: 8px; border: 1px dashed #E7DED6; border-radius: 12px; background: #FBF8F4; }
.upload-opt { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.upload-opt select { padding: 8px 10px; border: 1px solid #E7DED6; border-radius: 10px; font-size: 13px; background: #fff; color: #5A4F53; font-family: inherit; cursor: pointer; }
.upload-row .btn-sm { flex: 0 0 auto; }
.img-preview { margin-top: 8px; min-height: 4px; }
/* ===== 图片预览统一管理 ===== */
/* Logo（导航栏 40px 高） */
#s-logo-preview,
#s-logo-preview:not(.hidden) { max-width: 120px; max-height: 60px; width: auto; height: auto; border-radius: 8px; border: 1px solid #E7DED6; display: block; object-fit: contain; }

/* Hero 图、Story 图、ContactBg 等大背景图（前端全宽） */
#s-img-hero-preview,
#s-img-story-preview,
#s-img-contactBg-preview { max-width: 300px; max-height: 170px; width: auto; height: auto; border-radius: 12px; border: 1px solid #E7DED6; display: block; object-fit: cover; }

/* 产品图、品鉴图（前端卡片 ~400px） */
#f-image-preview,
#t-image-preview { max-width: 180px; max-height: 240px; width: auto; height: auto; border-radius: 12px; border: 1px solid #E7DED6; display: block; object-fit: contain; }

/* 兜底：其他未匹配的预览图 */
.img-preview img:not([id]) { max-width: 200px; max-height: 200px; border-radius: 12px; border: 1px solid #E7DED6; display: block; object-fit: contain; }

/* 预览图容器 */
.img-preview { margin-top: 10px; min-height: 4px; }

/* ---------- 站点文案 ---------- */
.site-form { width: 100%; margin: 0; }
.site-form-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.site-form-head h2 { margin: 0; }
.sf-block { border: 1px solid #E7DED6; border-radius: 16px; padding: 20px 22px 18px; margin: 0 0 20px; background: #fff; width: 100%; box-sizing: border-box; max-width: 100%; min-width: 0; display: block; }
.sf-block legend { font-family: "Noto Serif SC", serif; font-weight: 700; color: #5C1A2B; font-size: 15px; padding: 0 10px; margin-left: 6px; }
.hint { font-size: 12px; color: #938A8D; margin: 6px 0 16px; }

/* ---------- 可折叠分组 ---------- */
.sf-block { position: relative; }
.sf-block legend { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; width: auto; }
.sf-block legend::before {
  content: "▸"; display: inline-block; color: #C19A4B; font-size: 12px; transition: transform .2s; transform-origin: 50% 50%;
}
.sf-block.collapsed legend::before { transform: rotate(90deg); }
.sf-block.collapsed .sf-body { display: none; }
.sf-block .sf-body > *:last-child { margin-bottom: 4px; }
.sf-divider { border: none; border-top: 1px dashed #E7DED6; margin: 18px 0 16px; }

.site-grid { display: block; width: 100%; max-width: 100%; box-sizing: border-box; }
.site-grid > * { width: 100%; max-width: 100%; box-sizing: border-box; }

/* 站点文案头部：与表单块完全对齐 */
.site-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}
.site-form-head h2 { margin: 0; flex: 0 1 auto; min-width: 0; }
.site-form-head button { flex: 0 0 auto; }

/* ---------- 首页数据墙独立 tab ---------- */
.stats-edit-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.stats-edit-rows .se-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; }
.stats-edit-rows .se-row input { border: 1px solid #E2DAD2; border-radius: 8px; padding: 11px 13px; font-size: 14px; }
.stats-edit-rows .se-row input:first-child { font-weight: 700; color: #7A1F2B; }
.se-preview { margin-top: 20px; border-top: 1px dashed #EEE; padding-top: 16px; }
.se-preview .stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; text-align: center; }
.se-preview .stats > div { flex: 0 1 auto; min-width: 100px; }
.se-preview .stats > div { flex: 0 1 auto; min-width: 100px; }
.se-preview .num { font-size: 22px; font-weight: 800; color: #7A1F2B; }
.se-preview .lbl { font-size: 12px; color: #666; margin-top: 4px; }
@media (max-width: 560px) {
  .stats-edit-rows .se-row { grid-template-columns: 1fr 1fr; }
  .se-preview .stats { gap: 14px; }
}

/* ---------- 实时预览 ---------- */
.preview-head { align-items: center; }
.preview-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-toolbar select { padding: 9px 14px; border: 1px solid #E7DED6; border-radius: 12px; font-size: 14px; font-family: inherit; background: #fff; color: #5A4F53; }
.preview-toolbar a.btn-line { text-decoration: none; display: inline-flex; align-items: center; }

/* 设备切换 */
.device-tabs { display: inline-flex; background: #fff; border: 1px solid #E7DED6; border-radius: 12px; padding: 3px; }
.device-tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; color: #5A4F53; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 12px; border-radius: 9px; transition: all .15s;
}
.device-tabs button:hover { color: #5C1A2B; background: rgba(92,26,43,0.04); }
.device-tabs button.active { background: #5C1A2B; color: #fff; }
.device-tabs button svg { flex: none; }

/* 预览舞台 */
.preview-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ECE5DC;
  border: 1px solid #E7DED6;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 2px 12px rgba(28,20,24,0.04), 0 4px 20px -12px rgba(28,20,24,0.12);
}

/* 加载指示 */
.preview-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(244,237,227,0.92);
  color: #5A4F53; font-size: 14px;
  transition: opacity .25s, visibility .25s;
}
.preview-loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preview-loading__spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(92,26,43,0.12);
  border-top-color: #5C1A2B;
  animation: preview-spin .8s linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }

/* iframe 容器 */
.preview-framebox {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 18px;
  overflow: auto;
}
.preview-framebox iframe {
  width: 100%; height: 100%; min-height: 0;
  border: none; border-radius: 0; background: #fff;
  box-shadow: 0 16px 50px -20px rgba(28,20,24,0.25);
  transition: width .25s ease, transform .25s ease, box-shadow .25s ease;
}

/* 设备模式 */
.preview-framebox.is-desktop iframe { width: 100%; height: 100%; border-radius: 0; }
.preview-framebox.is-tablet iframe { width: 820px; height: 1100px; border-radius: 16px; }
.preview-framebox.is-mobile iframe { width: 390px; height: 844px; border-radius: 24px; }

/* 滚动条美化 */
.preview-framebox::-webkit-scrollbar { width: 8px; height: 8px; }
.preview-framebox::-webkit-scrollbar-track { background: transparent; }
.preview-framebox::-webkit-scrollbar-thumb { background: rgba(92,26,43,0.18); border-radius: 999px; }
.preview-framebox::-webkit-scrollbar-thumb:hover { background: rgba(92,26,43,0.3); }

/* ---------- 提示 ---------- */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(10px); background: #3C1019; color: #fff; padding: 14px 26px; border-radius: 999px; font-size: 14px; opacity: 0; transition: all .3s; z-index: 300; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 首页数据墙编辑 ---------- */
.stats-edit-rows { display: flex; flex-direction: column; gap: 10px; }
.se-row { display: flex; gap: 8px; align-items: center; }
.se-row .se-num { flex: 0 0 120px; }
.se-row .se-label { flex: 1; }
.se-row input { padding: 9px 12px; border: 1px solid #D8C7B4; border-radius: 8px; font-size: 14px; }
.se-del { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid #D8C7B4; background: #fff; color: #5C1A2B; font-size: 18px; line-height: 1; cursor: pointer; }
.se-del:hover { background: #5C1A2B; color: #fff; }
.se-preview .stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 8px; }

.empty { color: #938A8D; font-size: 13px; padding: 10px 4px; }

/* ---------- 招商留言 ---------- */
.msg-list { display: grid; gap: 14px; }
.msg-card { background: #fff; border: 1px solid #E7DED6; border-radius: 14px; padding: 16px 18px; }
.msg-card.unread { border-color: #B0413E; box-shadow: 0 6px 20px -12px rgba(176,65,62,0.4); }
.msg-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-top strong { color: #3C1019; font-size: 15px; }
.msg-intent { font-size: 12px; color: #fff; background: #5C1A2B; padding: 2px 10px; border-radius: 999px; }
.msg-top time { margin-left: auto; font-size: 12px; color: #938A8D; }
.msg-phone { margin: 8px 0; font-size: 13px; color: #5A4F53; }
.msg-msg { font-size: 14px; color: #1C1418; line-height: 1.7; white-space: pre-wrap; }
.msg-del { margin-left: auto; border: 1px solid #E7DED6; background: #fff; color: #B0413E; font-size: 12px; padding: 3px 12px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.msg-del:hover { background: #B0413E; color: #fff; border-color: #B0413E; }

/* ---------- 表单成功提示 ---------- */
.form-ok { background: #fff; border: 1px solid #C19A4B; border-radius: 14px; padding: 22px; text-align: center; color: #5C1A2B; font-size: 16px; font-weight: 600; }

/* ---------- 图片裁剪弹窗 ---------- */
.crop-modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.crop-overlay { position: absolute; inset: 0; background: rgba(28,20,24,0.7); }
.crop-box { position: relative; background: #fff; border-radius: 18px; width: 90vw; max-width: 700px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5); }
.crop-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid #E7DED6; font-family: "Noto Serif SC", serif; font-weight: 700; font-size: 16px; color: #3C1019; }
.crop-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #938A8D; line-height: 1; }
.crop-close:hover { color: #C0392B; }
.crop-body { flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #F4EDE3; padding: 16px; min-height: 300px; }
.crop-body canvas { max-width: 100%; max-height: 55vh; cursor: move; border-radius: 8px; box-shadow: 0 8px 30px -10px rgba(28,20,24,0.3); }
.crop-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid #E7DED6; }
.crop-foot span { flex: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .admin-cols.long-cols { grid-template-columns: 1fr; }
  img-row, .img-row { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .admin-cols { grid-template-columns: 1fr; }
  /* 侧边栏改为抽屉 */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-menu-toggle { display: inline-flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 60; background: #5C1A2B; color: #fff; border: none; border-radius: 10px; padding: 11px 16px; font-size: 14px; font-family: inherit; font-weight: 600; margin: 12px; cursor: pointer; }
  .admin-side { position: fixed; top: 0; left: 0; bottom: 0; width: 78%; max-width: 300px; z-index: 120; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 30px 0 60px -20px rgba(0,0,0,0.4); padding-top: 24px; }
  .admin-side.open { transform: translateX(0); }
  .admin-side-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 110; }
  .admin-side-backdrop.show { display: block; }
  .admin-menu { flex-direction: column; }
  .btn-logout { width: 100%; margin-top: auto; }
  .preview-stage { height: 70vh; }
  .preview-toolbar { gap: 8px; }
  .device-tabs button span { display: none; }
  .device-tabs button { padding: 7px; }
  .preview-framebox { padding: 10px; }
  .admin-main { padding: 14px 14px 40px; }
  .editor { padding: 16px 14px; }
  .img-row { flex-wrap: wrap; }
  .sf-block { padding: 16px 14px; }
  .pane-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .pane-head .btn { width: 100%; }
  table { font-size: 13px; }
  .crop-box { width: 94vw; }
}
@media (max-width: 420px) {
  .admin-main { padding: 10px 10px 30px; }
  .login-box { width: 92vw; padding: 36px 22px 30px; }
}
