/* === 租房网站 - 全局样式 === */

:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --accent: #E67E22;
  --bg: #F4F6F9;
  --card-bg: #FFFFFF;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --text-lighter: #BDC3C7;
  --border: #E8ECF1;
  --success: #27AE60;
  --danger: #E74C3C;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 10px;
  --header-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 19px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* === 顶部导航 === */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo svg { width: 30px; height: 30px; }
.header-phone {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-light);
  margin-left: 10px;
}
.header-wx {
  font-size: 18px;
  font-weight: 500;
  color: var(--success);
  margin-left: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.header-wx:hover { opacity: 0.7; }
/* 二维码弹窗 */
.qr-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.qr-card img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 12px;
}
.qr-card p {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 12px;
}
}
.nav a {
  margin-left: 24px;
  color: var(--text);
  font-size: 20px;
  transition: color 0.2s;
}
.nav a:hover { color: var(--primary); }

/* === 主容器 === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* === 搜索栏 === */
.search-bar {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.search-bar input,
.search-bar select {
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px;
  font-size: 18px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}
.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--primary);
}
.search-bar input { flex: 1; min-width: 180px; }
.search-bar select { flex: 1; min-width: 120px; }
.btn {
  height: 46px;
  padding: 0 28px;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  touch-action: manipulation;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: #F0F6FF; }
.btn-sm { height: 38px; padding: 0 18px; font-size: 16px; }
.btn-danger { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-danger:hover { background: #FFF0EF; }

/* === 房源卡片网格 === */
.house-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.house-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.house-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
.card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, #E8ECF1 0%, #D5DCE4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-placeholder {
  font-size: 48px;
  color: #BDC3C7;
}
.card-body { padding: 18px 20px; }
.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.card-community {
  font-size: 17px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.card-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 17px;
  color: var(--text-light);
  margin-bottom: 12px;
}
.card-info span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-price { font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.card-price small {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-light);
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.tag {
  font-size: 16px;
  padding: 5px 14px;
  border-radius: 20px;
  background: #F0F6FF;
  color: var(--primary);
}
.tag-green { background: #E8F8F0; color: var(--success); }

/* === 空状态 === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.empty-state svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; }

/* === 分页/结果计数 === */
.result-info {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
}

/* === 详情页 === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--primary); }
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
}
.detail-main { min-width: 0; }
.detail-sidebar {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

/* 图片画廊 */
.gallery {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.gallery-main {
  width: 100%;
  height: 420px;
  object-fit: cover;
  background: #E8ECF1;
}
.gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
}
.gallery-thumb {
  width: 72px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  flex-shrink: 0;
  background: #E8ECF1;
}
.gallery-thumb.active,
.gallery-thumb:hover,
.video-thumb.active,
.video-thumb:hover { border-color: var(--primary); }
.video-thumb {
  width: 72px; height: 54px; border-radius: 6px;
  cursor: pointer; border: 2px solid transparent;
  transition: border-color 0.2s; flex-shrink: 0;
}

/* 视频区 */
.video-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.video-section h3 { font-size: 17px; margin-bottom: 14px; }
.video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a1a2e;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

/* 信息区块 */
.info-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.info-section h3 {
  font-size: 19px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.info-item label {
  font-size: 16px;
  color: var(--text-light);
  display: block;
  margin-bottom: 2px;
}
.info-item .val {
  font-size: 19px;
  font-weight: 600;
}
.description { font-size: 19px; line-height: 1.8; color: #555; }

/* 侧边栏 */
.side-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.side-price small { font-size: 16px; font-weight: 400; color: var(--text-light); }
.side-community { font-size: 20px; color: var(--text); margin-bottom: 20px; }
.btn-contact {
  width: 100%;
  height: 48px;
  font-size: 16px;
  margin-bottom: 12px;
}
.side-tip {
  font-size: 12px;
  color: var(--text-lighter);
  text-align: center;
}

/* === 管理后台 === */
.admin-layout {
  max-width: 1100px;
  margin: 0 auto;
}
.login-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 48px 40px;
  box-shadow: var(--shadow);
  max-width: 400px;
  margin: 80px auto;
  text-align: center;
}
.login-box h2 { margin-bottom: 8px; }
.login-box .sub { color: var(--text-light); font-size: 14px; margin-bottom: 24px; }
.login-box input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 15px;
  margin-bottom: 14px;
  text-align: center;
  outline: none;
}
.login-box input:focus { border-color: var(--primary); }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.admin-header h2 { font-size: 22px; }

/* 房屋管理列表 */
.house-manage-list { display: flex; flex-direction: column; gap: 12px; }
.house-manage-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.house-manage-item .info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 200px;
}
.house-manage-item .thumb {
  width: 60px;
  height: 45px;
  border-radius: 6px;
  object-fit: cover;
  background: #E8ECF1;
}
.house-manage-item .name { font-weight: 600; }
.house-manage-item .meta { font-size: 13px; color: var(--text-light); }
.house-manage-item .actions { display: flex; gap: 8px; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.status-dot.on { background: var(--success); }
.status-dot.off { background: var(--text-lighter); }

/* === 表单 === */
.form-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.form-section h3 {
  font-size: 22px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; }
.form-group label {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group label .hint {
  font-weight: 400;
  font-size: 15px;
  color: var(--text-light);
}
.form-group input,
.form-group select,
.form-group textarea {
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px;
  font-size: 18px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.form-group select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%237F8C8D' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}
#fDescription {
  height: 160px;
  padding: 12px 14px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}
.form-group input[type="file"] {
  height: auto;
  padding: 10px 14px;
  font-size: 18px;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
}
.form-group input[type="file"]::file-selector-button,
.form-group input[type="file"]::-webkit-file-upload-button {
  height: 40px;
  padding: 0 20px;
  font-size: 18px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  margin-right: 12px;
  font-family: inherit;
}
.form-group input[type="file"]::file-selector-button:hover,
.form-group input[type="file"]::-webkit-file-upload-button:hover {
  background: #F0F6FF;
}
.form-group .help {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 设备选择器 */
.equipment-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}
.equip-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.equip-pill.active {
  background: #F0F6FF;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* 语音按钮 */
.mic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: none;
  background: #F0F6FF;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  vertical-align: middle;
}
.mic-btn:hover { background: #DCEAFF; }
.mic-btn.listening {
  background: var(--danger);
  color: #fff;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 模板标签 */
.tmpl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tmpl-tags span {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  white-space: nowrap;
}
.tmpl-tags span:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 设备删除图标 */
.ep-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: #ddd;
  color: #666;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.ep-del:hover {
  background: var(--danger);
  color: #fff;
}

/* === 弹窗 === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
}
.modal h2 { margin-bottom: 20px; }

/* === Toast === */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  animation: toastIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* === 设备清单 === */
.equipment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.equipment-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #F7F9FC;
  border-radius: 8px;
  font-size: 18px;
  color: var(--text);
}
.equipment-item .icon { font-size: 20px; }

/* === 图片灯箱 === */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  transition: opacity 0.2s;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: background 0.2s;
}
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}
.lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* === 隐藏 === */
.hidden { display: none !important; }

/* === 页脚 === */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-lighter);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* === 响应式 === */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  body { font-size: 17px; }

  .house-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; width: 100%; }
  .gallery-main { height: 240px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-section { padding: 16px 12px; max-width: 100%; }
  .search-bar { flex-direction: column; }
  .search-bar input,
  .search-bar select { width: 100%; min-width: 0; }
  .header { height: auto; min-height: var(--header-h); max-width: 100vw; overflow: hidden; }
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; max-width: 100%; }
  .header-phone { font-size: 15px; white-space: nowrap; }
  .admin-layout { max-width: 100%; padding: 0 4px; overflow: hidden; }
  .container { padding: 12px 8px; max-width: 100%; }
  .card-img { height: 180px; }
  .equipment-picker { gap: 4px; }
  .equip-pill { padding: 5px 12px; font-size: 16px; }
  .tmpl-tags span { padding: 5px 12px; font-size: 16px; }
  .admin-header { flex-direction: column; gap: 8px; flex-wrap: wrap; }
  .admin-header h2 { font-size: 19px; }
  .house-manage-item { flex-direction: column; align-items: flex-start; max-width: 100%; }
  .house-manage-item .actions { width: 100%; justify-content: flex-end; }
  .house-manage-item .info { flex-wrap: wrap; max-width: 100%; }
  .house-manage-item .meta { font-size: 13px; word-break: break-all; }
  .modal { max-width: 95vw; padding: 20px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .card-title { font-size: 18px; }
  .card-info { font-size: 15px; gap: 8px; }
  .card-price { font-size: 24px; }
  .tag { font-size: 14px; padding: 4px 10px; }
  .equipment-item { font-size: 15px; padding: 6px 12px; }
  .form-group { margin-bottom: 4px; }
  .form-group label { font-size: 17px; }
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 16px; height: 44px; width: 100%; max-width: 100%; box-sizing: border-box; }
  .form-group .btn-file { font-size: 16px !important; height: 42px !important; }
  .description { font-size: 16px; word-break: break-word; }
  .info-item .val { word-break: break-all; }

  /* 管理后台表单兼容老 WebView */
  .form-group { width: 100%; }
  .form-group input[type="hidden"] { display: none; }
  .btn { white-space: nowrap; }
  #descTplBox div { max-width: 100%; overflow: hidden; }
}
