/* ============================================================
   电商平台竞品店铺数据追踪系统 - 公共样式
   扁平化橙白配色 / 移动端+PC端自适应
   本程序由【小马克程序定制】设计与制作，如有售后和开发需求，官网：https://xiaomaker.cn
   ============================================================ */

:root {
  --orange: #ff6a00;
  --orange-dark: #e85d00;
  --orange-light: #ff8c33;
  --orange-bg: #fff5ea;
  --orange-border: #ffd9a8;
  --white: #ffffff;
  --gray-1: #f7f7f9;
  --gray-2: #eceef1;
  --gray-3: #d0d4da;
  --gray-text: #6b7280;
  --text: #1f2329;
  --text-sub: #8a8f99;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --shadow: 0 2px 12px rgba(255, 106, 0, .08);
  --radius: 10px;
  --nav-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-1);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dark); }
img { max-width: 100%; display: block; }

/* ============ 导航栏 ============ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--orange-border);
  box-shadow: var(--shadow);
}
.navbar .nav-inner {
  max-width: 1200px; margin: 0 auto; height: 100%;
  padding: 0 18px; display: flex; align-items: center; justify-content: space-between;
}
.navbar .logo {
  font-size: 17px; font-weight: 700; color: var(--orange); white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.navbar .logo .logo-dot {
  width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--orange), var(--orange-light));
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 800;
}
.navbar .menu { display: flex; align-items: center; gap: 4px; }
.navbar .menu a {
  padding: 8px 14px; border-radius: 8px; color: var(--text); font-weight: 500;
  transition: all .18s;
}
.navbar .menu a:hover { background: var(--orange-bg); color: var(--orange); }
.navbar .menu a.active { background: var(--orange); color: #fff; }
.navbar .nav-toggle { display: none; }

/* ============ 容器 ============ */
.container { max-width: 1200px; margin: 0 auto; padding: 22px 18px 60px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head .sub { color: var(--text-sub); font-size: 13px; margin-top: 4px; }

/* ============ 卡片 ============ */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 16px; }

/* ============ 网格 ============ */
.grid { display: grid; gap: 16px; }
.grid-shop { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-prod { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ============ 店铺卡片 ============ */
.shop-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; text-align: center; cursor: pointer; transition: transform .18s, box-shadow .18s;
  border: 1px solid transparent;
}
.shop-card:hover { transform: translateY(-3px); border-color: var(--orange-border); box-shadow: 0 8px 24px rgba(255,106,0,.14); }
.shop-card .avatar {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px;
  background: var(--orange-bg); object-fit: cover; border: 2px solid var(--orange-border);
}
.shop-card .avatar-ph {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px;
  background: var(--orange-bg); color: var(--orange); font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--orange-border);
}
.shop-card .name { font-weight: 600; font-size: 15px; color: var(--text); }
.shop-card .display-name { color: var(--text-sub); font-size: 12px; margin-top: 2px; }
.shop-card .meta { display: flex; justify-content: center; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--gray-text); }
.shop-card .tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--orange-bg); color: var(--orange); margin-top: 8px;
}

/* ============ 商品卡片 ============ */
.prod-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer; transition: transform .18s, box-shadow .18s;
  border: 1px solid transparent;
}
.prod-card:hover { transform: translateY(-3px); border-color: var(--orange-border); }
.prod-card .thumb {
  width: 100%; aspect-ratio: 1/1; background: var(--gray-2); object-fit: cover;
}
.prod-card .thumb-ph { width: 100%; aspect-ratio: 1/1; background: var(--gray-2); display: flex; align-items: center; justify-content: center; color: var(--text-sub); font-size: 13px; }
.prod-card .body { padding: 10px 12px 12px; }
.prod-card .title { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 40px; }
.prod-card .price { color: var(--orange); font-weight: 700; margin-top: 6px; font-size: 15px; }
.prod-card .meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-sub); }

