/**
 * 管家 FM 页（template-fm-page.php）Banner 与播放器
 * 依赖：custom-page.css（.custom-page-banner 背景）、main.css（.banner-single 高度/内边距）
 */

/* FM 页专属：仅同时带 .fm-page-banner 时生效，不影响其他使用 .custom-page-banner 的页面 */
.custom-page-banner.fm-page-banner {
  position: relative;
  background-image: url(https://res.qizhist.cn/wwwnew/images/banner/fm-banner-bg.jpg);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
}

.fm-page-banner .container {
  position: relative;
  z-index: 1;
}

/* 保持与原先 banner 一致的整体占位（main.css .banner-single 已设 min-height / padding） */
.fm-page-banner .banner-single.fm-page-banner__single {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.fm-page-banner__grid {
  display: grid;
  grid-template-columns: minmax(200px, 320px) minmax(280px, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.fm-page-banner__media {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  max-width: 320px;
  width: 100%;
  align-self: center;
}

/* 封面按原始宽高比缩放，不裁切、不变形 */
.fm-page-banner__cover {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.fm-page-banner__cover.is-hidden,
.fm-page-banner__cover--placeholder.is-hidden {
  display: none !important;
}

.fm-page-banner__cover--placeholder {
  aspect-ratio: 3 / 4;
  min-height: 200px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-sizing: border-box;
}

.fm-page-banner__body {
  color: #fff;
  font-family: inherit;
  text-align: left;
}

.fm-page-banner__kicker {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 400;
  opacity: 0.92;
  letter-spacing: 0.02em;
}

.fm-page-banner__title {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6563f7;
}

.fm-page-banner__intro-lines {
  margin: 0 0 24px;
  max-width: 520px;
}

.fm-page-banner__intro-line {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.65;
  opacity: 0.95;
}

.fm-page-banner__intro-line:last-child {
  margin-bottom: 0;
}

/* —— 播放器 —— */
.fm-page-player {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 14px 20px 16px;
  max-width: 100%;
}

.fm-page-player__track-title {
  margin: 0 0 10px;
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-page-player__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.fm-page-player__play {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #6563f7;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

.fm-page-player__play:hover {
  background: #f43f5e;
}

.fm-page-player__play:active {
  transform: scale(0.96);
}

.fm-page-player__play svg {
  display: block;
}

.fm-page-player__play.is-playing .fm-page-player__icon--play {
  display: none;
}

.fm-page-player__play:not(.is-playing) .fm-page-player__icon--pause {
  display: none;
}

.fm-page-player__time {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  min-width: 2.75em;
}

.fm-page-player__time--current {
  text-align: right;
}

.fm-page-player__progress-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.fm-page-player__progress {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.fm-page-player__progress::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, #6563f7 0%, #6563f7 var(--fm-progress, 0%), rgba(255, 255, 255, 0.35) var(--fm-progress, 0%));
  border-radius: 2px;
}

.fm-page-player__progress::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
}

.fm-page-player__progress::-moz-range-progress {
  height: 4px;
  background: #6563f7;
  border-radius: 2px;
}

.fm-page-player__progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6563f7;
  border: 2px solid #fff;
  margin-top: -5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.fm-page-player__progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6563f7;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.fm-page-player__volume {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100px;
}

.fm-page-player__vol-icon {
  display: flex;
  opacity: 0.85;
}

.fm-page-player__volume-range {
  width: 64px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.fm-page-player__volume-range::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.fm-page-player__volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6563f7;
  margin-top: -3px;
}

.fm-page-player__volume-range::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.fm-page-player__volume-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6563f7;
  border: none;
}

.fm-page-player.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 991px) {
  .fm-page-banner__grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    text-align: center;
  }

  .fm-page-banner__media {
    margin: 0 auto;
    width: min(100%, 280px);
  }

  .fm-page-banner__body {
    text-align: center;
  }

  .fm-page-banner__intro-lines {
    margin-left: auto;
    margin-right: auto;
  }

  .fm-page-player__row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .fm-page-player__progress-wrap {
    order: 3;
    flex-basis: 100%;
    width: 100%;
  }
}

/* ========== 正文：节目列表（三列卡片） ========== */
.fm-page-episodes {
  background: #fff;
  padding-top: 0;
  padding-bottom: 72px;
}

.fm-page-episodes__heading {
  margin: 60px 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: #111827;
  font-family: inherit;
}

.fm-page-episodes__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.fm-page-episodes__empty {
  margin: 0;
  text-align: center;
  color: #6b7280;
  font-size: 16px;
  padding: 48px 16px;
}

.fm-episode-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}

.fm-episode-card__inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  flex: 1;
  min-height: 100%;
  padding: 20px 18px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.fm-episode-card--active .fm-episode-card__inner {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08), 0 4px 14px rgba(37, 99, 235, 0.1);
}

.fm-episode-card__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fm-episode-card__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: #111827;
  font-family: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fm-episode-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: auto;
  font-size: 13px;
  color: #9ca3af;
}

.fm-episode-card__issue {
  color: #9ca3af;
}

.fm-episode-card__times {
  font-variant-numeric: tabular-nums;
  color: #9ca3af;
}

.fm-episode-card__play {
  flex-shrink: 0;
  align-self: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.fm-episode-card__play:hover:not(:disabled) {
  color: #1677ff;
  background: rgba(22, 119, 255, 0.08);
}

.fm-episode-card__play:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.fm-episode-card__play.is-playing {
  color: #1677ff;
}

.fm-episode-card__play .fm-episode-card__icon {
  display: block;
}

.fm-episode-card__play.is-playing .fm-episode-card__icon--play {
  display: none;
}

.fm-episode-card__play:not(.is-playing) .fm-episode-card__icon--pause {
  display: none;
}

.fm-episode-card__thumb {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  align-self: center;
}

.fm-episode-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.fm-episode-card__audio {
  display: none;
}

@media (max-width: 1199px) {
  .fm-page-episodes__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .fm-page-episodes__grid {
    grid-template-columns: 1fr;
  }

  .fm-episode-card__inner {
    flex-wrap: wrap;
  }

  .fm-episode-card__thumb {
    width: 88px;
    height: 88px;
  }
}
