/* ==========================================================================
   基础样式
   ========================================================================== */
body {
  font-family: "Figtree", sans-serif;
  background: #ffffff;
  margin: 0;
}

/* 骨架屏基础样式 */
.skeleton {
  background: #f0f0f0;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.5) 60%,
    rgba(255, 255, 255, 0)
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ==========================================================================
   布局容器
   ========================================================================== */
.container {
  width: 1100px;
  background: #fbfbfb;
  margin: 0 auto;
  padding: 0 25px;
}

/* ==========================================================================
   顶部导航栏
   ========================================================================== */
.topbar {
  background: #f3f3f3;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.logo-container {
  width: 1150px;
  display: flex;
  justify-content: space-between;
}

.logo-container-phone {
  display: none;
}

.logo {
  margin-left: 25px;
  height: 40px;
}

/* ==========================================================================
   房源导航
   ========================================================================== */
.navbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  border-bottom: 1px solid #e4e4e4;
}

/* 默认状态 - 未选中 */
.navbar-item {
  margin-top: 38px;
  background: transparent;
  width: calc(50% - 4px);
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* 默认状态下的文本 */
.navbar-item-text {
  font-size: 16px;
  font-weight: bold;
  color: #8e8e8e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 10px;
  transition: color 0.3s ease;
}

/* 选中状态 */
.navbar-item.active {
  background-color: #e4eff4;
}

/* 选中状态下的文本 */
.navbar-item.active .navbar-item-text {
  color: #1483b7;
}

/* 选中状态下的底部指示器 */
.navbar-item.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background-color: #2a7ae2;
  border-radius: 2px;
}

/* 悬停效果 */
.navbar-item:hover:not(.active) {
  background-color: #f5f5f5;
}

.navbar-item:hover:not(.active) .navbar-item-text {
  color: #666;
}

/* ==========================================================================
   图片画廊
   ========================================================================== */
.image-gallery {
  display: flex;
  width: 100%;
  margin-top: 24px;
}

/* 主图容器 */
.main-image-container {
  position: relative;
  width: calc(50% - 4px);
  height: auto;
  overflow: hidden;
  background-color: #f5f5f5;
  border-radius: 8px 0 0 8px;
}

.main-image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px 0 0 8px;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}

.main-image.loaded {
  opacity: 1;
}

/* 主图加载时的脉动效果 */
@keyframes mainImagePulse {
  0% { background-color: #f5f5f5; }
  50% { background-color: #e0e0e0; }
  100% { background-color: #f5f5f5; }
}

.main-image-container:not(:has(.main-image.loaded)) {
  animation: mainImagePulse 1.5s infinite ease-in-out;
}

/* 确保属性B的主图也有正确的样式 */
#property-b .main-image {
  border-radius: 8px 0 0 8px;
}

/* 移动设备上的主图样式 */
@media screen and (max-width: 768px) {
  .main-image {
    border-radius: 8px;
  }
  
  #property-a .main-image,
  #property-b .main-image {
    border-radius: 8px;
  }
}

/* 图片叠加层 */
.image-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 70%;
  height: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 20px;
  border-radius: 12px;
}

.image-overlay .image-overlay-title {
  font-size: 82px;
  font-weight: normal;
  margin: 0;
}

.image-overlay-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.divider-long {
  width: 190px;
  height: 5px;
  background-color: white;
  border: none;
  margin: 0;
}

.divider-short {
  width: 25px;
  height: 5px;
  background-color: white;
  border: none;
  margin: 0;
}

.image-overlay-bottom {
  display: none;
}

/* 右侧缩略图容器 */
.image-right-container {
  display: flex;
  flex-wrap: wrap;
  margin-left: 8px;
  gap: 8px;
  width: calc(50% - 4px);
  height: auto;
}

.image-right {
  width: calc(50% - 4px);
  height: auto;
}

.image-right:nth-child(2) {
  border-top-right-radius: 8px;
}

