/* 宝视达眼镜售后服务政策指南 - 独立样式表 */
:root {
  /* 宝视达品牌主色（提取自 BestLogo.png） */
  --brand-navy: #191E65;
  --brand-navy-dark: #11154B;
  --brand-navy-light: #2A3185;
  --brand-red: #C30D18;
  --brand-red-soft: #FDF2F3;
  --brand-red-border: #F2BFC3;

  /* 布局尺寸 */
  --topbar-height: 76px;
  --sidebar-width: 260px;

  /* 中性色与冷灰底色 */
  --sidebar-bg: #F4F5F9;
  --sidebar-border: #E5E8F0;
  --table-header-bg: #191E65;
  --table-row-bg: #F6F7FB;
  --table-row-hover: #ECEFF8;
  --text-main: #1C2033;
  --text-secondary: #535A70;
  --text-muted: #8C93A6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background-color: #ffffff;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-color: #ffffff;
}

/* ==================== 顶部一级分类导航栏 ==================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 28px;
  box-shadow: 0 2px 10px rgba(25, 30, 101, 0.04);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 58px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.brand-logo-fallback {
  display: none;
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: 0.5px;
  border-bottom: 3px solid var(--brand-red);
  padding-bottom: 1px;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background-color: #D5DAE8;
}

.brand-portal-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--brand-navy);
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.top-nav-btn {
  position: relative;
  height: 100%;
  background: none;
  border: none;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.top-nav-btn:hover {
  color: var(--brand-navy);
  background-color: #F8F9FC;
}

.top-nav-btn.active {
  color: var(--brand-navy);
  font-weight: 600;
}

.top-nav-btn.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  background-color: var(--brand-red);
  border-radius: 3px 3px 0 0;
}

.top-nav-match {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  background-color: var(--brand-red);
  color: #ffffff;
  line-height: 1;
}

/* 顶部全局搜索框 */
.search-box {
  position: relative;
  flex-shrink: 0;
  width: 240px;
  margin-left: auto;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #8C93A6;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 30px 9px 34px;
  font-size: 13px;
  color: var(--text-main);
  background: #F4F5F9;
  border: 1px solid #DCE0EC;
  border-radius: 20px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px rgba(25, 30, 101, 0.08);
}

.search-input::placeholder {
  color: #9AA1B5;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: none;
  padding: 2px 4px;
}

.search-clear:hover {
  color: var(--brand-red);
}

.search-clear.visible {
  display: block;
}

/* ==================== 下方双栏主体容器 ==================== */
.page-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

/* 左侧固定导航栏（二级导航） */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 32px 24px 40px 34px;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-navy);
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.sidebar-subtitle {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 12px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  color: var(--text-muted);
  padding: 5px 0 5px 12px;
  transition: color 0.18s ease;
  cursor: pointer;
  line-height: 1.45;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background-color: var(--brand-red);
  border-radius: 2px;
  transition: height 0.18s ease;
}

.nav-link:hover {
  color: var(--brand-navy);
}

.nav-link.active {
  color: var(--brand-navy);
  font-weight: 600;
}

.nav-link.active::before {
  height: 16px;
}

.nav-count {
  font-size: 11px;
  color: #B0B6C8;
  font-weight: 400;
  flex-shrink: 0;
}

.nav-link.active .nav-count {
  color: var(--brand-red);
  font-weight: 600;
}

/* ==================== 右侧主内容区 ==================== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 38px 60px 96px 52px;
  max-width: 1120px;
}

.category-banner {
  margin-bottom: 36px;
  padding: 20px 24px;
  background: linear-gradient(90deg, #F4F5FA 0%, #FFFFFF 100%);
  border-left: 4px solid var(--brand-red);
  border-radius: 2px;
}

.category-banner-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 6px;
}

.category-banner-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.policy-section {
  margin-bottom: 56px;
  scroll-margin-top: calc(var(--topbar-height) + 28px);
}

.policy-section.hidden {
  display: none;
}

/* 分区标题行（宝视达深蓝数字徽章 + 标题） */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  background-color: var(--brand-navy);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 2px;
  line-height: 1;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-navy);
  letter-spacing: 0.3px;
}

.section-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-red);
  background-color: var(--brand-red-soft);
  border: 1px solid var(--brand-red-border);
  padding: 2px 8px;
  border-radius: 2px;
}

/* 横向系列 Tab 栏（三级分类） */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 26px;
  margin-bottom: 18px;
  border-bottom: 1px solid #ECEFF5;
}

.tab-btn {
  position: relative;
  background: none;
  border: none;
  padding: 6px 0 11px 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.18s ease;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--brand-navy);
}

