/* =========================================================
   水泵品牌样册在线预览 - 样式表
   移动端优先，适配微信内置浏览器
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #222;
  overflow: hidden;
  /* 禁止长按选中 / 长按保存图片（防下载） */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#app {
  height: 100%;
}

/* ---------- 视图容器 ---------- */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #f5f6f8;
}

[hidden] {
  display: none !important;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  flex: 0 0 auto;
  background: #fff;
  padding: 18px 16px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  z-index: 10;
  text-align: center;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-title {
  font-size: 36px;  /* 放大一倍 */
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.topbar-sub {
  color: #888;
  font-size: 13px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 电话号码链接 */
.phone-link {
  color: #333;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}

.phone-link:active {
  color: #007aff;
}

/* 复制按钮 */
.copy-btn {
  border: 1px solid #ddd;
  background: #f8f8f8;
  color: #666;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.4;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.copy-btn:active {
  background: #e8e8e8;
  color: #333;
}

.back-btn {
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: #333;
  /* 加大可点击区域（移动端触控标准 ≥44px） */
  min-width: 44px;
  min-height: 44px;
  padding: 4px 10px 4px 0;
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.topbar-space {
  width: 32px;
  flex: 0 0 auto;
}

/* ---------- 首页：品牌宫格 ---------- */
.home-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.brand-grid {
  flex: 0 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.brand-card {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  min-height: 88px;
}

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

.brand-count {
  font-size: 12px;
  color: #999;
}

.brand-coming {
  font-size: 12px;
  color: #bbb;
}

.brand-card[data-coming] {
  opacity: 0.75;
}

/* ---------- 品牌页：文件列表 ---------- */
.file-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px;
  list-style: none;
}

.file-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.file-name {
  font-size: 15px;
  line-height: 1.4;
  flex: 1;
  overflow-wrap: break-word;
}

.file-arrow {
  color: #bbb;
  font-size: 20px;
  flex: 0 0 auto;
}

.file-badge {
  font-size: 12px;
  color: #bbb;
  flex: 0 0 auto;
}

.file-item.coming {
  opacity: 0.7;
}

/* ---------- 预览页：图片滑动 ---------- */
.preview-wrap {
  flex: 1;
  overflow: auto;            /* 两个方向都允许滚动（放大后水平也会拉长） */
  -webkit-overflow-scrolling: touch;
}

.page-card {
  position: relative;
  margin: 0 0 2px;
  background: #fff;
  /* 改为 visible：让图片以 width:% 放大后可以溢出卡片完整显示 */
  overflow: visible;
  /* 跟随 --zoom 缩放：--zoom 默认 1（即 100% 屏宽），>1 时 page-card 等比扩宽 */
  width: calc(var(--zoom, 1) * 100%);
}

.page-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #ececec;       /* 加载中的占位底色 */
}

.page-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) scale(0.9);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 99;
  pointer-events: none;
  max-width: 82%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ---------- 首页：搜索入口按钮 ---------- */
.search-entry-btn {
  flex: 0 0 auto;
  margin: auto;   /* 在品牌宫格下方空白区域垂直居中 */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  border: none;
  border-radius: 12px;
  /* 确保按钮宽度足够，移动端友好 */
  width: auto;
  min-width: 140px;
  padding: 14px 32px;
  font-size: 15px;
  color: #444;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.search-entry-btn:active {
  background: #f5f5f5;
}

.search-icon {
  font-size: 16px;
}

.search-text {
  font-weight: 500;
}

/* ---------- 搜索页 ---------- */
.search-topbar {
  gap: 8px;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f0f1f3;
  border-radius: 20px;
  padding: 0 12px;
  margin-right: 8px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  padding: 10px 0;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: #999;
}

.search-clear {
  border: none;
  background: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 0 4px 8px;
  line-height: 1;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
}

.search-hint {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 40px 20px;
}

.search-count {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
  padding-left: 2px;
}

.search-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.search-item:active {
  background: #f9f9f9;
}

.search-item-info {
  flex: 1;
  min-width: 0;
}

.search-item-brand {
  font-size: 12px;
  color: #888;
  margin-bottom: 2px;
}

.search-item-name {
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.search-item-arrow {
  color: #bbb;
  font-size: 20px;
  flex: 0 0 auto;
}

/* 高亮匹配关键字 */
.search-highlight {
  color: #e74c3c;
  font-weight: 600;
}

.search-no-result {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 40px 20px;
}
