/**
 * @file
 * 首页弹窗广告样式
 */

/* ========== 遮罩层 ========== */
.homepage-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  display: none;
}

/* ========== 弹窗主体 ========== */
.homepage-popup-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

/* ========== 内容容器 ========== */
.homepage-popup-content {
  padding: 24px;
}

/* ========== 图片 ========== */
.homepage-popup-image-wrapper {
  margin-bottom: 16px;
}

.homepage-popup-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  max-height: 300px;
  object-fit: cover;
}

/* ========== 标题 ========== */
.homepage-popup-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: bold;
  color: #333333;
  line-height: 1.3;
}

/* ========== 描述 ========== */
.homepage-popup-description {
  margin-bottom: 20px;
  font-size: 16px;
  color: #666666;
  line-height: 1.5;
}

/* ========== CTA 按钮 ========== */
.homepage-popup-cta-button {
  display: inline-block;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background-color: #007aff;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.homepage-popup-cta-button:hover {
  background-color: #0051d5;
  transform: scale(1.05);
}

/* ========== 次要按钮 ========== */
.homepage-popup-secondary-button {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  color: #999999;
  background: transparent;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: color 0.3s ease;
}

.homepage-popup-secondary-button:hover {
  color: #666666;
}

/* ========== 关闭按钮（角落） ========== */
.homepage-popup-close-button {
  position: absolute;
  width: 32px;
  height: 32px;
  font-size: 24px;
  color: #999999;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10;
}

.homepage-popup-close-button:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333333;
}

/* 关闭按钮位置 */
.homepage-popup-close-button--top-left {
  top: 8px;
  left: 8px;
}

.homepage-popup-close-button--top-right {
  top: 8px;
  right: 8px;
}

.homepage-popup-close-button--bottom-left {
  bottom: 8px;
  left: 8px;
}

.homepage-popup-close-button--bottom-right {
  bottom: 8px;
  right: 8px;
}

/* ========== 内联关闭按钮 ========== */
.homepage-popup-close-inline {
  margin-top: 16px;
  padding: 8px 16px;
  font-size: 14px;
  color: #999999;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* ========== 倒计时 ========== */
.homepage-popup-countdown {
  position: absolute;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  pointer-events: none;
}

.homepage-popup-countdown--top-left {
  top: 8px;
  left: 8px;
}

.homepage-popup-countdown--top-right {
  top: 8px;
  right: 8px;
}

.homepage-popup-countdown--bottom-left {
  bottom: 8px;
  left: 8px;
}

.homepage-popup-countdown--bottom-right {
  bottom: 8px;
  right: 8px;
}

/* ========== 动画效果 ========== */

/* 淡入缩放 */
.homepage-popup--animate-fadeZoom {
  animation: popupFadeZoomIn 0.3s ease-out;
}

@keyframes popupFadeZoomIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 从下滑入 */
.homepage-popup--animate-slideUp {
  animation: popupSlideUpIn 0.3s ease-out;
}

@keyframes popupSlideUpIn {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* 从上滑入 */
.homepage-popup--animate-slideDown {
  animation: popupSlideDownIn 0.3s ease-out;
}

@keyframes popupSlideDownIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* 翻转进入 */
.homepage-popup--animate-flip {
  animation: popupFlipIn 0.4s ease-out;
}

@keyframes popupFlipIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotateY(-90deg);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotateY(0);
  }
}

/* 关闭动画 - 淡出 */
.homepage-popup--closing-fade {
  animation: popupFadeOut 0.2s ease-in forwards;
}

@keyframes popupFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* 关闭动画 - 向上滑动 */
.homepage-popup--closing-slideUp {
  animation: popupSlideUpOut 0.2s ease-in forwards;
}

@keyframes popupSlideUpOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
}

/* 关闭动画 - 缩小消失 */
.homepage-popup--closing-scale {
  animation: popupScaleOut 0.2s ease-in forwards;
}

@keyframes popupScaleOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* 关闭动画 - 翻转消失 */
.homepage-popup--closing-flip {
  animation: popupFlipOut 0.2s ease-in forwards;
}

@keyframes popupFlipOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) rotateY(0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) rotateY(90deg);
  }
}

/* ========== 响应式 - 移动端 ========== */
@media (max-width: 768px) {
  .homepage-popup-modal {
    width: 90vw;
    max-width: 90vw;
    max-height: 85vh;
  }

  .homepage-popup-content {
    padding: 20px;
  }

  .homepage-popup-title {
    font-size: 20px;
  }

  .homepage-popup-description {
    font-size: 14px;
  }

  .homepage-popup-cta-button {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
  }

  .homepage-popup-secondary-button {
    width: 100%;
  }

  /* 底部弹出模式 */
  .homepage-popup-modal--bottom-sheet {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    border-radius: 16px 16px 0 0;
    margin: 0;
  }

  .homepage-popup-modal--bottom-sheet.homepage-popup--animate-slideUp {
    animation: popupBottomSheetSlideIn 0.3s ease-out;
  }

  @keyframes popupBottomSheetSlideIn {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* 全屏模式 */
  .homepage-popup-modal--fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    transform: none;
    margin: 0;
  }
}

/* ========== 可访问性 ========== */
@media (prefers-reduced-motion: reduce) {
  .homepage-popup-modal,
  .homepage-popup-close-button,
  .homepage-popup-cta-button {
    animation: none !important;
    transition: none !important;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .homepage-popup-modal {
    border: 2px solid #000000;
  }

  .homepage-popup-close-button {
    border: 1px solid #000000;
  }
}
