/* 德力西选型查询系统 样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f5f6f8; color: #222; font-size: 14px; }
a { color: #d11515; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: #d11515; color: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.topbar .brand { font-size: 20px; font-weight: bold; color: #fff; }
.searchbox { flex: 1; min-width: 260px; display: flex; }
.searchbox input { flex: 1; border: none; border-radius: 4px 0 0 4px; padding: 9px 12px; font-size: 14px; outline: none; }
.searchbox button { border: none; background: #a10d0d; color: #fff; padding: 0 22px; border-radius: 0 4px 4px 0; cursor: pointer; }

.layout { display: flex; gap: 16px; padding: 16px; align-items: flex-start; }
.sidebar { width: 260px; background: #fff; border-radius: 8px; padding: 14px; flex-shrink: 0; }
.sidebar h3 { margin-bottom: 10px; font-size: 15px; }
.cattree { list-style: none; }
.cattree ul { list-style: none; padding-left: 14px; }
.cattree a { display: block; padding: 6px 8px; color: #333; border-radius: 4px; }
.cattree a:hover { background: #f7eaea; text-decoration: none; }
.cattree a.active { background: #d11515; color: #fff; }
.cat-l1 > a { font-weight: bold; }

.main { flex: 1; min-width: 0; }
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.series-card { background: #fff; border-radius: 8px; padding: 14px; display: block; color: #333; border: 1px solid #eee; }
.series-card:hover { border-color: #d11515; text-decoration: none; box-shadow: 0 2px 8px rgba(209,21,21,.12); }
.series-card img { max-width: 100%; height: 90px; object-fit: contain; display: block; margin: 0 auto 8px; }
.sc-name { font-weight: bold; }
.sc-meta { color: #999; font-size: 12px; margin-top: 4px; }
.empty { color: #999; padding: 30px; text-align: center; }

.breadcrumb { color: #888; margin-bottom: 10px; }
.xuan-panel { background: #fff; border-radius: 8px; padding: 20px; }
.xuan-head { display: flex; gap: 20px; border-bottom: 1px solid #eee; padding-bottom: 16px; margin-bottom: 16px; }
.xuan-img { width: 140px; height: 140px; object-fit: contain; border: 1px solid #f0f0f0; border-radius: 6px; background: #fafafa; }
.xuan-info h2 { font-size: 20px; margin-bottom: 10px; }
.xuan-row { margin: 6px 0; color: #555; }
.price-row { font-size: 15px; }
.price-row .disc { margin-left: 16px; color: #888; }
.price-row .final { margin-left: 16px; }
.red { color: #d11515; font-size: 20px; }
.disc-input { width: 76px; padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 15px; text-align: center; }
.disc-input:focus { outline: none; border-color: #d11515; }

/* ============ 移动端适配 ============ */
@media (max-width: 768px) {
  body { font-size: 13px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar .brand { font-size: 16px; }
  .searchbox input { padding: 10px 12px; font-size: 16px; } /* 16px 防止 iOS 聚焦缩放 */
  .layout { flex-direction: column; padding: 10px; gap: 10px; }
  .sidebar { width: 100%; }
  .cattree ul { padding-left: 10px; }
  .cattree a { padding: 10px 8px; }               /* 触控目标加大 */
  .series-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .series-card { padding: 10px; }
  .series-card img { height: 64px; }
  .sc-name { font-size: 13px; }
  .xuan-panel { padding: 14px; }
  .xuan-head { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
  .xuan-img { width: 110px; height: 110px; }
  .xuan-info { width: 100%; }
  .xuan-info h2 { font-size: 17px; }
  .price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .price-row .disc, .price-row .final { margin-left: 0; }
  .red { font-size: 18px; }
  .props .items { gap: 6px; }
  .props .item { padding: 10px 14px; }            /* 触控目标加大 */
  .prop-plain { font-size: 12px; }
  .ptable { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .two-col { flex-direction: column; }
  .admin-wrap { margin: 10px; padding: 14px; }
  .login-box { margin: 40px 12px; }
}

.props .prop { margin-bottom: 14px; }
.props .prop-name { font-weight: bold; margin-bottom: 8px; color: #333; }
.props .items { display: flex; flex-wrap: wrap; gap: 8px; }
.props .item { border: 1px solid #ddd; background: #fafafa; border-radius: 4px; padding: 7px 16px; cursor: pointer; user-select: none; }
.props .item:hover { border-color: #d11515; color: #d11515; }
.props .item.selected { background: #d11515; border-color: #d11515; color: #fff; }
.props .item.disabled { color: #bbb; background: #f5f5f5; cursor: not-allowed; border-color: #eee; }
.props .prop-plain { color: #666; font-size: 13px; margin-bottom: 10px; }

.attach-panel { background: #fff; border-radius: 8px; padding: 16px; margin-top: 16px; }
.attach-panel h3 { margin-bottom: 12px; }

.ptable { width: 100%; background: #fff; border-collapse: collapse; margin: 10px 0; }
.ptable th, .ptable td { border: 1px solid #eee; padding: 9px 12px; text-align: left; }
.ptable th { background: #fafafa; }
.ptable .r { text-align: right; }
.ptable tr:hover td { background: #fdf7f7; }

.admin-wrap { max-width: 900px; margin: 20px auto; background: #fff; border-radius: 8px; padding: 24px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
fieldset { border: 1px solid #eee; border-radius: 8px; margin-bottom: 18px; padding: 14px 18px; }
legend { font-weight: bold; padding: 0 8px; }
.inline-form input[type=number] { width: 90px; padding: 6px; }
button { background: #d11515; color: #fff; border: none; border-radius: 4px; padding: 8px 20px; cursor: pointer; }
button:hover { background: #a10d0d; }
.hint { color: #999; margin-left: 12px; font-size: 12px; }
.ok { color: #0a7d32; background: #e8f6ee; padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; }
.error { color: #c00; background: #fdeaea; padding: 8px 12px; border-radius: 4px; }
.two-col { display: flex; gap: 24px; }
.two-col > div { flex: 1; }
.sort-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.sort-row input { width: 80px; padding: 4px 8px; }

.login-box { max-width: 360px; margin: 80px auto; background: #fff; border-radius: 8px; padding: 30px; }
.login-box h2 { margin-bottom: 18px; font-size: 18px; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid #ddd; border-radius: 4px; }
.login-box button { width: 100%; padding: 10px; }

/* ============ 折扣信息行 / 设置面板 / 悬浮价格条 ============ */
.disc-info {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  background: #f7f8fa; border: 1px solid #f0f1f3; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; cursor: pointer; user-select: none;
}
.disc-info:hover { background: #fdf2f2; }
.di-badge { color: #d11515; background: #fdf2f2; border-radius: 4px; padding: 2px 8px; font-size: 12px; font-weight: bold; }
.di-val { color: #d11515; font-weight: bold; font-size: 14px; }
.di-cat { color: #b8bfc9; font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.di-none { color: #86909c; flex: 1; }
.di-link { color: #d11515; font-weight: bold; }

/* 设置面板（桌面居中弹窗，移动端近全屏底部） */
.dp-mask {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000;
}
.dp-mask.open { display: block; }
.dp-panel {
  display: none; position: fixed; z-index: 1001;
  left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 420px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 14px; padding: 22px 22px 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
}
.dp-panel.open { display: block; }
.dp-head { display: flex; justify-content: space-between; align-items: center; }
.dp-title { font-size: 17px; font-weight: bold; }
.dp-close { color: #b8bfc9; cursor: pointer; font-size: 16px; padding: 2px 6px; }
.dp-close:hover { color: #d11515; }
.dp-cat {
  display: inline-block; margin-top: 14px; font-size: 13px; font-weight: bold;
  color: #d11515; background: #fdf2f2; border-radius: 6px; padding: 8px 12px;
}
.dp-path { color: #b8bfc9; font-size: 12px; margin-top: 8px; word-break: break-all; }
.dp-sub { color: #999; font-size: 12px; margin-top: 10px; }
.dp-opts { display: flex; flex-wrap: wrap; margin-top: 14px; }
.dp-opt {
  padding: 7px 20px; border-radius: 999px; font-size: 13px;
  background: #f7f8fa; border: 1px solid #f0f1f3; margin: 0 10px 10px 0;
  cursor: pointer; user-select: none;
}
.dp-opt:hover { border-color: #d11515; color: #d11515; }
.dp-opt.on { background: #d11515; border-color: #d11515; color: #fff; font-weight: bold; }
.dp-input-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; font-size: 14px;
}
.dp-input {
  width: 120px; border: 1px solid #ddd; border-radius: 8px; padding: 9px 12px;
  font-size: 16px; font-weight: bold; text-align: center; color: #d11515; background: #fafafa;
}
.dp-input:focus { outline: none; border-color: #d11515; }
.dp-btns { display: flex; gap: 12px; margin-top: 20px; }
.dp-btn { flex: 1; text-align: center; line-height: 40px; border-radius: 999px; font-size: 14px; cursor: pointer; border: none; }
.dp-btn.primary { background: linear-gradient(135deg,#e32626 0%,#d11515 55%,#a90f0f 100%); color: #fff; }
.dp-btn.primary:hover { filter: brightness(1.06); }
.dp-btn.ghost { border: 1px solid #e5e6eb; color: #86909c; background: #fff; }

/* 悬浮价格条（半透明毛玻璃，下滑出现） */
.float-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(209,21,21,.10);
  box-shadow: 0 2px 12px rgba(31,35,41,.06);
  transform: translateY(-120%); transition: transform .25s ease;
  cursor: pointer;
}
.float-bar.show { transform: translateY(0); }
.fb-left { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.fb-label { color: #b8bfc9; font-size: 12px; }
.fb-price { color: #86909c; font-size: 14px; font-weight: bold; }
.fb-disc { color: #d11515; font-size: 14px; font-weight: bold; }
.fb-right { color: #86909c; font-size: 13px; white-space: nowrap; }
.fb-final { color: #d11515; font-size: 20px; font-weight: bold; margin: 0 2px; }

@media (max-width: 768px) {
  .dp-panel {
    left: 0; right: 0; bottom: 0; top: auto; transform: none;
    width: 100%; max-width: none;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .disc-info { font-size: 13px; padding: 12px 14px; }
}

/* ============ 移动端分类抽屉（列表收进抽屉，商品/搜索结果置顶） ============ */
.cat-toggle { display: none; }
.cat-mask { display: none; }
@media (max-width: 768px) {
  .cat-toggle {
    display: flex; align-items: center; gap: 8px;
    margin: 10px 10px 0; padding: 12px 16px;
    background: #fff; border: 1px solid #eee; border-radius: 8px;
    font-size: 15px; font-weight: bold; color: #333; cursor: pointer;
  }
  .cat-toggle span { color: #d11515; font-size: 17px; }
  .cat-mask.open {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1090;
  }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 80%; max-width: 320px; margin: 0; border-radius: 0;
    z-index: 1100; overflow-y: auto;
    transform: translateX(-105%); transition: transform .25s ease;
  }
  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }
  body.drawer-open { overflow: hidden; }
}

/* ============ 折扣输入框 / 价格区统一设计（电脑+移动） ============ */
.disc-input {
  width: 86px; padding: 8px 10px;
  border: 1.5px solid #f0c0c0; border-radius: 10px;
  font-size: 17px; font-weight: bold; text-align: center; color: #d11515;
  background: #fff8f8; transition: border-color .15s, background .15s;
}
.disc-input:focus { outline: none; border-color: #d11515; background: #fff; }
.price-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin-top: 10px; padding: 12px 16px;
  background: #fdf5f5; border: 1px solid #f7e3e3; border-radius: 12px;
}
.price-row .disc { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.price-row .final { display: inline-flex; align-items: baseline; gap: 4px; margin-left: 0; }
.dp-input {
  width: 130px; border: 1.5px solid #f0c0c0; border-radius: 10px; padding: 10px 12px;
  font-size: 18px; font-weight: bold; text-align: center; color: #d11515; background: #fff8f8;
}
.dp-input:focus { outline: none; border-color: #d11515; background: #fff; }

/* ============ 抽屉关闭按钮 ============ */
.drawer-close { display: none; }
@media (max-width: 768px) {
  .drawer-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: #f4f5f7; color: #86909c; font-size: 14px; cursor: pointer;
  }
  .drawer-close:active { color: #d11515; background: #fdf2f2; }
  .sidebar h3 { display: flex; justify-content: space-between; align-items: center; }
}

/* ============ 电脑端样式打磨 ============ */
@media (min-width: 769px) {
  .layout { max-width: 1280px; margin: 0 auto; width: 100%; }
  .topbar { position: sticky; top: 0; z-index: 800; }
  .xuan-panel { padding: 28px 32px; box-shadow: 0 1px 6px rgba(31,35,41,.05); }
  .series-card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .series-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(209,21,21,.10); }
  .sidebar { box-shadow: 0 1px 6px rgba(31,35,41,.05); }
}

/* ============ 电脑端折扣设置面板打磨 ============ */
@media (min-width: 769px) {
  .dp-panel { width: 460px; padding: 26px 28px 24px; }
  .dp-title { font-size: 18px; }
  .dp-cat { font-size: 14px; padding: 9px 14px; }
  .dp-opts { margin-top: 18px; }
  .dp-opt { padding: 9px 28px; font-size: 14px; }
  .dp-input-row {
    margin-top: 14px; padding: 14px 16px;
    background: #fafafa; border-radius: 12px; font-size: 15px;
  }
  .dp-input { width: 140px; font-size: 20px; padding: 10px 14px; }
  .dp-btns { margin-top: 24px; }
  .dp-btn { line-height: 44px; font-size: 15px; }
}

/* ============ 分类树点击展开 ============ */
.cattree li { position: relative; }
.cattree li ul { display: none; }                 /* 子级默认收起 */
.cattree li.expanded > ul { display: block; }     /* 点击后展开 */
.cat-arrow {
  position: absolute; left: -2px; top: 50%;
  width: 18px; height: 18px; margin-top: -9px;
  cursor: pointer; user-select: none;
  transition: transform .2s ease;
}
.cat-arrow::before {
  content: ''; display: block; margin: 5px;
  border: solid #b8bfc9; border-width: 2px 2px 0 0;
  width: 6px; height: 6px;
  transform: rotate(45deg);          /* 默认 ▸ */
  transition: transform .2s ease, border-color .2s ease;
}
.cattree li.expanded > .cat-arrow::before { transform: rotate(135deg); border-color: #d11515; } /* 展开 ▾ */
.cat-arrow:hover::before { border-color: #d11515; }
.cattree li.has-children > a { padding-left: 20px; }  /* 给箭头留位 */
.cattree li.has-children > a.active { padding-left: 20px; }

/* ============ 折扣系数输入框精细样式 ============ */
.disc-input, .dp-input {
  -moz-appearance: textfield;
  appearance: textfield;
  caret-color: #d11515;
  box-shadow: inset 0 1px 2px rgba(209,21,21,.05);
}
.disc-input::-webkit-outer-spin-button,
.disc-input::-webkit-inner-spin-button,
.dp-input::-webkit-outer-spin-button,
.dp-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.disc-input:focus, .dp-input:focus {
  border-color: #d11515;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(209,21,21,.12);   /* 聚焦红色光圈 */
  outline: none;
}

/* ============ 修正分类箭头位置：对齐第一行（而非整个 li 垂直居中） ============ */
.cat-arrow { top: 7px; margin-top: 0; }               /* 桌面：行高 6+20+6=32，箭头 18px → 顶部 7px */
@media (max-width: 768px) {
  .cat-arrow { top: 12px; }                            /* 移动端：行高 10+20+10=40 → 顶部 12px */
}

/* ============ 折扣系数输入框（dp-input）与折扣输入框（disc-input）样式完全统一 ============ */
.disc-input, .dp-input {
  border: 1.5px solid #f0c0c0; border-radius: 10px;
  font-size: 17px; font-weight: bold; text-align: center; color: #d11515;
  background: #fff8f8; padding: 8px 10px;
  box-sizing: border-box;
  -moz-appearance: textfield; appearance: textfield;
  caret-color: #d11515;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.disc-input:focus, .dp-input:focus {
  border-color: #d11515; background: #fff;
  box-shadow: 0 0 0 3px rgba(209,21,21,.12); outline: none;
}
/* 面板里的系数输入框只保留宽度差异，其余视觉完全一致 */
.dp-input { width: 130px; }
