/**
 * H/MIX GALLERY — fav-modal.css
 * お気に入りリストモーダル（共通スタイル）
 * TOP / Music Library 両ページで読み込む
 */

/* スクロールロック */
body.fav-modal-open {
  overflow: hidden;
}

/* モーダルルート — 非表示状態は hidden 属性 */
/* bottom: 88px でプレイヤー（height:88px / z-index:1200）を常に露出させる */
/* CSS変数をここで上書き → どのページから開いても Library dark と完全同一 */
.fav-modal {
  position: fixed;
  inset: 0 0 88px 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;

  /* ── Library dark テーマ変数をモーダルスコープに固定 ── */
  --color-text:         #e8f5ec;
  --color-text-muted:   #b0c8b8;
  --color-text-dim:     #6e8f76;
  --color-green:        #7ecb95;
  --color-green-light:  #9adfb4;
  --color-green-pale:   rgba(100, 200, 140, 0.12);
  --color-border:       rgba(100, 180, 130, 0.18);
}
.fav-modal[hidden] {
  display: none;
}

/* バックドロップ */
.fav-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 7, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* パネル */
.fav-modal__panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 2rem));
  height: min(580px, calc(100vh - 88px - 3rem));
  display: flex;
  flex-direction: column;
  background: rgba(14, 26, 18, 0.97);
  border: 1px solid rgba(100, 180, 130, 0.25);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(60, 140, 90, 0.08),
    0 12px 60px rgba(0, 0, 0, 0.72),
    0 0 40px rgba(40, 110, 70, 0.14);
  animation: favModalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes favModalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ヘッダー */
.fav-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(100, 180, 130, 0.12);
  flex-shrink: 0;
}

.fav-modal__title {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  color: var(--color-green-light, #9adfb4);
  font-weight: 400;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.fav-modal__total {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.70rem;
  letter-spacing: 0.06em;
  color: var(--color-text-dim, #6e8f76);
  font-weight: 400;
}

.fav-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(140, 180, 155, 0.50);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.fav-modal__close:hover {
  color: rgba(180, 220, 195, 0.90);
  border-color: rgba(100, 180, 130, 0.28);
  background: rgba(60, 140, 90, 0.12);
}
.fav-modal__close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ボディ — スクロール可能 */
.fav-modal__body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 160, 110, 0.30) transparent;
}
.fav-modal__body::-webkit-scrollbar { width: 4px; }
.fav-modal__body::-webkit-scrollbar-track { background: transparent; }
.fav-modal__body::-webkit-scrollbar-thumb {
  background: rgba(80, 160, 110, 0.30);
  border-radius: 2px;
}

/* リスト */
.fav-modal__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* アイテム */
.fav-modal__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.60rem 1.5rem;
  border-bottom: 1px solid rgba(80, 140, 100, 0.08);
  transition: background 0.15s ease;
}
.fav-modal__item:last-child { border-bottom: none; }
.fav-modal__item:hover { background: rgba(60, 120, 85, 0.10); }

/* 削除アニメーション */
.fav-modal__item--removing {
  overflow: hidden;
  animation: favItemOut 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}
@keyframes favItemOut {
  from { opacity: 1; max-height: 60px; padding-top: 0.60rem; padding-bottom: 0.60rem; }
  to   { opacity: 0; max-height: 0;    padding-top: 0;       padding-bottom: 0;       }
}

/* 再生ボタン */
.fav-modal__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(60, 130, 85, 0.18);
  border: 1px solid rgba(80, 160, 110, 0.28);
  color: rgba(120, 210, 155, 0.85);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.fav-modal__play:hover {
  background: rgba(70, 150, 100, 0.30);
  border-color: rgba(100, 190, 140, 0.50);
  color: rgba(160, 230, 185, 1);
  box-shadow: 0 0 10px rgba(80, 180, 120, 0.22);
}
.fav-modal__play svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  margin-left: 1px;
}

