/* ============================= */
/* ベース構造とレイアウト       */
/* ============================= */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* 外側スクロールを防止 */
  font-family: sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

:root {
  --navbar-height: 56px;
  --search-header-height: -70px; /* ← 実際の検索フォームの高さに合わせて調整 */
}

.wrapper {
  position: absolute;
  top: calc(var(--navbar-height) + var(--search-header-height)); /* ✅ ナビバー＋検索フォームの高さ分だけ下に配置 */
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* ============================= */
/* 固定領域：タイトル＋検索フォーム */
/* ============================= */

.search-header {
  flex-shrink: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
}

.search-header2 {
  flex-shrink: 0;
  padding: 16px 0;
  background-color: var(--bg);
}

.search-header h1 {
  margin: 0 0 12px;
  font-size: 1.4em;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.form-row label {
  font-weight: bold;
  margin-right: 4px;
}

.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="number"] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text);
}

#stream-limit {
  width: 60px;
  text-align: right;
}

#search-streams {
  padding: 6px 12px;
  margin-left: 4px;
}

/* ============================= */
/* スクロール領域：検索結果     */
/* ============================= */

#stream-results-wrapper {
  flex-grow: 1;
  min-height: 0;              /* ✅ Flexbox内でスクロールを有効にする */
  overflow-y: auto;
  padding: 16px 0;
  max-height: none !important; /* ✅ 他CSSの上書きを防ぐ */
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

#stream-results {
  height: auto;
  max-height: none;
  overflow-y: visible;
}

/* ============================= */
/* 検索結果カード                */
/* ============================= */

.stream-card {
  margin-bottom: 16px;
  padding: 12px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 6px var(--shadow);
}

.stream-title {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 4px;
}

.stream-date {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 8px;
}

.stream-header {
  display: block; /* ✅ Flexboxを使わず、縦並びに */
  text-align: right; /* ✅ ボタンを右寄せ */
}
.stream-header h3 {
  text-align: left;
  margin: 0;
  line-height: 1.4;
}

.stream-toggle-button {
  margin-top: 4px;
}


.common-button {
  display: inline-flex;
  align-items: center;         /* ✅ 垂直中央揃え */
  justify-content: center;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: bold;
  background-color: var(--main-mid); /* ✅ ホバー時の色（任意で定義） */
  color: var(--text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;

}
.common-button:hover {
  background-color: var(--main-dark); /* ✅ 通常時の背景色 */
  color: white;
}

/* ============================= */
/* 折り畳み曲一覧                */
/* ============================= */

.song-list.collapsed {
  display: none;
}

.song-list.expanded {
  display: block;
  margin-top: 0.5em;
}

/* ============================= */
/* 曲操作ボタン群                */
/* ============================= */

.result-table td button {
  margin-right: 4px;
}

.result-table th {
  background-color: var(--main-mid); /* ← ヘッダー背景色（例：薄グレー） */
  color: var(--main-dark);         /* ← ヘッダー文字色（例：濃いグレー） */
  font-weight: bold;
  padding: 8px;
  border-bottom: 2px solid var(--border); /* ← 下線を少し濃く */
  text-align: left;
}

.result-table th.number-col,
.result-table td.number-col {
  text-align: right;
  width: 40px;
  color: #444;
}

/* ============================= */
/* 共有モーダル                  */
/* ============================= */

#x-share-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 480px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 9999;
  box-sizing: border-box;

  /* ✅ 高さを内容に合わせて自動調整 */
  height: auto;
  max-height: none;
  overflow: visible;
}

#x-share-modal textarea {
  width: 100%;
  padding: 0.5em;
  font-size: 14px;
  margin-bottom: 1em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text);
}

#x-share-modal button {
  margin-right: 8px;
}

/* ✅ ボタンを横並びに整えるラッパー */
.modal-actions {
  display: flex;
  justify-content: flex-end; /* ← 右寄せ。中央にしたい場合は center */
  gap: 8px;                  /* ← ボタン間の余白 */
  margin-top: 8px;
}

#x-share-confirm {
  background-color: var(--main-mid);
  color: var(--main-dark);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#x-share-confirm:hover {
  background-color: var(--main-light);
  color: var(--main-dark);
}

#x-share-cancel {
  background-color: var(--main-mid);
  color: var(--main-dark);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#x-share-cancel:hover {
  background-color: var(--main-light);
  color: var(--main-dark);
}

/* ============================= */
/* アイコン群                    */
/* ============================= */

.action-icon {
  display: inline-block;
  margin-right: 6px;
  cursor: pointer;
}

.action-icon img.icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

#help-modal {
  all: unset; /* ✅ 競合スタイルを一旦リセット */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#help-modal.hidden {
  display: none !important;
}

#help-modal .modal-content {
  background: var(--bg);
  padding: 24px;
  max-width: 480px;
  width: calc(100% - 32px);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#help-modal .modal-content button {
  background: var(--main-mid);
  color: var(--text);
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  align-self: flex-end;
}


.result-table th:nth-child(1), /* 番号列 */
.result-table td.number-col {
  width: 20px;
  text-align: right;
}

.result-table th:nth-child(2), /* 曲名 */
.result-table td:nth-child(2) {
  width: 200px;
}

.result-table th:nth-child(3), /* アーティスト */
.result-table td:nth-child(3) {
  width: 180px;
}

.result-table th:nth-child(4), /* 操作列 */
.result-table td:nth-child(4) {
  width: 60px;
  vertical-align: middle;
  text-align: center;
}

/* ============================= */
/* ページネーション              */
/* ============================= */
.pagination {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 12px 0;
  background-color: var(--bg); /* 背景色を調整 */
  border-top: 1px solid var(--border);
  z-index: 1000; /* 他の要素より前面に */
}

.pagination button {
  padding: 6px 12px;
  background-color: var(--bg);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.pagination button.active {
  background-color: var(--main-mid);
  color: var(--main-dark);
  cursor: default;
}

.pagination button:hover {
  background-color: var(--main-dark);
  color: white;
}

#stream-results-wrapper {
  padding-bottom:   40px; /* ページネーションの高さ + 余白 */
}

.link-text {
  color: var(--main-dark);
  text-decoration: none;
}
.link-text:hover {
  color: var(--main-mid);
  text-decoration: none;
}



