/* ===================================================================
 *  喜马拉雅风音频播放器 — 主样式
 *  配色：米白底（#fafaf6）+ 喜马拉雅红品牌色（#c0392b）
 *  设计：参考喜马拉雅 FM 网页版 + 移动端
 * =================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --brand: #c0392b;
  --brand-dark: #962d22;
  --brand-light: #e85a4a;
  --bg: #fafaf6;
  --bg-soft: #f4f1ea;
  --card: #ffffff;
  --text: #2c2c2a;
  --text-soft: #6a6a66;
  --text-mute: #999994;
  --border: #ececea;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --topbar-h: 56px;
  --player-h: 80px;  /* 适配 APlayer 吸底高度 */
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  /* 留出底部空间给吸底播放器 */
  min-height: 100vh;
  padding-bottom: var(--player-h);
}

/* ============ 顶部品牌区 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
  font-size: 18px;
}

.brand-logo { font-size: 22px; }

.breadcrumb {
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a {
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--brand); }

.breadcrumb .sep {
  color: var(--text-mute);
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

/* ============ 主视图 ============ */
.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: calc(100vh - var(--topbar-h) - var(--player-h) - 100px);
}

/* ============ 列表页：专辑卡片网格 ============ */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.album-card {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.album-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.album-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.album-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-card-cover .cover-fallback {
  font-size: 60px;
  color: rgba(255, 255, 255, 0.85);
}

.album-card-body {
  padding: 12px 14px 14px;
}

.album-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-card-author {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.album-card-meta {
  font-size: 11px;
  color: var(--text-mute);
  display: flex;
  justify-content: space-between;
}

/* ============ 详情页 ============ */
.album-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  margin-bottom: 28px;
}

.album-detail-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.album-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-detail-cover .cover-fallback {
  font-size: 120px;
  color: rgba(255, 255, 255, 0.85);
}

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

.album-detail-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.album-detail-author {
  font-size: 14px;
  color: var(--text-soft);
}

.album-detail-author .label {
  color: var(--text-mute);
  margin-right: 6px;
}

.album-detail-desc {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

.album-detail-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover { background: var(--brand-dark); }

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-ghost:hover { background: var(--brand); color: #fff; }

/* ============ 章节列表 ============ */
.episodes {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.episodes-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.episodes-header .count {
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 400;
}

.episode-list {
  list-style: none;
  max-height: 600px;
  overflow-y: auto;
}

.episode-item {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  gap: 12px;
}

.episode-item:last-child { border-bottom: none; }

.episode-item:hover { background: var(--bg-soft); }

.episode-item.active {
  background: rgba(192, 57, 43, 0.06);
  border-left: 3px solid var(--brand);
  padding-left: 15px;
}

.episode-item.played .episode-title { color: var(--text-mute); }

.episode-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.episode-item.active .episode-num {
  background: var(--brand);
  color: #fff;
}

.episode-info {
  flex: 1;
  min-width: 0;
}

.episode-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.episode-meta {
  font-size: 11px;
  color: var(--text-mute);
  display: flex;
  gap: 12px;
}

.episode-progress {
  font-size: 11px;
  color: var(--brand);
  font-weight: 500;
}

.episode-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: all 0.15s;
}

.episode-item:hover .episode-play {
  background: var(--brand);
  color: #fff;
}

.episode-item.active .episode-play {
  background: var(--brand);
  color: #fff;
}

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}

.empty-icon {
  font-size: 60px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-text {
  font-size: 14px;
}

/* ============ 加载状态 ============ */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-mute);
  font-size: 13px;
}

.loading::after {
  content: '...';
  animation: dots 1.4s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ============ 底部 ============ */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--text-mute);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ============ APlayer 吸底适配 ============ */
.player-slot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
}

.aplayer {
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .album-detail {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .album-detail-cover {
    max-width: 200px;
    margin: 0 auto;
  }

  .album-detail-title { font-size: 20px; }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .topbar-inner { padding: 0 14px; }
  .view { padding: 16px 14px; }

  .breadcrumb { font-size: 12px; }
}

@media (max-width: 480px) {
  .album-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
