/* 三亚新房乐居 - 公共样式（完整响应式版） */

/* ========== Reset ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  color: #333;
  background: #f5f6f8;
  font-size: 1rem;
  line-height: 1.5;
  min-width: 320px;
  overflow-x: hidden;
  /* 全局底部安全区兜底：无 footer 的简单页面也能避开 Home Indicator / 全面屏手势 */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { border: none; background: none; cursor: pointer; font-family: inherit; outline: none; }
input { font-family: inherit; outline: none; border: none; }

/* ========== 顶部导航 ========== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  /* iPhone 刘海/灵动岛/Android 挖孔 顶部安全区 */
  height: calc(64px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
}

.top-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  /* 父 .top-bar 已用 env 安全区撑开，内部锁定 64px 主可视区 */
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.top-bar__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0BA5E9;
  flex-shrink: 0;
}

.top-bar__logo-icon { font-size: 24px; }
.top-bar__logo-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.top-bar__nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.top-bar__nav-item {
  position: relative;
  font-size: 15px;
  color: #555;
  transition: color 0.2s;
  padding: 8px 0;
  white-space: nowrap;
}

.top-bar__nav-item:hover,
.top-bar__nav-item.active { color: #0BA5E9; font-weight: 500; }

.top-bar__nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: #0BA5E9;
  border-radius: 2px;
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar__publish {
  padding: 8px 18px;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
}

.top-bar__publish:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.top-bar__login {
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  transition: all 0.2s;
}

.top-bar__login:hover { border-color: #0BA5E9; color: #0BA5E9; }

/* ========== 移动端汉堡按钮 ========== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  right: 12px;
  width: 200px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 199;
  padding: 8px 0;
  flex-direction: column;
}

.mobile-menu.open { display: flex; }

.mobile-menu__item {
  padding: 12px 20px;
  font-size: 14px;
  color: #555;
  transition: background 0.15s;
}

.mobile-menu__item:hover,
.mobile-menu__item.active { background: #f0f9ff; color: #0BA5E9; }

.mobile-menu__item--primary { color: #FF6B6B; font-weight: 500; }

.mobile-menu__divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

/* ========== 通用容器 ========== */
.section {
  max-width: 1280px;
  margin: 32px auto;
  padding: 0 24px;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section__title {
  font-size: 20px;
  font-weight: 600;
  color: #222;
}

.section__more {
  font-size: 14px;
  color: #888;
  transition: color 0.2s;
  white-space: nowrap;
}

.section__more:hover { color: #0BA5E9; }

.loading,
.empty {
  padding: 60px 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
}

/* ========== Footer ========== */
.footer {
  margin-top: 60px;
  background: #2c3e50;
  color: #b0bec5;
}

.footer__main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer__col h4 {
  font-size: 16px;
  color: #fff;
  margin-bottom: 16px;
  font-weight: 500;
}

.footer__col p {
  font-size: 13px;
  line-height: 1.8;
  color: #90a4ae;
}

.footer__col a {
  display: block;
  font-size: 13px;
  color: #90a4ae;
  padding: 6px 0;
  transition: color 0.2s;
}

.footer__col a:hover { color: #0BA5E9; }

.footer__beian {
  padding: 16px 24px;
  /* iPhone Home Indicator / Android 手势导航 底部安全区 */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: #1f2d3d;
  font-size: 12px;
  color: #78909c;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 8px;
}

.footer__beian a {
  color: #78909c;
  transition: color 0.2s;
  white-space: nowrap;
}

.footer__beian a:hover { color: #fff; }

.footer__beian-divider {
  margin: 0 8px;
  color: #455a64;
}

.footer__copy {
  padding: 12px 24px;
  /* iPhone Home Indicator / Android 手势导航 底部安全区 */
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: #1a2530;
  font-size: 12px;
  color: #546e7a;
}

/* ========== 响应式：中等屏幕 平板 ========== */
@media (max-width: 1024px) {
  .top-bar__nav { gap: 16px; }
  .top-bar__nav-item { font-size: 14px; }
  .top-bar__inner { gap: 16px; padding: 0 16px; }
  .footer__main { grid-template-columns: 1fr 1fr; padding: 32px 24px 24px; gap: 24px; }
  .section { padding: 0 16px; }
}

/* ========== 响应式：手机（核心） ========== */
@media (max-width: 768px) {
  /* 顶部导航改汉堡菜单 */
  .top-bar { height: 56px; }
  .top-bar__inner { padding: 0 16px; gap: 12px; }
  .top-bar__nav, .top-bar__right { display: none; }
  .mobile-menu-btn { display: flex; }
  .top-bar__logo-text { max-width: 140px; font-size: 16px; }
  .top-bar__logo-icon { font-size: 22px; }

  /* 通用 */
  .section { padding: 0 16px; margin: 20px auto; }
  .section__title { font-size: 17px; }
  .section__more { font-size: 13px; }

  /* Footer */
  .footer { margin-top: 40px; }
  .footer__main { grid-template-columns: 1fr; padding: 32px 16px 24px; gap: 20px; }
  .footer__col h4 { font-size: 15px; margin-bottom: 12px; }
  .footer__col a { padding: 4px 0; }
  .footer__beian { font-size: 11px; padding: 12px 16px; gap: 2px 6px; }
  .footer__beian-divider { margin: 0 4px; }
  .footer__copy { font-size: 11px; padding: 10px 16px; }
}

/* ========== 响应式：超小屏幕 ========== */
@media (max-width: 375px) {
  html { font-size: 13px; }
  .top-bar__logo-text { max-width: 120px; font-size: 15px; }
  .top-bar__logo-icon { font-size: 20px; }
  .mobile-menu { width: 180px; right: 8px; }
  .footer__beian { font-size: 10px; }
  .footer__copy { font-size: 10px; }
}

/* ========== 适配补充：覆盖更多机型/系统版本 ========== */

/* 中等屏：折叠屏内屏、Note/iPhone Plus 等大屏手机 (481-820px) */
@media (min-width: 481px) and (max-width: 820px) {
  .quick__grid { grid-template-columns: repeat(4, 1fr); }
  .house-grid,
  .community-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .about-band__inner { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .footer__main { grid-template-columns: repeat(2, 1fr); }
}

/* 横屏模式（手机横屏 / 折叠屏横展） */
@media (orientation: landscape) and (max-height: 500px) {
  .top-bar { height: calc(48px + env(safe-area-inset-top, 0px)); }
  .top-bar__inner { height: 48px; }
  .top-bar__logo-text { font-size: 15px; }
  .hero { height: auto; padding-bottom: 12px; }
  .hero__content { padding: 24px 24px 0; }
  .hero__title { font-size: 22px; margin-bottom: 4px; }
  .hero__subtitle { font-size: 12px; margin-bottom: 16px; }
  .hero__hot { display: none; }
  .footer__main { padding: 24px 24px 12px; gap: 16px; }
}

/* 触控设备（无 hover）：关闭桌面 hover 抬起/阴影，避免误触残留 */
@media (hover: none) and (pointer: coarse) {
  .top-bar__nav-item:hover { color: inherit; }
  .top-bar__publish:hover,
  .top-bar__login:hover { transform: none; box-shadow: none; border-color: inherit; color: inherit; }
  .house-card:hover,
  .community-card:hover,
  .quick__item:hover,
  .about-band__item:hover { transform: none; box-shadow: none; }
  .section__more:hover,
  .footer__col a:hover,
  .footer__beian a:hover { color: inherit; }
  .hero__hot a:hover { background: inherit; }
  .hero__search-btn:hover { transform: none; }
  .mobile-menu__item:hover { background: transparent; color: inherit; }
}

/* 折叠屏展开（实验性 API：横向视口段检测） */
@media (horizontal-viewport-segments: 2) {
  .section,
  .footer__main { max-width: 70vw; margin-left: auto; margin-right: auto; }
}

/* 现代视口单位回退：避免 iOS Safari 浏览器栏伸缩造成 hero 抖动 */
@supports (height: 100dvh) {
  .hero { min-height: 380px; }
}

/* ============== 移动端全局覆盖样式（H5 App 外壳，仅 <768px 显示） ============== */
.m-shell { display: none; }

@media (max-width: 768px) {
  /* 隐藏桌面版元素 */
  .top-bar, .mobile-menu-btn, .mobile-menu,
  .footer, .hero, .quick, .about-band,
  .scroll-top { display: none !important; }

  /* 启用 H5 外壳 */
  .m-shell { display: block; }

  /* 共用：移动端页面容器通用边距 */
  main.list-page, main.news-list-page, main.news-detail-page,
  main.community-page, main.detail-page, main.eval-page,
  main.login-page, main.user-page, main.msg-page,
  main.about-page, main.owner-page, main.pub-page {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 8px 12px calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box;
  }

  /* 列表/详情块状容器 */
  main.list-page .list-page__filter,
  main.community-page .list-page__filter,
  main.detail-page .detail-page__main,
  main.eval-page .eval-card,
  main.login-page .login-card,
  main.msg-page .msg-card,
  main.news-list-page h1, main.about-page .about-hero,
  main.news-detail-page .news-detail,
  main.owner-page .owner-card, main.owner-page .owner-form,
  main.pub-page .pub-card, main.user-page .user-card {
    background: #fff !important;
    border-radius: 10px !important;
    padding: 16px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.04) !important;
  }

  /* 过滤栏单列化 */
  .list-page__filter { display: block !important; padding: 12px !important; }
  .list-page__filter-row, .list-page__filter .filter-row { display: flex !important; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .list-page__filter-row::-webkit-scrollbar { display: none; }
  .list-page__filter-row .filter-tab, .list-page__filter .sort-btn, .list-page__filter .filter-pill {
    flex-shrink: 0;
    font-size: 13px !important;
    padding: 6px 14px !important;
    border-radius: 16px !important;
    border: 1px solid #e5e7eb !important;
    background: #fff !important;
    color: #444 !important;
  }
  .list-page__filter-row .filter-tab.active, .list-page__filter .sort-btn.active {
    background: #0BA5E9 !important;
    color: #fff !important;
    border-color: #0BA5E9 !important;
  }

  /* 列表单列（瀑布流） */
  main.list-page .house-grid,
  main.community-page .community-grid,
  main.detail-page .related-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  main.list-page .house-card, main.community-page .community-card {
    display: flex !important; gap: 12px; padding: 10px; box-shadow: none !important;
  }
  main.list-page .house-card__img, main.community-page .community-card__img {
    width: 110px !important; height: 84px !important; flex-shrink: 0;
  }

  /* 详情页主图区 */
  main.detail-page .detail-page__main { padding: 0 !important; overflow: hidden; }
  main.detail-page .detail__gallery, main.detail-page .gallery {
    border-radius: 0 !important; margin-bottom: 8px;
  }
  main.detail-page .detail__info, main.detail-page .detail-info {
    background: #fff !important; padding: 14px !important; border-radius: 0 !important;
    margin-bottom: 8px !important;
  }
  main.detail-page .detail-page__bottom, main.detail-page .detail-actions {
    position: fixed !important; left: 0; right: 0; bottom: 0;
    background: #fff !important; box-shadow: 0 -2px 8px rgba(0,0,0,.06);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 149;
    display: flex; align-items: center; gap: 10px;
    border-radius: 0 !important;
  }
  /* 给详情页底部联系栏腾出空间 */
  main.detail-page { padding-bottom: 90px !important; }

  /* 评估表单纵向 */
  .eval-card .form-row, main.eval-page .form-row,
  main.pub-page .form-row, main.login-page .form-row { flex-direction: column !important; gap: 14px !important; margin-bottom: 14px !important; }
  .form-cell input, .form-cell select, .form-cell textarea,
  main.eval-page .form-cell input, main.eval-page .form-cell select,
  main.owner-page .form-group input, main.owner-page .form-group select, main.owner-page .form-group textarea,
  main.pub-page .form-cell input, main.pub-page .form-cell select, main.pub-page .form-cell textarea,
  main.msg-page .msg-form input, main.msg-page .msg-form textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
    -webkit-appearance: none;
    appearance: none;
  }
  .form-cell label, main.eval-page .form-cell label, main.owner-page .form-group label,
  main.pub-page .form-cell label {
    font-size: 13px !important; color: #444 !important; margin-bottom: 6px !important;
  }
  .form-submit, main.eval-page button[type=submit], main.owner-page .form-submit,
  main.pub-page .pub-submit, main.msg-page .msg-form button {
    width: 100% !important; padding: 14px !important;
    border-radius: 22px !important; font-size: 16px !important;
    margin-top: 12px !important;
  }

  /* 资讯/小区列表项 */
  main.news-list-page .news-page-item,
  main.community-page .community-card { padding: 12px !important; gap: 10px !important; margin-bottom: 8px !important; }
  main.news-list-page .news-page-item__cover { width: 110px !important; height: 80px !important; }
  main.news-list-page .news-page-item__title { font-size: 14px !important; }
  main.news-list-page .news-page-item__summary { font-size: 12px !important; }
  main.news-list-page h1 { font-size: 18px !important; padding: 12px 14px !important; border: none !important; background: transparent !important; margin: 0 !important; }

  /* 详情文：行高加大 */
  main.news-detail-page .news-detail { padding: 16px !important; }
  main.news-detail-page .news-detail__title { font-size: 19px !important; }
  main.news-detail-page .news-detail__content { font-size: 15px !important; line-height: 1.85 !important; }
  main.news-detail-page .news-detail__content img { border-radius: 6px !important; }

  /* 关于我们 */
  main.about-page .about-hero { padding: 28px 20px !important; }
  main.about-page .about-hero h1 { font-size: 22px !important; }
  main.about-page .about-section { padding: 16px !important; }
  main.about-page .about-features, main.about-page .about-contact { grid-template-columns: 1fr !important; gap: 10px !important; }
  main.about-page .about-feature { padding: 14px !important; }

  /* 业主委托头部 */
  main.owner-page .owner-card { background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%) !important; padding: 24px 16px !important; border-radius: 12px !important; }
  main.owner-page .owner-card h1 { font-size: 22px !important; }

  /* 发布页 uploader 紧凑 */
  main.pub-page .pub-uploader { padding: 16px !important; }
  main.pub-page .pub-uploader__icon { font-size: 30px !important; }
  main.pub-page .pub-uploader__item { width: 72px !important; height: 72px !important; }
  main.pub-page .pub-card h1 { font-size: 18px !important; padding-bottom: 8px !important; margin-bottom: 12px !important; }
  main.pub-page h1 { border: none !important; }

  /* 登录页简化 */
  main.login-page .login-form .form-row { gap: 12px !important; }
  main.login-page .login-form input { padding: 14px !important; font-size: 16px !important; }
  main.login-page .login-card h1 { font-size: 19px !important; }

  /* 消息列表 */
  main.msg-page .msg-item { padding: 10px 0 !important; font-size: 13px !important; }

  /* 分页器滚屏 */
  .list-page__pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 12px 0 !important; }
  .list-page__pager button { font-size: 13px !important; padding: 6px 12px !important; }

  /* ---- 移动端顶部导航栏（白底带回退） ---- */
  .m-topbar {
    position: sticky; top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex; align-items: center;
    height: calc(48px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
  }
  .m-topbar__back {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    color: #333; text-decoration: none; font-size: 22px;
    -webkit-tap-highlight-color: transparent;
  }
  .m-topbar__title {
    flex: 1; text-align: center; font-size: 16px; font-weight: 600;
    color: #222; padding: 0 12px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .m-topbar__action {
    display: flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    color: #0BA5E9; text-decoration: none; font-size: 14px;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---- 移动端底部 tabbar（全局共用） ---- */
  .m-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 150;
    display: flex; background: #fff;
    border-top: 1px solid #f0f0f0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 6px rgba(0,0,0,.04);
  }
  .m-tabbar__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 6px 0; text-decoration: none; color: #999; font-size: 10px;
    -webkit-tap-highlight-color: transparent;
  }
  .m-tabbar__item.active { color: #0BA5E9; }
  .m-tabbar__icon { font-size: 20px; font-style: normal; line-height: 1.2; }
  .m-tabbar__item--center .m-tabbar__icon {
    font-size: 26px; color: #fff;
    background: linear-gradient(135deg, #0BA5E9, #00C9FF);
    border-radius: 50%; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    margin-top: -14px;
    box-shadow: 0 4px 10px rgba(11,165,233,.35);
  }
}

/* ---- 管理员新房快捷操作（编辑/删除，仅新房卡片内显示） ---- */
.h-admin-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.h-admin-tools__btn {
  font-size: 12px;
  line-height: 1;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.h-admin-tools__btn:active { opacity: .7; }
.h-admin-tools__btn--edit { background: #eaf1ff; color: #2563eb; }
.h-admin-tools__btn--del { background: #fdecec; color: #e53935; }