/* Playlists ページ固有のスタイル。ページの枠（.page / .page-hero / .page-content）、見出し（.section-heading / .result-count）、
   タグ（.stream-tags）、ボタン（.card-link）、バッジ（.badge-pill）、空表示（.list-empty）は styles.css の共通部品 */

.playlist-search {
  display: grid;
  grid-template-columns: minmax(210px, .65fr) minmax(0, 1.35fr);
  gap: 42px;
  align-items: center;
  padding: 32px 38px;
  background: rgba(255, 255, 255, .94);
  /* 枠・角丸・影はサムネイルと同じ基準 */
  border: 8px solid var(--pink);
  border-radius: 22px;
  box-shadow: 7px 8px 0 var(--cyan-shadow);
}

.search-heading p,
.search-form label,
.search-field input,
.search-field button,
.search-dates {
  font-family: "lexend-deca", "Helvetica Neue", Arial, sans-serif;
}

.search-heading p {
  margin: 0;
  color: var(--plum);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
}

.search-form .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.search-field input,
.search-field button {
  height: 54px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  padding: 0 17px;
  color: var(--plum);
  background: #fff;
  border: 2px solid rgba(65, 8, 55, .28);
  outline: none;
}

.search-field input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 0, 152, .12);
}

.search-field button {
  appearance: none;
  color: #fff;
  background: var(--plum);
  border: 0;
  cursor: pointer;
  letter-spacing: .06em;
  transition: background .2s ease, transform .2s ease, opacity .2s ease;
}

@media (min-width: 1231px) and (hover: hover) {
  .search-field button:hover:not(:disabled) {
    background: var(--pink);
    transform: translateY(-2px);
  }
}

.search-field button:disabled {
  cursor: default;
  opacity: .35;
}

/* 追加日の範囲。キーワード欄の下に「[from] 〜 [to]」 */
.search-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
}

.search-dates-sep {
  color: var(--plum);
  font-size: 13px;
  font-weight: 700;
}

.search-dates input {
  height: 40px;
  padding: 0 12px;
  color: var(--plum);
  background: #fff;
  border: 2px solid rgba(65, 8, 55, .28);
  border-radius: 9px;
  font-family: "din-2014", "Arial Narrow", Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

.search-dates-icon {
  width: 24px;
  height: 24px;
  color: var(--plum);
  flex-shrink: 0;
}

/* 入力欄に標準で付くカレンダーアイコン（Chrome / Edge / Safari PC）は隠し、枠外の .search-dates-icon に置き換える。
   隠すとアイコンのクリックで開けなくなるため、欄のどこをクリックしても開くよう playlists.js で showPicker() を呼ぶ */
.search-dates input::-webkit-calendar-picker-indicator {
  display: none;
}

.search-dates input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 0, 152, .12);
}

/* 空の日付欄の案内文字「年/月/日」。
   PC などは標準で表示されるため、iOS / iPadOS（-webkit-touch-callout を解釈するのは iOS の WebKit だけ）でのみ重ねる。
   入力済み（.is-filled。playlists.js が付け外しする）なら隠す */
.date-field {
  position: relative;
  display: inline-block;
}

.date-placeholder {
  display: none;
}

@supports (-webkit-touch-callout: none) {
  /* iOS / iPadOS の Safari は文字が16px未満の入力欄を選ぶと画面を自動で拡大するため、16pxにする */
  .search-field input,
  .search-dates input {
    font-size: 16px;
  }

  /* 空のときに欄が縮まないよう、入力後とほぼ同じ幅を確保する */
  .search-dates input {
    min-width: 150px;
  }

  .date-field:not(.is-filled) .date-placeholder {
    position: absolute;
    top: 50%;
    left: 14px;
    display: block;
    color: rgba(65, 8, 55, .45);
    font-family: "hiragino-kaku-gothic-pron", "Hiragino Kaku Gothic ProN", sans-serif;
    font-size: 16px;
    font-weight: 600;
    transform: translateY(-50%);
    pointer-events: none;
  }
}