.tab-btn.active {
  color: var(--brand-navy);
  font-weight: 600;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2.5px;
  background-color: var(--brand-red);
  border-radius: 2px;
}

/* 表格样式 */
.policy-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.policy-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
  table-layout: fixed;
}

.policy-table thead th {
  background-color: var(--table-header-bg);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 20px;
  text-align: left;
  letter-spacing: 0.3px;
}

.policy-table thead th:first-child {
  width: 28%;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.policy-table thead th:last-child {
  width: 72%;
}

.policy-table tbody tr {
  background-color: var(--table-row-bg);
  transition: background-color 0.15s ease;
}

.policy-table tbody tr:hover {
  background-color: var(--table-row-hover);
}

.policy-table tbody td {
  padding: 14px 20px;
  font-size: 14px;
  line-height: 1.7;
  vertical-align: top;
  color: var(--text-main);
}

.policy-table tbody td:first-child {
  font-weight: 500;
  color: var(--brand-navy);
  border-right: 1px solid #ffffff;
}

.policy-table tbody td:last-child {
  white-space: pre-line;
  word-break: break-word;
  color: var(--text-main);
}

.badge-activate {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-red);
  background-color: var(--brand-red-soft);
  border: 1px solid var(--brand-red-border);
  border-radius: 3px;
}

.badge-none {
  color: var(--text-muted);
}

.detail-link {
  float: right;
  font-size: 13px;
  color: var(--brand-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  margin-left: 12px;
  opacity: 0.85;
}

.detail-link:hover {
  color: var(--brand-red);
  opacity: 1;
}

/* 表格底部备注与复制按钮 */
.section-footnote {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.footnote-warn {
  color: var(--brand-red);
  font-weight: 500;
}

.copy-btn {
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #D0D5E4;
  color: var(--brand-navy);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.copy-btn:hover {
  border-color: var(--brand-navy);
  background-color: var(--brand-navy);
  color: #ffffff;
}

.copy-btn.copied {
  border-color: var(--brand-red);
  color: #ffffff;
  background-color: var(--brand-red);
}

/* 页脚说明 */
.page-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 12px;
  color: var(--text-muted);
}

/* 空状态与本地加载提示 */
.empty-state,
.load-error-box {
  display: none;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.empty-state.visible,
.load-error-box.visible {
  display: block;
}

.load-error-box {
  background-color: var(--sidebar-bg);
  border: 1px dashed #C7CEE0;
  border-radius: 4px;
  max-width: 640px;
  margin: 40px auto;
}

.load-error-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 10px;
}

.file-picker-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 18px;
  background-color: var(--brand-navy);
  color: #ffffff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.file-picker-btn:hover {
  background-color: var(--brand-navy-light);
}

/* 弹窗 */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 21, 75, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(25, 30, 101, 0.22);
  overflow: hidden;
}

.modal-header {
  background: var(--brand-navy);
  border-bottom: 3px solid var(--brand-red);
  color: #ffffff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 22px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-main);
  white-space: pre-line;
  max-height: 65vh;
  overflow-y: auto;
}

.modal-meta {
  font-size: 12px;
  color: var(--brand-red);
  font-weight: 500;
  margin-bottom: 10px;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 1080px) {
  .top-header {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 18px 0 18px;
    gap: 10px 16px;
  }

  .top-brand {
    order: 1;
  }

  .brand-logo {
    height: 44px;
  }

  .brand-portal-name {
    font-size: 15px;
  }

  .search-box {
    order: 2;
    width: 210px;
  }

  .top-nav {
    order: 3;
    flex: 0 0 100%;
    height: 44px;
    border-top: 1px solid #F0F2F7;
    gap: 4px;
  }

  .top-nav-btn {
    padding: 0 12px;
    font-size: 14px;
  }
}

@media (max-width: 860px) {
  .search-box {
    width: 100%;
    margin-left: 0;
  }

  .page-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    padding: 14px 16px 10px 16px;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .sidebar-title {
    font-size: 17px;
    margin-bottom: 8px;
  }

  .sidebar-subtitle {
    display: none;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .nav-link {
    padding: 4px 2px 6px 2px;
  }

  .nav-link::before {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 0;
    height: 2px;
  }

  .nav-link.active::before {
    width: 100%;
    height: 2px;
  }

  .nav-count {
    display: none;
  }

  .main-content {
    padding: 24px 16px 64px 16px;
  }

  .policy-table thead th:first-child {
    width: 34%;
  }

  .policy-table thead th:last-child {
    width: 66%;
  }

  .policy-table thead th,
  .policy-table tbody td {
    padding: 11px 12px;
    font-size: 13px;
  }

  .section-footnote {
    flex-direction: column;
    gap: 8px;
  }
}