/* ============ 统计块 ============ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-box {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; border-left: 3px solid var(--orange);
}
.stat-box .num { font-size: 24px; font-weight: 700; color: var(--orange); }
.stat-box .label { color: var(--text-sub); font-size: 12px; margin-top: 2px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--gray-2); font-size: 13px; }
table.tbl th { background: var(--orange-bg); color: var(--text); font-weight: 600; white-space: nowrap; }
table.tbl tr:hover td { background: #fffaf5; }
table.tbl td.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 标签徽章 ============ */
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 20px; line-height: 1.6; }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-green { background: #e7f7ee; color: var(--green); }
.badge-gray { background: var(--gray-2); color: var(--gray-text); }
.badge-red { background: #fdeaea; color: var(--red); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; padding: 9px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 500; transition: all .18s; white-space: nowrap;
  background: var(--gray-2); color: var(--text);
}
.btn:hover { opacity: .9; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: #fff; border: 1px solid var(--orange-border); color: var(--orange); }
.btn-outline:hover { background: var(--orange-bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: #fdeaea; color: var(--red); }
.btn-block { width: 100%; }

/* ============ 输入框 ============ */
.input, .select, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--gray-3); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #fff; outline: none; transition: border .18s;
  font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--orange); }
textarea.input { resize: vertical; min-height: 80px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text); font-size: 13px; }

/* ============ 搜索栏 ============ */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .input { flex: 1; min-width: 160px; }

/* ============ 分页 ============ */
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager .btn { min-width: 38px; }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 50px 20px; color: var(--text-sub); }
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ============ 评分星 ============ */
.stars { color: var(--orange); letter-spacing: 1px; }
.stars .off { color: var(--gray-3); }

/* ============ 加载 ============ */
.loading { text-align: center; padding: 30px; color: var(--text-sub); }
.dot-loading { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--orange-border); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 标签页 ============ */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--gray-2); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; color: var(--text-sub); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ============ 商品详情历史时间线 ============ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--orange-border); }
.timeline .item { position: relative; margin-bottom: 16px; }
.timeline .item::before { content: ''; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--orange-border); }

/* ============ 图集 ============ */
.img-gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.img-gallery img, .img-gallery .img-ph {
  width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gray-2); background: var(--gray-2); cursor: pointer;
}
.img-ph { display: flex; align-items: center; justify-content: center; color: var(--text-sub); font-size: 11px; }

/* ============ 柱状图(纯CSS) ============ */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 0 4px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-chart .bar { width: 70%; background: linear-gradient(var(--orange), var(--orange-light)); border-radius: 6px 6px 0 0; min-height: 2px; transition: height .3s; }
.bar-chart .bar-label { font-size: 10px; color: var(--text-sub); white-space: nowrap; }

/* ============ 行分布 ============ */
.star-dist { display: flex; flex-direction: column; gap: 6px; }
.star-dist .row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.star-dist .row .lbl { width: 46px; color: var(--orange); }
.star-dist .row .track { flex: 1; height: 10px; background: var(--gray-2); border-radius: 6px; overflow: hidden; }
.star-dist .row .fill { height: 100%; background: var(--orange); border-radius: 6px; }
.star-dist .row .cnt { width: 40px; text-align: right; color: var(--text-sub); }

