/**
 * 培训页样式 - 优化版
 * 减少冗余，提高可维护性
 */

/* ==================== CSS变量 ==================== */
:root {
  --train-card-shadow: 0 2px 20px 0 rgba(128, 191, 231, 0.34);
  --train-card-radius: 9px;
  --train-card-width: 310px;
  --train-card-height: 310px;
  --train-card-spacing: 30px;
  --train-title-gradient: linear-gradient(270deg, rgba(232, 245, 254, 0) 0%, #ecf4ff 100%);
}

/* ==================== 背景图片 ==================== */
.train {
  background: url("../images/train/banner_px.png") no-repeat center/cover;
}

.staff {
  background: url("../images/train/bg_shizi.png") no-repeat center/cover;
}

.review {
  background: url("../images/train/bg_xueshenghaoping.png") no-repeat center/cover;
}

/* ==================== 课程介绍卡片 ==================== */
.introduction > div {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.introduction > div:nth-child(1) {
  background-image: url("../images/train/px_cxb.png");
}

.introduction > div:nth-child(2) {
  background-image: url("../images/train/px_jyb.png");
}

.introduction > div:nth-child(3) {
  background-image: url("../images/train/px_ptb.png");
}

.introduction > div:nth-child(4) {
  background-image: url("../images/train/px_ymb.png");
}

/* 课程卡片内容区域 */
.introduction > div > div {
  background: white;
  border-radius: 11px;
  padding: 17px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.introduction > div:hover > div {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(40, 124, 250, 0.2);
}

/* 课程按钮 */
.introduction .w166 {
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.introduction .w166:hover {
  background-color: #1E6FE8;
  transform: scale(1.05);
}

/* ==================== 标题样式 ==================== */
.title {
  background: var(--train-title-gradient);
}

/* ==================== 师资卡片 ==================== */
.staff .w310 {
  width: var(--train-card-width);
  height: var(--train-card-height);
  background: white;
  border-radius: var(--train-card-radius);
  margin-bottom: var(--train-card-spacing);
  box-shadow: var(--train-card-shadow);
  padding: 36px 28px 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.staff .w310:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(128, 191, 231, 0.5);
}

/* 教师头像 */
.staff .w310 img {
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.staff .w310:hover img {
  transform: scale(1.1);
}

/* ==================== 校园环境网格 ==================== */
.container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}

.container .featured {
  grid-row: 1 / 4;
  grid-column: 1;
}

/* 图片悬停效果 */
.container > div {
  overflow: hidden;
  position: relative;
}

.container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.container > div:hover img {
  transform: scale(1.1);
}

/* 添加遮罩效果 */
.container > div::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(40, 124, 250, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.container > div:hover::after {
  background: rgba(40, 124, 250, 0.1);
}

/* ==================== 学生好评轮播 ==================== */
.review .swiper {
  overflow: visible;
}

.review .swiper-slide {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.review .swiper-slide:not(.swiper-slide-active) {
  opacity: 0.6;
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 1500px) {
  .staff .w-1500 {
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
  }
}

@media (max-width: 1200px) {
  .container {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .container .featured {
    grid-row: 1 / 3;
  }
}

@media (max-width: 768px) {
  /* 课程卡片 */
  .introduction {
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px;
  }

  .introduction > div {
    width: 100% !important;
    max-width: 280px;
    height: 320px !important;
  }

  /* 师资卡片 */
  .staff {
    height: auto !important;
    padding-bottom: 48px;
  }

  .staff .flex.flex-wrap {
    justify-content: center !important;
    gap: 16px;
  }

  .staff .w310 {
    width: 100% !important;
    max-width: 340px;
    height: auto !important;
    min-height: 280px;
  }

  /* 校园环境网格 */
  .container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 8px;
  }

  .container > div {
    width: 100% !important;
    height: auto !important;
  }

  .container .featured {
    grid-row: auto !important;
    grid-column: auto !important;
  }

  .container img {
    aspect-ratio: 16 / 10;
  }

  /* 学生好评 */
  .review {
    flex-direction: column !important;
    height: auto !important;
    padding: 48px 16px;
  }

  .review > div {
    margin-left: 0 !important;
    margin-top: 24px;
    width: 100% !important;
  }

  .review .swiper {
    width: 100% !important;
    height: 360px !important;
  }

  /* 图片高度自适应 */
  img[class*="h-1526"],
  img[class*="h524"] {
    height: auto !important;
  }

  /* 培训banner */
  .train {
    /* height: 240px !important; */
  }
}

/* ==================== 打印样式 ==================== */
@media print {
  .review,
  .container > div:hover::after {
    display: none;
  }
}

/* ==================== 性能优化 ==================== */
/* GPU加速 */
.staff .w310,
.introduction > div > div,
.container img {
  will-change: transform;
}

/* 减少动画（尊重用户偏好） */
@media (prefers-reduced-motion: reduce) {
  .staff .w310,
  .introduction > div > div,
  .container img,
  .review .swiper-slide {
    transition: none !important;
  }
}
