
/* 多图浮动横幅样式 */
.float-banner {
  position: fixed;
  z-index: 9999;
  transition: all 0.3s ease;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
}

.float-banner-container {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  /* 让容器根据图片内容自适应 */
}

.float-banner-item {
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.float-banner-item:hover {
  transform: scale(1.05);
}

.float-banner-item img {
  width: auto;
  height: auto;
  display: block;
}

/* 根据图片类型设置尺寸限制 */
.float-banner-item.landscape img {
  /* 长条Banner：使用固定像素值避免布局冲突 */
  max-width: 600px;  /* 使用固定像素值，避免vw单位冲突 */
  max-height: 120px; /* 限制高度避免过高 */
  width: auto;
  height: auto;
  /* 保持宽高比，智能缩放 */
}

.float-banner-item.square img {
  /* 正方形：按实际效果比例缩放，不强制固定尺寸 */
  max-width: 250px;  /* 最大宽度限制 */
  max-height: 250px; /* 最大高度限制 */
  width: auto;
  height: auto;
  /* 保持正方形比例，智能缩放 */
}

.float-banner-item.portrait img {
  /* 竖长方形：限制宽度，允许合理高度 */
  max-width: 200px;
  max-height: 300px;
  width: auto;
  height: auto;
}

/* 关闭按钮样式 */
.float-banner-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  z-index: 10000;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.float-banner-close:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.float-banner-close:active {
  transform: scale(0.95);
}

/* 桌面端位置 - 大屏幕 */
@media (min-width: 769px) {
  .float-banner {
    left: 50%; bottom: 15px; transform: translateX(-50%);
  }
  
  .float-banner-container {
    /* 让容器根据内容自适应 */
  }
  
  .float-banner-close {
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 20px;
    top: -10px;
    right: -10px;
  }
}

/* 手机端位置 - 小屏幕 */
@media (max-width: 768px) {
  .float-banner {
    left: 50%; bottom: 10px; transform: translateX(-50%);
  }
  
  .float-banner-container {
    grid-template-columns: 1fr !important;
    grid-template-rows: repeat(4, 1fr) !important;
    /* 让容器根据内容自适应 */
  }
  
  .float-banner {
    min-width: 44px;
    min-height: 44px;
  }
  
  .float-banner:active {
    transform: scale(0.95);
  }
  
  .float-banner-close {
    width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 14px;
    top: -6px;
    right: -6px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .float-banner {
    transition: transform 0.2s ease;
  }
  
  .float-banner:active {
    transform: scale(0.95);
  }
  
  .float-banner-close:active {
    transform: scale(0.9);
  }
}
}

/* 移动端图片尺寸控制 - 使用更安全的尺寸限制 */
@media (max-width: 768px) {
  .float-banner-item.landscape img {
    /* 移动端长条Banner：使用固定像素值避免vw冲突 */
    max-width: 350px;  /* 使用固定像素值，避免vw单位冲突 */
    max-height: 80px;  /* 移动端限制更小的高度 */
    width: auto;
    height: auto;
  }
  
  .float-banner-item.square img {
    /* 移动端正方形：按比例缩放 */
    max-width: 120px;  /* 移动端最大宽度 */
    max-height: 120px; /* 移动端最大高度 */
    width: auto;
    height: auto;
  }
  
  .float-banner-item.portrait img {
    /* 移动端竖长方形：适度限制 */
    max-width: 100px;
    max-height: 150px;
    width: auto;
    height: auto;
  }
}
