/* ══════════════════════════════════════════════════════════════════════════
   V313 · H5 房产频道（`/app/#estate`）移动端改版
   ──────────────────────────────────────────────────────────────────────────
   为什么单独一个文件而不是继续追加到 brand.css：
     brand.css 已经两万多行；房产这一屏是一整套新视觉（吸顶头部、分段
     控件、房源大图卡、走势图）。独立文件便于整段回滚，也避免和外卖/打车
     的 `.card` `.pill` 既有规则互相抢特异性。

   设计取向（移动优先，390px 基准）：
     · 拇指区：城市与搜索放顶部，**主筛选（新房/二手房/租房）吸顶跟随**，
       单手即可切换；
     · 价格是这个品类唯一的决策字段 → 单独一行 15px/800 字重压在大图右下角，
       并由 `estateMeta()` 统一成「168万 / 1600元/月」（原版 `CV.fmt` 输出
       `¥168.00 万`，万元单位后面两位小数毫无信息量）；
     · 图片 16:10 大卡 + 角标（VR / 新盘 / 房源数），列表更像房产 App，
       不再是一行 emoji + 标题；
     · 颜色/圆角走 `:root` 既有 token，改品牌色不用二次改这里。

   ⚠️ 本文件只做**视觉**。数据加载与事件仍在 `app.js` 的
      `estatePage()` / `bindEstate()`，类名前缀统一 `est-`，不与既有
      `.card` / `.pill` 混用。
   ══════════════════════════════════════════════════════════════════════════ */

/* —— 页面骨架 —— */
.est-page {
  --est-gap: 12px;
  --est-radius: 18px;
  --est-shadow: 0 6px 20px rgba(26, 42, 58, .07), 0 1px 2px rgba(26, 42, 58, .06);
  padding-bottom: 28px;
  background: linear-gradient(180deg, #FFF7EF 0, var(--bg) 220px, var(--bg) 100%);
}

/* —— 头部：城市 + 搜索 + 快捷浏览 ——
   原来顶部是一条 `.nav`（返回 + 标题）再叠两排 pill 入口，一屏之内两个
   吸顶元素互相打架。改成**一个** hero，`position: sticky` 只挂一层。 */
.est-top {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 10px 16px 12px;
  background: linear-gradient(180deg, #FFF7EF 70%, rgba(255, 247, 239, .94));
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(26, 42, 58, .05);
}

.est-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.est-back {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: rgba(26, 42, 58, .06);
  color: var(--navy);
  cursor: pointer;
}

.est-back:active {
  background: rgba(26, 42, 58, .12);
}

.est-title {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1.2;
}

.est-city {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 42%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 140, 0, .1);
  color: var(--orange-d);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.est-city span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 搜索：伪装成输入框的按钮，避免移动端键盘弹起后把整屏顶飞。 */
.est-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(26, 42, 58, .07);
  box-shadow: var(--est-shadow);
  color: var(--placeholder);
  font-size: 13.5px;
  cursor: pointer;
}

.est-search .ph-icon {
  color: var(--orange);
  flex: none;
}

/* 快捷入口：一行四个，图标 + 短标签，拇指可及。 */
.est-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.est-quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 4px 8px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(26, 42, 58, .05);
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  min-height: 64px;
}

.est-quick-item .ph-icon {
  color: var(--orange);
}

.est-quick-item.on {
  background: var(--navy);
  color: #fff;
}

.est-quick-item.on .ph-icon {
  color: #FFB65C;
}

.est-quick-item:active {
  transform: scale(.97);
}

/* —— 分段控件（房产类型）—— 主筛选维度 ——
   ⚠️ 这里**不能** `position: sticky`：滚动容器是 `.phone-body`（`.phone` 是
      `overflow:hidden` 的圆角机身边框），sticky 在「祖先有 hidden + 自身有
      overflow-x:auto」的组合下会被裁剪层吃掉，实测滚到 400px 时 `top` 仍在
      44px 纹丝不动 —— 用户得滑回顶部才能换类型。
      而 `.est-top` 已经吸顶承担了「我在哪」的信息，筛选条跟随滚动即可。 */
.est-seg {
  display: flex;
  gap: 4px;
  margin: 12px 16px 0;
  padding: 4px;
  border-radius: 14px;
  background: rgba(26, 42, 58, .06);
  overflow-x: auto;
  scrollbar-width: none;
}

.est-seg::-webkit-scrollbar {
  display: none;
}

.est-seg-item {
  flex: 1 0 auto;
  min-width: 62px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--navy-3);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.est-seg-item.on {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(26, 42, 58, .14);
}

/* —— 房源大卡 —— */
.est-list {
  display: flex;
  flex-direction: column;
  gap: var(--est-gap);
  padding: 12px 16px 0;
}

.est-card {
  display: block;
  position: relative;
  border-radius: var(--est-radius);
  background: #fff;
  box-shadow: var(--est-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease;
}

.est-card:active {
  transform: scale(.985);
}

.est-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #FFE8CC, #FFD1A1);
  overflow: hidden;
}

.est-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.est-card-media > .est-ph {
  position: absolute;
  inset: 0;
  margin: auto;
  color: rgba(255, 255, 255, .85);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .15));
}

.est-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.est-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(26, 42, 58, .72);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
}

