/**
 * ファイル名 : style.css
 * 概要       : 全体共通スタイル定義。
 *              レイアウト、フォーム、テーブル、ナビゲーション、検索結果などの基本構造を統一。
 * 対象画面   : 全画面共通（検索・登録・編集・管理）
 * 作成者     : Wais
 * 作成日     : 2025-09-08（再構成）
 */

/* 全体レイアウトと基本色 */
html, body {
  margin: 0;
  padding: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  overflow: hidden; /* ← ブラウザ全体のスクロールを禁止 */
}

/* 本文領域の余白と中央配置 */
main.container {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 64px;
}

h1, h2, h3 {
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--heading-color);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

h1 {
  text-align: center;
  font-size: 1.8em;
  margin-top: 6px;
  padding-bottom: 4px;
}

h2 {
  font-size: 1.4em;
  color: var(--main-dark);
}

h3 {
  font-size: 1.2em;
  color: var(--subheading-color);
}

/* セクションレイアウト */
section {
  margin: 24px 0;
}

/* フォームレイアウト */
.search-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 0;
}

.form-group {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
}

input[type="text"],
input[type="month"],
input[type="password"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 6px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* ボタン共通スタイル */
button,
.register-button,
.primary-button {
  padding: 8px 16px;
  background-color: #4caf50;
  color: white;
  border: none;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  margin-top: 8px;
  transition: background-color 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

button:hover,
.register-button:hover,
.primary-button:hover {
  background-color: #388e3c;
}

/* 検索結果ヘッダーと補助表示 */
.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.results-heading h2 {
  margin: 0;
  font-size: 20px;
  color: #2e7d32;
}

.results-meta {
  font-size: 14px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 検索結果ヘッダー行 */
.results-header-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1.5fr 1fr;
  background-color: #e8f5e9;
  padding: 8px;
  font-weight: bold;
  border-bottom: 1px solid #ccc;
}

.header-cell {
  padding: 4px 8px;
  color: #2e7d32;
}

/* 検索結果リスト */
.results-scroll-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
}

.result-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1.5fr 1fr;
  padding: 8px;
  border-bottom: 1px solid #eee;
}

.result-row:hover {
  background-color: #eefaf2;
  cursor: pointer;
}

.title-kana,
.artist-kana {
  font-size: 13px;
  color: #777;
}

/* エラーメッセージ */
.error-message,
.placeholder {
  color: crimson;
  text-align: center;
  margin: 16px 0;
  font-weight: bold;
}

/* パスワード表示切替 */
.password-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-wrapper input {
  flex: 1;
}

/* ポップアップ登録フォーム */
.popup {
  display: none;
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 16px;
  border: 1px solid #aaa;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 10;
  width: 400px;
  border-radius: 6px;
}

.popup h2 {
  margin-top: 0;
  text-align: center;
}

.popup input,
.popup select {
  margin-bottom: 8px;
  width: 100%;
}

.stream-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
}

.stream-table th,
.stream-table td {
  padding: 8px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

.stream-table th {
  background-color: #e8f5e9;
  color: #2e7d32;
  font-weight: bold;
}

.stream-table td.actions {
  text-align: right;
  white-space: nowrap;
}

.icon-button {
  font-size: 18px;
  margin-left: 12px;
  cursor: pointer;
  color: #555;
}

.icon-button:hover {
  color: #2e7d32;
}

/* ユーザー編集・プロフィール編集フォーム */
form.centered-form {
  max-width: 400px;
  margin: 32px auto;
  padding: 16px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 0 5px rgba(0,0,0,0.05);
}

#x-share-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid #ccc;
  padding: 16px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  border-radius: 6px;
}

#x-share-text {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 12px;
}

#x-share-confirm,
#x-share-cancel {
  padding: 8px 16px;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#x-share-confirm {
  background-color: #1da1f2;
  color: white;
}

#x-share-cancel {
  background-color: #eee;
  color: #333;
  margin-left: 8px;
}

/* ユーザー管理テーブル */
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 24px;
}

th, td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
}

th {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.add-button-wrapper {
  text-align: right;
  margin-top: 12px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex; /* ✅ これがないと中身が表示されません */
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-content button {
  align-self: flex-end; /* ✅ 右下に寄せる */
  margin-top: auto;     /* ✅ 下端に押し出す */
  background-color: var(--main-mid);
  color: var(--main-dark); /* ← コントラストを保つために濃色文字に */
}

.modal-content button:hover {
  background-color: var(--main-dark); /* ← ホバー時は少し濃くして操作感を演出 */
  color: white;
}

.modal-content ul li {
  margin-bottom: 12px; /* ✅ 下に余白を追加 */
}

.modal.hidden {
  display: none;
}

.help-icon {
  position: fixed;
  top: 20px;
  right: 1em;
  width: 16px;
  height: 16px;
  cursor: pointer;
  z-index: 1000;
}

.overlay-image {
  position: fixed;
  margin-top: 6px;
  left: 1em;
  z-index: 1000;
  pointer-events: none;
  width: 120px;
  height: auto;
  box-sizing: border-box;
}

.overlay-image img {
  width: 120px;
  height: auto;
  opacity: 0.8;
  display: block;
}