.image-right:nth-child(4) {
  border-bottom-right-radius: 8px;
}

/* ==========================================================================
   文本内容
   ========================================================================== */
.text-title {
  margin-top: 35px;
  font-size: 24px;
  font-weight: bold;
}

.text-info {
  color: #2b2b2b;
  font-size: 15px;
  margin-top: 15px;
}

/* ==========================================================================
   信息区块
   ========================================================================== */
.info-section {
  display: flex;
  margin-top: 25px;
  justify-content: space-around;
}

.info-box {
  width: 31%;
  height: 130px;
  border: 1px solid #9ea8a7;
  border-radius: 8px;
}

.info-box-title {
  font-size: 18px;
}

.medium-info-box {
  display: none;
}

/* ==========================================================================
   描述区域
   ========================================================================== */
.desc-section {
  width: 68%;
  padding-bottom: 76px;
}

/* ==========================================================================
   联系框
   ========================================================================== */
.contact-box {
  margin-top: 47px;
  width: 30%;
  height: 200px;
  background: #f0f0f0;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-title {
  margin-top: 10%;
  font-size: 16px;
  color: #2b2b2b;
  padding: 0 10px;
  text-align: center;
}

.contact-email {
  font-size: 24px;
  margin-top: 6%;
  color: #1e88ba;
  text-decoration: none;
  text-align: center;
  word-wrap: break-word;
  word-break: break-all;
  display: block;
  padding: 0 20px;
}

.contact-button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6%;
  width: 269px;
  height: 45px;
  background-color: #1e88ba;
  border-radius: 5px;
  min-width: 173px;
  max-width: 100%;
  transition: background-color 0.3s ease;
}

.contact-button:hover {
  background-color: #0e6a94;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.contact-button a {
  font-size: 18px;
  color: white;
  text-decoration: none;
  text-align: center;
  padding: 0 10px;
}

/* ==========================================================================
   卧室轮播
   ========================================================================== */
.bedroom-carousel-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  margin-top: 20px;
}

.bedroom-mobile-slider {
  display: none;
}

.bedroom-gallery {
  display: flex;
  width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  gap: 15px;
  padding: 10px 0;
}

.image-bedroom {
  width: calc(34% - 15px);
  height: 180px;
  border-radius: 8px;
}

/* 导航按钮 */
.bedroom-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  font-size: 18px;
  color: #666;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: visible;
}

.prev-btn {
  left: -20px;
}

.next-btn {
  right: -20px;
}

.bedroom-nav:hover {
  background-color: #f8f8f8;
  color: #1e88ba;
}

/* ==========================================================================
   地图容器
   ========================================================================== */
.map-container {
  width: 744px;
  height: 275px;
  margin-top: 11px;
  border-radius: 12px;
}

.map-container img {
  width: 100%;
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.map-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-pin img {
  width: 24px;
  height: 24px;
  filter: invert(1);
}

/* ==========================================================================
   图片预览模态框
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.modal-content {
  position: relative;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  height: calc(100% - 160px);
  width: 100%;
}

#modal-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

/* 导航按钮 */
.prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: 50px;
  height: 50px;
  padding: 16px;
  margin-top: -25px;
  color: white;
  font-weight: bold;
  font-size: 30px;
  transition: 0.6s ease;
  border-radius: 50%;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.3);
}

.next {
  right: 20px;
}

.prev {
  left: 20px;
}

