:root {
  --bs-primary: #0d6efd;
  --price-up: #dc3545;
  --price-down: #198754;
  --jd-orange: #f40;
  --tmall-red: #ff0036;
  --brand-nav-bg: #f8f9fa;
  --brand-nav-active: #0d6efd;
  --sidebar-bg: #fff;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  position: relative;
  background-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Ctext x='160' y='110' font-size='17' fill='%23888' fill-opacity='0.14' text-anchor='middle' transform='rotate(-26 160 110)'%3Exianbaobaba.com%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}
/* ============ 品牌导航栏 ============ */
.brand-nav {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand-nav .navbar-brand {
  color: #333;
  font-size: 1.1rem;
}

.brand-nav .navbar-brand i {
  color: var(--bs-primary);
}

.brand-nav .nav-link {
  color: #555;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin: 0 2px;
}

.brand-nav .nav-link:hover {
  color: var(--bs-primary);
  background-color: rgba(13, 110, 253, 0.06);
}

.brand-nav .nav-link.active {
  color: #fff !important;
  background-color: var(--bs-primary) !important;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

.brand-nav .navbar-toggler {
  border: none;
  padding: 0.3rem;
}

.brand-nav .navbar-toggler:focus {
  box-shadow: none;
}

/* 移动端型号选择按钮 */
.mobile-model-toggle {
  display: none;
  margin-left: 0.5rem;
}

/* ============ 左侧侧边栏 ============ */
.left-sidebar {
  padding-right: 8px;
}

.sidebar-card {
  background-color: var(--sidebar-bg);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--card-shadow);
  border: 1px solid #e9ecef;
}

.sidebar-title {
  color: #333;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.sidebar-title i {
  color: var(--bs-primary);
  margin-right: 4px;
}

/* 品牌列表 */
.brand-list-group .list-group-item {
  border: none;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  border-radius: 6px;
  margin-bottom: 3px;
  transition: all 0.15s ease;
}

.brand-list-group .list-group-item:hover {
  background-color: rgba(13, 110, 253, 0.05);
  color: var(--bs-primary);
}

.brand-list-group .list-group-item.active {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
  font-weight: 500;
}

.brand-list-group .list-group-item i {
  color: #adb5bd;
  font-size: 0.75rem;
  margin-right: 6px;
}

.brand-list-group .list-group-item.active i {
  color: rgba(255,255,255,0.8);
}

/* 型号列表 */
.model-list-group {
  max-height: 500px;
  overflow-y: auto;
}

.model-list-group .list-group-item {
  border: none;
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem;
  border-radius: 6px;
  margin-bottom: 3px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.model-list-group .list-group-item:hover {
  background-color: rgba(13, 110, 253, 0.06);
  transform: translateX(2px);
}

.model-list-group .list-group-item.active {
  background-color: #e7f1ff;
  color: var(--bs-primary);
  border-left: 3px solid var(--bs-primary);
  font-weight: 600;
}

.model-list-group .list-group-item .text-danger,
.model-list-group .list-group-item .text-success {
  font-size: 0.75rem;
}

/* ============ 右侧内容区 ============ */
.right-content {
  padding-left: 8px;
}

.model-card {
  border: none;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  background: #fff;
  overflow: hidden;
}

.model-card .card-header {
  background-color: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 1rem 1.25rem;
}

.model-card .card-header h5 {
  color: #333;
  font-weight: 600;
}

.model-card .card-header h5 i {
  color: var(--bs-primary);
  margin-right: 6px;
}

.model-card .card-body {
  padding: 1.25rem;
}

.model-card .card-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #f0f0f0;
  font-size: 0.82rem;
}

/* 平均涨跌徽章 */
.avg-change .badge {
  font-size: 0.82rem;
  padding: 0.4rem 0.7rem;
  border-radius: 20px;
}

/* ============ 规格表格 ============ */
.spec-table {
  font-size: 0.88rem;
  margin-bottom: 0;
}

.spec-table thead th {
  background-color: #f8f9fa;
  color: #555;
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 2px solid #dee2e6;
  padding: 0.75rem 0.6rem;
  white-space: nowrap;
}

.spec-table tbody td {
  padding: 0.8rem 0.6rem;
  vertical-align: middle;
  white-space: nowrap;
}

.spec-table tbody tr:hover {
  background-color: #f8f9fa;
}

/* 涨跌颜色 */
.price-up {
  color: var(--price-up) !important;
}

.price-down {
  color: var(--price-down) !important;
}

/* 走势图按钮 */
.trend-btn {
  border-radius: 6px;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  transition: all 0.2s ease;
}

.trend-btn:hover {
  background-color: var(--bs-primary);
  color: #fff;
}

.trend-btn i {
  font-size: 0.75rem;
  margin-right: 2px;
}

/* ============ 京东/天猫按钮 ============ */
.btn-jd {
  background-color: var(--jd-orange);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-right: 6px;
}

.btn-jd:hover {
  background-color: #e63a00;
  color: #fff;
  transform: scale(1.08);
}

.btn-tmall {
  background-color: var(--tmall-red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-tmall:hover {
  background-color: #e60030;
  color: #fff;
  transform: scale(1.08);
}

.btn-jd i,
.btn-tmall i {
  font-size: 0.75rem;
}

/* ============ 空状态 ============ */
.empty-state {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 3rem 1rem;
}

/* ============ 小部件 ============ */
.price-widget .widget-title {
  font-size: 1rem;
  color: #333;
  border-bottom: 2px solid var(--bs-primary);
  padding-bottom: 0.5rem;
  display: inline-block;
}

.price-widget .list-group-item {
  border-color: #f0f0f0;
  padding: 0.75rem 0;
}

.price-widget .list-group-item:first-child {
  border-top: none;
}

.price-widget-empty {
  color: #999;
  font-size: 0.9rem;
}

/* ============ Modal ============ */
#trendModal .modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

#trendModal .modal-header {
  border-bottom: 1px solid #f0f0f0;
  padding: 1rem 1.25rem;
}

#trendModal .modal-header .modal-title {
  font-weight: 600;
  font-size: 1rem;
}

#trendModal .modal-header .modal-title i {
  color: var(--bs-primary);
  margin-right: 6px;
}

