/* MyTube 共通の部品（全ページで読み込む）
   チップ・ボタン・入力欄・スイッチ・ダイアログ・進捗バー。色は theme.css の --ui-* を使う */

/* 並べ替えなどのチップ */
.chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.1s ease;
}
.chip:hover { background: var(--ui-surface-hover); }
.chip.active {
  background: var(--ui-chip-on-bg);
  color: var(--ui-chip-on-text);
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 18px;
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ui-surface-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn--primary { background: var(--ui-chip-on-bg); color: var(--ui-chip-on-text); }
.btn--primary:hover { background: var(--ui-chip-on-bg); opacity: 0.85; }
.btn--danger { background: #cc0000; color: #fff; }
.btn--danger:hover { background: #a30000; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--ui-surface); }
.btn--large { height: 44px; padding: 0 24px; border-radius: 22px; font-size: 15px; }
.btn--block { width: 100%; }

/* 入力欄 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 500; }
.field__help { color: var(--ui-text-2); font-size: 13px; line-height: 1.5; }
.input,
.textarea,
.select {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--ui-input-border);
  border-radius: 8px;
  background: var(--ui-input-bg);
  color: var(--ui-text);
  font-size: 15px;
  outline: none;
}
.input, .select { height: 40px; }
.textarea { padding: 10px 12px; min-height: 96px; line-height: 1.5; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: #1c62b9; box-shadow: 0 0 0 1px #1c62b9; }
.input::placeholder, .textarea::placeholder { color: var(--ui-text-2); }

/* オン・オフのスイッチ（label の中に input[type=checkbox] と .switch__track を置く） */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch__track {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--ui-surface-hover);
  transition: background-color 0.15s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch__track { background: var(--ui-text); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--ui-bg); }
.switch input:focus-visible + .switch__track { outline: 2px solid #1c62b9; outline-offset: 2px; }

/* ダイアログ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.modal.hidden { display: none; }
.modal__panel {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 12px;
  background: var(--ui-menu-bg);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0 24px;
}
.modal__title { margin: 0; font-size: 20px; font-weight: 700; }
.modal__body { padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
}

/* 進捗バー */
.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--ui-surface-hover);
}
.progress__bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--ui-link);
  transition: width 0.3s ease;
}

/* 一覧の「読み込み中...」などの案内 */
.list-status {
  padding: 24px 0;
  text-align: center;
  color: var(--ui-text-2);
  font-size: 14px;
}
.list-status.hidden { display: none; }

/* サムネイル画像: 縦長・正方形の動画も切らずに全体を見せ、余白は同じ画像をぼかして埋める
   （枠に position: relative と overflow: hidden を付け、.thumb-bg → .thumb-img の順に置く） */
.thumb-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(12px) brightness(0.75);
  transform: scale(1.15);
}
.thumb-img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