.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* 顶部分类标签 */
.modal-categories {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  gap: 10px;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.category-btn {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.category-btn.active {
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
}

.category-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* 图片信息 */
.modal-image-info {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  text-align: center;
}

.image-title {
  font-size: 18px;
  font-weight: bold;
}

.image-description {
  font-size: 14px;
  margin-top: 5px;
}

.image-counter {
  position: absolute;
  right: 20px;
  bottom: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

/* 底部缩略图导航 */
.modal-thumbnails {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 80px;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbnails-container {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  max-width: 90%;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  scroll-behavior: smooth; /* 添加平滑滚动 */
}

.thumbnails-container::-webkit-scrollbar {
  height: 5px;
}

.thumbnails-container::-webkit-scrollbar-track {
  background: transparent;
}

.thumbnails-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

.thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.2s;
  filter: brightness(0.9);
  flex-shrink: 0; /* 防止缩略图被压缩 */
}

.thumbnail:hover {
  filter: brightness(1);
  transform: scale(1.05);
}

.thumbnail.active {
  border-color: white;
  filter: brightness(1);
  transform: scale(1.05);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* 模态图片加载状态 */
#modal-image.loading {
  opacity: 0.5;
  filter: blur(5px);
  transition: opacity 0.3s, filter 0.3s;
}

/* 加载动画 */
@keyframes modalLoading {
  0% { background-color: rgba(0, 0, 0, 0.5); }
  50% { background-color: rgba(0, 0, 0, 0.7); }
  100% { background-color: rgba(0, 0, 0, 0.5); }
}

.modal-content:has(#modal-image.loading)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==========================================================================
   页脚
   ========================================================================== */
.footer {
  background-color: #f3f3f3;
  font-size: 18px;
  color: #666;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-communicate {
  display: none;
}

.footer-button {
  background-color: #1e88ba;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  height: 40px;
  width: 35%;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.footer-button:hover {
  background-color: #0e6a94;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.footer-button-text {
  text-decoration: none;
  text-align: center;
  color: white;
  font-size: 16px;
}

/* ==========================================================================
   中等屏幕样式 - 最大宽度936px
   ========================================================================== */
@media screen and (max-width: 936px) {
  .container {
    width: calc(100% - 50px);
  }

  /* 隐藏原始信息区块 */
  .info-section {
    display: none;
  }

  /* 显示中等屏幕信息盒子 */
  .medium-info-box {
    display: block;
    margin-top: 25px;
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  .medium-info-header {
    display: flex;
    align-items: center;
    padding: 15px 20px 0px;
  }

  .info-box-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }

  .customer-badge {
    margin-left: 12px;
    color: white;
    background: #1e88ba;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
  }

  .medium-info-content {
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
  }

  .medium-info-section {
    padding: 10px 0;
  }

  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 0 20px 10px;
  }

  .section-box {
    display: flex;
    justify-content: space-between;
  }

  .info-item {
    width: 28%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
  }

  .info-item-left {
    display: flex;
    align-items: center;
  }

  .info-item-left img {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }

  .info-item-left span {
    margin-left: 15px;
    font-size: 14px;
    color: #333;
  }

  .info-item-right {
    font-size: 14px;
    font-weight: bold;
    color: #333;
  }
}

/* ==========================================================================
   大屏幕样式 - 最大宽度1150px
   ========================================================================== */
@media screen and (max-width: 1150px) {
  .container {
    width: calc(100% - 50px);
  }

  .logo-container {
    width: 100%;
  }

  .image-overlay .image-overlay-title {
    font-size: clamp(60px, 5vw, 82px);
  }

  .image-bedroom {
    width: 31%;
    height: 180px;
  }
}

/* ==========================================================================
   小屏幕/平板样式 - 最大宽度768px
   ========================================================================== */
@media screen and (max-width: 768px) {
  /* 顶部导航 */
  .logo-container {
    display: none;
  }

  .logo-container-phone {
    width: 100%;
    display: flex;
    align-items: center;
  }

  .logo {
    height: 50px;
    margin-left: 10px;
  }

  /* 容器 */
  .container {
    width: 100%;
    padding: 0;
  }

  /* 导航项 */
  .navbar-item {
    width: 50%;
    margin-top: 15px;
  }

  /* 图片画廊 */
  .image-gallery {
    width: 100%;
    height: 348px;
    margin-top: 0px;
  }

  .main-image-container {
    width: 100%;
    padding: 10px;
  }

  .main-image {
    border-radius: 8px;
  }

  .image-right-container {
    display: none;
  }

  .image-overlay .image-overlay-title {
    font-size: 50px;
  }

  /* 移动端图片覆盖层底部 */
  .image-overlay-bottom {
    display: block;
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 23px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 5px;
  }

  .image-overlay-bottom-item {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 3px;
  }

  .image-overlay-bottom-item img {
    width: 15px;
    height: 14px;
  }

  .image-overlay-bottom-text {
    font-size: 15px;
    color: #e9e9e9;
  }

  /* 文本内容 */
  .text-title {
    padding: 0 10px;
  }

  .text-info {
    padding: 0 10px;
  }

  /* 信息区块 */
  .medium-info-box {
    display: none;
  }

  .info-section {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    gap: 10px;
  }

  .info-box {
    width: 95%;
    padding: 0 10px;
  }

  /* 卧室轮播 */
  .bedroom-carousel-container {
    display: none;
  }

  .bedroom-mobile-slider {
    margin-top: 15px;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    display: flex;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bedroom-card {
    padding: 0 10px;
    flex: 0 0 auto;
    overflow: hidden;
  }

  .bedroom-card img {
    height: 180px;
    border-radius: 8px;
  }

  /* 联系框 */
  .contact-box {
    display: none;
  }

  .desc-section {
    width: 100%;
  }

  /* 地图 */
  .map-container {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .map-container img {
    width: 95%;
    padding: 0 5px;
  }

  /* 页脚 */
  .footer {
    background-color: #fbfbfb;
    border-top: 1px solid #e0e0e0;
  }

  .footer-content {
    display: none;
  }

  .footer-communicate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
  }

  /* 模态框关闭按钮 */
  .close-modal {
    display: none;
  }
}

/* 懒加载图片样式 */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img.loaded, img:not([data-src]) {
  opacity: 1;
}

/* 为不同类型的懒加载图片设置合适的占位尺寸和背景 */
.main-image[data-src] {
  min-height: 400px;
  background-color: #f5f5f5;
}

.image-right[data-src] {
  min-height: 120px;
  background-color: #f5f5f5;
}

.image-bedroom[data-src] {
  min-height: 180px;
  background-color: #f5f5f5;
}

.mobile-bedroom-img[data-src] {
  min-height: 120px;
  background-color: #f5f5f5;
}

.hidden-image[data-src] {
  min-height: 50px;
  background-color: #f5f5f5;
}

/* 模态框中的图片 */
#modal-image[data-src] {
  min-height: 300px;
  background-color: #f5f5f5;
}

/* 缩略图 */
.thumbnail[data-src] {
  min-height: 60px;
  min-width: 60px;
  background-color: #f5f5f5;
}

/* 地图图片懒加载样式 */
.map-image[data-src] {
  min-height: 300px;
  background-color: #f5f5f5;
  width: 100%;
}

/* 添加加载中的动画效果 */
@keyframes pulse {
  0% { background-color: #f5f5f5; }
  50% { background-color: #e0e0e0; }
  100% { background-color: #f5f5f5; }
}

img[data-src] {
  animation: pulse 1.5s infinite ease-in-out;
}

/* 图片骨架屏 */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[data-src].skeleton {
  opacity: 1;
  background-color: #f0f0f0;
}

img.loaded {
  opacity: 1;
}

/* 缩略图加载动画 */
.thumbnail[data-src] {
  position: relative;
  min-height: 60px;
  min-width: 60px;
  background-color: #333;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.thumbnail[data-src]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: thumbnailSpin 1s linear infinite;
  z-index: 2;
}

@keyframes thumbnailSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.thumbnail.loaded {
  opacity: 1;
}

/* 确保缩略图容器有足够的高度 */
.thumbnails-container {
  min-height: 60px;
}

/* 添加更明显的加载状态 */
.thumbnail.loading {
  position: relative;
  background-color: #333;
}

.thumbnail.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: thumbnailSpin 1s linear infinite;
  z-index: 2;
}