/* ============ 模态框 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal .modal-head { padding: 16px 20px; border-bottom: 1px solid var(--gray-2); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal .modal-body { padding: 20px; }
.modal .modal-foot { padding: 14px 20px; border-top: 1px solid var(--gray-2); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close-btn { cursor: pointer; color: var(--text-sub); font-size: 20px; line-height: 1; background: none; border: none; }

/* ============ 后台布局 ============ */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side { width: 200px; background: #1f2329; color: #cbd0d8; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .side-logo { padding: 18px; font-size: 16px; font-weight: 700; color: var(--orange); border-bottom: 1px solid #2a2f37; display: flex; align-items: center; gap: 8px; }
.admin-side .side-menu a { display: block; padding: 12px 18px; color: #cbd0d8; border-left: 3px solid transparent; transition: all .15s; }
.admin-side .side-menu a:hover { background: #2a2f37; color: #fff; }
.admin-side .side-menu a.active { background: #2a2f37; color: var(--orange); border-left-color: var(--orange); }
.admin-main { flex: 1; min-width: 0; background: var(--gray-1); }
.admin-top { height: var(--nav-h); background: #fff; border-bottom: 1px solid var(--gray-2); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.admin-top .crumb { font-size: 15px; font-weight: 600; }
.admin-content { padding: 20px; }

/* ============ 后台技术支持 ============ */
.tech-support {
  position: fixed; right: 14px; bottom: 14px; z-index: 150; text-align: center;
}
.tech-support .ts-text { font-size: 12px; color: var(--text-sub); cursor: help; padding: 4px 8px; }
.tech-support .ts-tip {
  display: none; position: absolute; bottom: 24px; right: 0; width: 240px;
  background: #1f2329; color: #fff; padding: 12px; border-radius: 8px; font-size: 12px; line-height: 1.7; text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.tech-support:hover .ts-tip { display: block; }
.tech-support .ts-tip a { color: var(--orange-light); }

/* ============ 登录页 ============ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #fff5ea 0%, #ffe7cf 100%); padding: 20px; }
.login-box { background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(255,106,0,.18); padding: 34px; width: 100%; max-width: 380px; }
.login-box .lb-logo { text-align: center; margin-bottom: 22px; }
.login-box .lb-logo .dot { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, var(--orange), var(--orange-light)); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 800; }
.login-box .lb-logo h2 { font-size: 18px; color: var(--text); }
.login-box .lb-logo p { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.login-tip { text-align: center; margin-top: 14px; font-size: 12px; color: var(--text-sub); }
.login-tip b { color: var(--orange); }

/* ============ API文档 ============ */
.api-block { border: 1px solid var(--gray-2); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.api-block .api-head { background: var(--orange-bg); padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.api-block .method { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; }
.api-block .method.get { background: #dbeafe; color: var(--blue); }
.api-block .method.post { background: #e7f7ee; color: var(--green); }
.api-block .path { font-family: monospace; font-size: 13px; color: var(--text); word-break: break-all; }
.api-block .api-body { padding: 14px 16px; }
.api-block .api-body h4 { margin: 10px 0 6px; font-size: 13px; color: var(--orange); }
.api-block pre { background: #1f2329; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; line-height: 1.6; }
.api-block table.params { width: 100%; font-size: 12px; }
.api-block table.params th, .api-block table.params td { padding: 6px 8px; border-bottom: 1px solid var(--gray-2); text-align: left; }

/* ============ Toast ============ */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 300; padding: 10px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.15); opacity: 0; transition: opacity .25s, top .25s; pointer-events: none; }
.toast.show { opacity: 1; top: 80px; }
.toast.success { background: #e7f7ee; color: var(--green); }
.toast.error { background: #fdeaea; color: var(--red); }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .navbar .nav-toggle { display: flex; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
  .navbar .nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }
  .navbar .menu {
    position: absolute; top: var(--nav-h); left: 0; right: 0; background: #fff; flex-direction: column;
    border-bottom: 1px solid var(--orange-border); box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; transition: max-height .25s; gap: 0;
  }
  .navbar .menu.open { max-height: 320px; }
  .navbar .menu a { padding: 12px 18px; border-radius: 0; }
  .navbar .menu a.active { background: var(--orange-bg); color: var(--orange); }

  .admin-side { width: 64px; }
  .admin-side .side-logo span { display: none; }
  .admin-side .side-menu a { padding: 12px; text-align: center; font-size: 11px; }
}
@media (max-width: 520px) {
  .grid-shop, .grid-prod { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .page-head h1 { font-size: 18px; }
  .stat-box .num { font-size: 20px; }
  .img-gallery img, .img-gallery .img-ph { width: 64px; height: 64px; }
}
