/* ==========================================
 * 1. ベーススタイル
 * ========================================== */
/* body の余白をなくし、余白は main 側へ移す（ヘッダーを画面幅いっぱいにするため） */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  /*padding: 1rem;*/
  padding: 0;
  background-color: #f8fafc;
  color: #1e293b;
}

.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem; /*追加*/
  box-sizing: border-box;
}

/* ==========================================
 * 2. ヘッダー領域
 * ========================================== */
.app-header {
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  /*padding-top: env(safe-area-inset-top, 0px);*/
  position: sticky;         /* ★追加 */
  top: 0;
  z-index: 100;             /* モーダル(1000)より下、画面内容より上 */
  transition: padding 0.2s ease, box-shadow 0.2s ease;
}

/* 左側：ロゴ＆タイトル */
.app-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ★ <a> タグ自体を Flexbox にして横並びを強制 */
.header-home-link {
  display: flex;             /* 横並びにする */
  align-items: center;       /* 縦中央揃え */
  gap: 8px;                  /* ロゴと文字の間隔 */
  text-decoration: none;     /* 下線を消す */
  color: inherit;            /* 文字色を継承 */
}

.app-logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.2;
}

/* 右側：ユーザー名（上）＆ログアウトボタン（下） */
.app-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
  margin-left: 12px;
}

.login-user-display {
  font-size: 0.8rem;
  font-weight: bold;
  color: #475569;
}

.btn-link {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: #dc2626; }

/* スマホ表示の微調整 */
@media (max-width: 480px) {
  .app-logo { height: 32px; }
  .app-header h1 { font-size: 0.95rem; }
}

.app-logo { transition: height 0.2s ease; }
.app-header h1 { transition: font-size 0.2s ease; }

/* スクロール時：少し小さく＋影 */
.app-header.is-scrolled {
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
  padding-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.app-header.is-scrolled .app-logo { height: 26px; }
.app-header.is-scrolled h1 { font-size: 0.9rem; }

.login-user-display {
  max-height: 1.5em;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.2s ease, opacity 0.2s ease;
}

.app-header.is-scrolled .login-user-display {
  max-height: 0;
  opacity: 0;
}

/* ==========================================
 * 3. ボタン共通
 * ========================================== */
.btn-primary, .btn-secondary, .btn-danger {
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  color: #ffffff;
}
.btn-primary { background-color: #2563eb; }
.btn-primary:hover { background-color: #1d4ed8; }

.btn-secondary { background-color: #64748b; }
.btn-secondary:hover { background-color: #475569; }

.btn-danger { background-color: #dc2626; }
.btn-danger:hover { background-color: #b91c1c; }

/* ==========================================
 * 4. フォーム共通要素
 * ========================================== */
.form-group { margin-bottom: 0.8rem; }
.form-row { display: flex; gap: 0.5rem; }
.flex-1 { flex: 1; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 0.3rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 0.95rem;
}

.form-control:disabled {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

/* disabled だけでなく readonly もはっきり見やすく表示する */
.form-control:readonly {
  background-color: #f8fafc;
  color: #1e293b;
  border-color: #cbd5e1;
  cursor: default;
}

/* ==========================================
 * 5. モーダルダイアログ共通構造
 * ========================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  /* ★ここから追加 */
  max-height: 90vh;
  display: flex;
  flex-direction: column;

}

.modal-title {
  margin-top: 0;
  font-size: 1.2rem;
  color: #1e3a8a;
  flex-shrink: 0; /* タイトルは縮まないように固定 */
}

.modal-content {
  overflow-y: auto; /* ★本文だけがスクロールする */
  flex: 1;
  min-height: 0; /* flexで overflow を効かせるために必要 */
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.2rem;
  flex-shrink: 0; /* ボタン群は常に画面内に固定表示 */
  flex-wrap: wrap;
}

/* 左端に置くボタン（削除など）。残りは右寄せのまま */
.modal-action-left {
  margin-right: auto;
}

.modal-actions button {
  font-size: var(--fit-size, 0.85rem);
  padding: 0.55em 1.15em;
  white-space: nowrap;
}

body[data-role="member"] #btnNewPost,
body[data-role="member"] #btnOpenCreateModal { display: none; }

/* ==========================================
 * 6. ソーシャルメディア等ロゴ
 * ========================================== */

/* --- SNS・チケットロゴ 均等配置スタイル --- */
.social-links-grid {
  display: flex;
  justify-content: space-around; /* 4つのロゴを横一列に均等配置 */
  align-items: center;
  padding: 12px 4px 4px 4px;
  margin-top: 12px;
  border-top: 1px dashed #e2e8f0; /* 上部の区切り線 */
}

/* ホバー時のアニメーション */
.social-icon-item {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.social-icon-item:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}

/* 共通ロゴ画像サイズ */
.social-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

/* teketの横長ロゴ用調整 */
.teket-img {
  width: auto;
  height: 28px;
}

/* ==========================================
 * 7. 画面共通：戻るリンク・見出し行
 * ========================================== */
.back-to-home {
  display: inline-block;
  font-size: 0.85rem;
  color: #64748b;
  text-decoration: none;
  margin-bottom: 8px;
  padding: 4px 0;
}
.back-to-home:hover { color: #0066cc; }

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.header-actions h2 {
  font-size: 1.4rem;
  color: #1e293b;
  margin: 0;
}