.playlist-results {
  margin-top: 115px;
}

/* 見出し行は共通の .section-heading ＋ .result-count */
.playlist-results .section-heading {
  margin-bottom: 56px;
}

/* 一覧。PC は UPCOMING と同じ3列、タブレットは2列、スマートフォンは1列 */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 56px 32px;
}

/* 1件分。サムネイルの下にタイトル・タグ・リンクを縦に並べる。
   同じ行のカードは高さが揃うため、余った高さはサムネイル行ではなく文章行（1fr）に渡す。
   こうしないとサムネイル行が伸びてタイトルの位置がカードごとにずれる */
.playlist-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 20px;
  min-width: 0;
  padding: 10px 4px 6px;
}

.playlist-cover-stack {
  position: relative;
}

/* 背後に重ねる枠。format が「シリーズ」（プレイリスト）のときだけ付け、動画がフォルダーに束ねられた表現にする。
   「単発」の動画には付けない */
.playlist-cover-stack.is-series::before,
.playlist-cover-stack.is-series::after {
  content: "";
  position: absolute;
  border: 3px solid var(--plum);
  border-radius: 22px;
  background: #fff;
}

.playlist-cover-stack.is-series::before {
  inset: -10px 13px 10px -8px;
  opacity: .25;
  transform: rotate(-2.2deg);
}

.playlist-cover-stack.is-series::after {
  inset: -5px 7px 5px -4px;
  opacity: .5;
  transform: rotate(-1deg);
}

/* サムネイル。枠・角丸・影は他ページのサムネイルと同じ基準（styles.css の .stream-card などと同値） */
.playlist-cover {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  background: var(--pink);
  border: 8px solid var(--pink);
  border-radius: 22px;
  box-shadow: 7px 8px 0 var(--cyan-shadow);
}

.playlist-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform var(--thumb-hover-duration) ease;
}

@media (min-width: 1231px) and (hover: hover) {
  .playlist-cover:hover img {
    transform: scale(var(--thumb-hover-scale));
  }
}

/* 文章側：タイトル 19px/1.55 → タグ（共通 .stream-tags）→ 「YouTubeで再生」（共通のボタン .card-link） */
/* タイトルは上、タグと「YouTubeで再生」は配信カードと同じくカード下端で揃える */
.playlist-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.playlist-card-body .stream-tags {
  margin-top: auto;
  padding-top: 15px;
}

.playlist-card h3 {
  margin: 0;
  color: var(--plum);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.55;
}

/* 追加読み込み。一覧の末尾に置き、画面に入ると次の30件を読み込む。読み込み中はピンクのスピナー */
.playlist-more {
  display: flex;
  justify-content: center;
  padding: 40px 0 10px;
}

/* display: flex が hidden 属性（既定の display: none）より優先されるので、明示的に隠す */
.playlist-more[hidden] {
  display: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 5px solid rgba(255, 0, 152, .18);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1050px) {
  .playlist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .playlist-search {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 27px 22px 24px;
    border-width: 5px;
    border-radius: 15px;
    box-shadow: 5px 6px 0 var(--cyan-shadow);
  }

  .search-heading p {
    font-size: 21px;
  }

  .playlist-results {
    margin-top: 95px;
  }

  .playlist-results .section-heading {
    margin-bottom: 48px;
  }

  .playlist-grid {
    grid-template-columns: 1fr;
    gap: 58px;
  }

  .playlist-card {
    gap: 18px;
    padding: 8px 0 4px;
  }

  .playlist-cover-stack.is-series::before,
  .playlist-cover-stack.is-series::after {
    border-radius: 15px;
  }

  .playlist-cover {
    border-width: 5px;
    border-radius: 15px;
    box-shadow: 5px 6px 0 var(--cyan-shadow);
  }

  .playlist-card h3 {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .search-field {
    grid-template-columns: 1fr;
  }

  .search-field button {
    height: 44px;
  }
}