/* トラック情報 */
.fav-modal__info {
  flex: 1 1 0;
  min-width: 0;
}
.fav-modal__track-title {
  font-size: 0.82rem;
  color: var(--color-text, #e8f5ec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.fav-modal__track-tags {
  font-size: 0.65rem;
  color: var(--color-text-dim, #6e8f76);
  margin-top: 0.18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.03em;
}

/* 削除ボタン */
.fav-modal__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(200, 138, 50, 0.35);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.fav-modal__remove:hover {
  color: rgba(255, 168, 60, 0.88);
  border-color: rgba(255, 145, 45, 0.28);
  background: rgba(180, 100, 18, 0.14);
  box-shadow: 0 0 6px rgba(255, 160, 55, 0.20);
}
.fav-modal__remove svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

/* 空状態 */
.fav-modal__empty {
  text-align: center;
  color: var(--color-text-dim, #6e8f76);
  font-size: 0.80rem;
  padding: 3rem 2rem;
  margin: 0;
  letter-spacing: 0.06em;
}
.fav-modal__empty[hidden] { display: none; }

/* フッター */
.fav-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem 1.25rem;
  border-top: 1px solid rgba(100, 180, 130, 0.10);
  flex-shrink: 0;
}
.fav-modal__footer[hidden] { display: none; }

.fav-modal__footer-play {
  display: flex;
  gap: 0.5rem;
}

/* 再生・シャッフル・シアター再生ボタン */
.fav-modal__play-all,
.fav-modal__shuffle-all,
.fav-modal__play-theater {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(120, 210, 155, 0.80);
  background: rgba(40, 100, 65, 0.15);
  border: 1px solid rgba(80, 160, 110, 0.28);
  border-radius: 3px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fav-modal__play-all:hover,
.fav-modal__shuffle-all:hover,
.fav-modal__play-theater:hover {
  color: rgba(160, 235, 190, 0.95);
  border-color: rgba(100, 190, 140, 0.50);
  background: rgba(50, 120, 80, 0.25);
  box-shadow: 0 0 8px rgba(80, 180, 120, 0.15);
}
.fav-modal__play-all:disabled,
.fav-modal__shuffle-all:disabled,
.fav-modal__play-theater:disabled {
  color: rgba(80, 120, 95, 0.35);
  border-color: rgba(60, 100, 75, 0.18);
  background: transparent;
  cursor: default;
  pointer-events: none;
}

/* まとめてDLボタン */
.fav-modal__dl-all {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(210, 148, 62, 0.78);
  background: rgba(140, 90, 18, 0.12);
  border: 1px solid rgba(200, 130, 45, 0.28);
  border-radius: 3px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fav-modal__dl-all:hover {
  color: rgba(255, 184, 88, 0.96);
  border-color: rgba(255, 148, 45, 0.48);
  background: rgba(160, 100, 18, 0.20);
  box-shadow:
    0 0 8px  rgba(255, 170, 60, 0.28),
    0 0 18px rgba(255, 120, 35, 0.12);
}
.fav-modal__dl-all:disabled {
  color: rgba(160, 120, 55, 0.28);
  border-color: rgba(160, 110, 40, 0.14);
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.fav-modal__clear {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(190, 130, 50, 0.55);
  background: transparent;
  border: 1px solid rgba(200, 130, 45, 0.20);
  border-radius: 3px;
  padding: 0.4rem 1.25rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fav-modal__clear:hover {
  color: rgba(255, 168, 60, 0.88);
  border-color: rgba(255, 145, 45, 0.40);
  background: rgba(180, 100, 18, 0.12);
}

/* ── アイテム内レイアウト（チェックボックス対応） ── */
.fav-modal__item {
  gap: 0; /* innerDivに任せる */
  padding: 0;
}
.fav-modal__item-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.60rem 1.5rem 0.60rem 0.5rem;
  flex: 1 1 0;
  min-width: 0;
}

/* チェックボックス（申請選択） */
.fav-modal__select {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin: 0 0 0 1.5rem;
  cursor: pointer;
  accent-color: var(--color-green, #7ecb95);
  opacity: 0.75;
  transition: opacity 0.15s;
}
.fav-modal__select:hover,
.fav-modal__select:focus-visible {
  opacity: 1;
  outline: 1px solid rgba(100, 200, 140, 0.5);
  outline-offset: 2px;
}
.fav-modal__select:checked {
  opacity: 1;
}

/* チェック済みアイテムの背景 */
.fav-modal__item:has(.fav-modal__select:checked) {
  background: rgba(60, 120, 85, 0.08);
}
.fav-modal__item:has(.fav-modal__select:checked) .fav-modal__track-title {
  color: var(--color-green-light, #9adfb4);
}

/* ── フッター：ライセンス申請行 ── */
.fav-modal__footer {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.fav-modal__footer-license {
  width: 100%;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(100, 180, 130, 0.10);
}

.fav-modal__apply-license {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  color: rgba(200, 158, 72, 0.90);
  background: rgba(130, 88, 18, 0.14);
  border: 1px solid rgba(200, 148, 50, 0.32);
  border-radius: 3px;
  padding: 0.50rem 1rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fav-modal__apply-license:hover:not(:disabled) {
  color: rgba(255, 200, 100, 1);
  border-color: rgba(255, 175, 70, 0.55);
  background: rgba(160, 105, 20, 0.24);
  box-shadow: 0 0 10px rgba(255, 180, 70, 0.18);
}
.fav-modal__apply-license:disabled {
  color: rgba(150, 118, 58, 0.32);
  border-color: rgba(160, 120, 45, 0.16);
  background: transparent;
  cursor: default;
  pointer-events: none;
}
.fav-modal__apply-license svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fav-modal__apply-count {
  font-size: 0.68rem;
  opacity: 0.75;
  letter-spacing: 0.04em;
}

/* レスポンシブ */
@media (max-width: 600px) {
  .fav-modal__panel {
    height: calc(100vh - 88px - 0.5rem);
    border-radius: 6px 6px 0 0;
    align-self: flex-end;
  }
}