#trendModal .btn-close {
  font-size: 0.75rem;
}

/* ============ 响应式适配 ============ */
@media (max-width: 767.98px) {
  .mobile-model-toggle {
    display: inline-block;
  }

  .left-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1050;
    background: #fff;
    padding: 1rem;
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }

  .left-sidebar.show {
    left: 0;
  }

  .right-content {
    padding-left: 0;
    width: 100%;
  }

  .brand-nav .navbar-brand {
    font-size: 1rem;
  }

  .brand-nav .nav-link {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
  }

  .model-card .card-header {
    padding: 0.75rem 1rem;
  }

  .model-card .card-header h5 {
    font-size: 0.95rem;
  }

  .model-card .card-body {
    padding: 0.75rem;
  }

  .avg-change .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }

  .spec-table {
    font-size: 0.8rem;
  }

  .spec-table thead th,
  .spec-table tbody td {
    padding: 0.5rem 0.4rem;
  }

  /* 移动端表格水平滚动 */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive .spec-table {
    min-width: 600px;
  }

  /* 移动端表格更紧凑 */
  .spec-table thead th,
  .spec-table tbody td {
    padding: 0.4rem 0.3rem;
    font-size: 0.75rem;
  }

  .spec-table .badge {
    font-size: 0.7rem;
    padding: 0.2em 0.4em;
  }

  .trend-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.35rem;
  }

  .btn-jd, .btn-tmall {
    width: 24px;
    height: 24px;
    margin-right: 3px;
  }

  .btn-jd i, .btn-tmall i {
    font-size: 0.65rem;
  }

  .btn-jd, .btn-tmall {
    width: 28px;
    height: 28px;
  }

  .trend-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .trend-btn .d-none {
    display: none !important;
  }

  .model-card .card-footer {
    font-size: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .sidebar-card {
    padding: 0.75rem;
  }

  .sidebar-title {
    font-size: 0.85rem;
  }

  .model-list-group .list-group-item {
    padding: 0.6rem 0.7rem;
    font-size: 0.85rem;
  }

  .brand-list-group .list-group-item {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }
}

/* 移动端侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1040;
}

.sidebar-overlay.show {
  display: block;
}

/* 滚动条美化 */
.model-list-group::-webkit-scrollbar {
  width: 5px;
}

.model-list-group::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.model-list-group::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.model-list-group::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* 容器适配 */
.container-fluid {
  max-width: 1100px;
}

/* 表格内 badge */
.spec-table .badge {
  font-size: 0.78rem;
  padding: 0.35em 0.65em;
}

/* card hover 效果 */
.model-card {
  transition: box-shadow 0.3s ease;
}

.model-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 更小的屏幕 */
@media (max-width: 575.98px) {
  .brand-nav .navbar-brand {
    font-size: 0.9rem;
  }

  .model-card .card-header h5 {
    font-size: 0.85rem;
  }

  .spec-table {
    font-size: 0.75rem;
  }

  .spec-table thead th,
  .spec-table tbody td {
    padding: 0.4rem 0.3rem;
  }

  .spec-table .badge {
    font-size: 0.7rem;
  }

  .trend-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
}