.est-badge.hot {
  background: linear-gradient(135deg, #FF8C00, #FF5D00);
}

.est-badge.vr {
  background: rgba(24, 144, 255, .9);
}

/* ⚠️ 价格**压在大图右下角**而不是单独占一行：房产列表里用户的扫视线是
   「图 → 价格 → 标题」，价格贴着图比放在图下方快一屏的识别距离。 */
.est-price-tag {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .95);
  color: var(--orange-d);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(26, 42, 58, .18);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.est-price-tag small {
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 1px;
}

.est-card-body {
  padding: 11px 13px 13px;
}

.est-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--navy);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.est-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.est-card-meta b {
  color: var(--navy-2);
  font-weight: 600;
}

.est-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.est-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 7px;
  background: #F4F6FA;
  color: var(--navy-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.est-chip.soft {
  background: var(--orange-l);
  color: var(--orange-d);
}

.est-dist {
  margin-left: auto;
  color: var(--placeholder);
  font-size: 11px;
  font-weight: 600;
}

/* —— 走势：这条曲线是「决策辅助」，用面积渐变而不是柱状 ——
   柱状每月 24 根在 390px 上变成一条毛边，且看不清趋势。 */
.est-trend-hero {
  margin: 12px 16px 0;
  padding: 16px;
  border-radius: var(--est-radius);
  background: linear-gradient(135deg, #12212F 0%, #1F3A52 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(26, 42, 58, .22);
}

.est-trend-hero .lab {
  font-size: 12px;
  opacity: .78;
  font-weight: 600;
}

.est-trend-hero .val {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.est-trend-hero .val small {
  font-size: 12px;
  font-weight: 600;
  opacity: .8;
  letter-spacing: 0;
}

.est-trend-hero .delta {
  display: inline-flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  opacity: .9;
}

.est-trend-hero .delta .up {
  color: #FF8A65;
}

.est-trend-hero .delta .down {
  color: #7ED6A5;
}

.est-spark {
  display: block;
  width: 100%;
  height: 96px;
  margin-top: 10px;
}

/* —— 筛选条（区域 / 户型 / 排序）—— */
.est-filters {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 42, 58, .06);
}

.est-filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.est-filters-row + .est-filters-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(26, 42, 58, .08);
}

.est-filters-row .lab {
  flex: none;
  width: 30px;
  color: var(--placeholder);
  font-size: 11.5px;
  font-weight: 700;
}

.est-filters-row .item {
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #F4F6FA;
  color: var(--navy-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
}

.est-filters-row .item.on {
  border-color: rgba(255, 140, 0, .45);
  background: var(--orange-l);
  color: var(--orange-d);
}

.est-count {
  padding: 12px 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.est-count b {
  color: var(--orange-d);
  font-size: 13px;
  font-weight: 800;
}

/* —— 横向筛选条（搜索页 / 走势页共用的返回行）—— */
.est-row-back {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 0;
}

/* —— 空态 —— */
.est-empty {
  padding: 36px 24px 44px;
  text-align: center;
  color: var(--muted);
}

.est-empty .ph-icon {
  color: rgba(26, 42, 58, .18);
}

.est-empty .t {
  margin-top: 10px;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
}

.est-empty .d {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.55;
}

/* —— 小屏（SE / 老旧安卓）与宽屏 —— */
@media (max-width: 360px) {
  .est-quick {
    gap: 6px;
  }

  .est-quick-item {
    font-size: 11px;
    min-height: 60px;
  }

  .est-card-media {
    aspect-ratio: 3 / 2;
  }
}

@media (min-width: 640px) {
  .est-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

/* —— 维吾尔语（RTL）——
   货币后缀、楼层「8/18」、距离都跟在数字后面；RTL 下浏览器会把整串当
   混合文本重排，价格和单位会跳位。这里只把**卡片内的数字串**钉成 LTR，
   列表顺序仍沿用 `html[dir=rtl]` 的全局镜像。 */
html[dir="rtl"] .est-price-tag,
html[dir="rtl"] .est-card-meta,
html[dir="rtl"] .est-trend-hero .val {
  direction: ltr;
  text-align: right;
  unicode-bidi: isolate;
}

html[dir="rtl"] .est-dist {
  margin-left: 0;
  margin-right: auto;
}

/* —— 深色主题 —— */
[data-theme="dark"] .est-page {
  background: linear-gradient(180deg, #16202B 0, #101820 220px, #101820 100%);
}

[data-theme="dark"] .est-top {
  background: linear-gradient(180deg, #16202B 70%, rgba(22, 32, 43, .92));
  border-bottom-color: #22303F;
}

[data-theme="dark"] .est-title {
  color: #EAF0F6;
}

[data-theme="dark"] .est-back {
  background: rgba(255, 255, 255, .08);
  color: #EAF0F6;
}

[data-theme="dark"] .est-search,
[data-theme="dark"] .est-card,
[data-theme="dark"] .est-filters,
[data-theme="dark"] .est-quick-item {
  background: #1A2A3A;
  border-color: #22303F;
  color: #EAF0F6;
}

[data-theme="dark"] .est-card-title,
[data-theme="dark"] .est-card-meta b {
  color: #EAF0F6;
}

[data-theme="dark"] .est-empty .t {
  color: #EAF0F6;
}

[data-theme="dark"] .est-seg {
  background: #1A2A3A;
}

[data-theme="dark"] .est-seg-item.on {
  background: #2C4058;
  color: #fff;
}

[data-theme="dark"] .est-chip,
[data-theme="dark"] .est-filters-row .item {
  background: #22303F;
  color: #C9D6E3;
}
