/* ========== 全体共通 ========== */
:root {
  /* テーマ色: ロータリーブルー(ロイヤルブルー)。変数名の --red は
     ひな形由来の識別子なので変えない(値だけ差し替える) */
  --red: #17458f;
  --red-dark: #0f3068;
  --bg: #f7eed6;
  --card: #ffffff;
  /* 年配の会員が多いため、文字色は濃いめにしている(2026-07-16) */
  --text: #333333;
  --text-sub: #555555;
  --line: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  /* 年配の会員が多いため、全体を1px大きめにしている(2026-07-16) */
  font-size: 17px;
  /* Windowsでは游ゴシックが細く淡く見えるため、読みやすい
     BIZ UDゴシック(Windows標準)を最優先にしている(2026-07-31) */
  font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a { color: var(--red); }
img { max-width: 100%; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

/* ========== ヘッダー ========== */
.site-header {
  background: var(--red);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.site-header .title {
  color: #fff;
  text-decoration: none;
  font-size: 19px;
  font-weight: bold;
  white-space: nowrap;
}

.site-header nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.site-header nav a {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
}

.site-header nav a:hover { text-decoration: underline; }

/* スマホ用ハンバーガーメニュー(ログイン後に auth.js renderHeader が
   ☰ボタンと has-menu を付ける。未ログインのページは今までどおり) */
.site-header .menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 25px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
@media (max-width: 720px) {
  .site-header.has-menu .inner { flex-wrap: wrap; }
  .site-header.has-menu .menu-btn { display: block; }
  /* メニューはふだん隠し、☰で .menu-open を付けたときだけ縦並びで開く */
  .site-header.has-menu nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    padding-bottom: 4px;
  }
  .site-header.has-menu.menu-open nav { display: flex; }
  .site-header.has-menu nav a {
    padding: 12px 4px;
    border-top: 1px solid rgba(255, 255, 255, .25);
    font-size: 16px;
  }
}

/* ========== ボタン・フォーム部品 ========== */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline {
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
}
/* 控えめなボタン(旧グレー)。テーマの紺に合わせた薄い青(2026-07-16) */
.btn-gray {
  background: #e8eefb;
  color: var(--red);
  border: 1px solid #c9d7f0;
}
.btn-gray:hover { background: #dbe6f9; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
}

textarea { resize: vertical; }

label.field-label {
  display: block;
  font-size: 14px;
  color: var(--text-sub);
  margin: 14px 0 4px;
}

.required::after {
  content: "必須";
  color: #fff;
  background: var(--red);
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.note { font-size: 13px; color: var(--text-sub); }

/* 管理ページから編集できる文言(改行をそのまま表示) */
.editable-text { white-space: pre-line; }

/* お問い合わせ一覧(管理者ページ) */
.inquiry-item {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

/* 読み取り専用の入力欄(住所の自動入力部分など) */
input[readonly] { background: #ececec; color: var(--text-sub); }

/* 文字数カウンター(マイページの入力欄) */
.char-counter { float: right; font-size: 13px; color: var(--text-sub); }
.char-counter-max { color: var(--red); font-weight: bold; }

/* ========== カード ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 17px;
  font-weight: bold;
  border-left: 4px solid var(--red);
  padding-left: 8px;
  margin-bottom: 12px;
}

/* ========== 会の案内(index) ========== */
.hero {
  background: var(--red);
  color: #fff;
  text-align: center;
  padding: 48px 16px;
}

.hero h1 { font-size: 27px; margin-bottom: 8px; }
.hero p { opacity: 0.95; }

.login-box { text-align: center; }
.login-box .btn { margin-top: 8px; }

.alert {
  background: #fdecea;
  border: 1px solid #f5c6c2;
  color: #a94442;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 15px;
}

/* ========== 会員一覧 ========== */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .search { flex: 1 1 240px; }
.toolbar select { flex: 0 1 200px; width: auto; }

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.member-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 14px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.1s;
}

/* 一覧カードの写真は大きめ(2026-07-16 に120px→180pxへ拡大)。
   切り取らず全体を表示(横長ロゴ等に対応) */
.member-card .avatar {
  width: 180px;
  height: 180px;
  object-fit: contain;
  background: #fff;
}

.member-card:hover { transform: translateY(-2px); }

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: #ddd;
  display: inline-block;
}

.avatar-lg { width: 160px; height: 160px; }

/* 会員詳細の写真は切り取らず全体を表示(横長のロゴ・店舗写真などに対応) */
.profile-box .avatar { height: auto; }

/* 事業所・商品写真(会員詳細の表示欄) */
.biz-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.biz-photos img { width: 100%; border-radius: 8px; }

/* 事業所・商品写真(マイページのアップロード欄) */
.biz-photo-edit { display: flex; gap: 16px; flex-wrap: wrap; }
.biz-photo-preview {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
  display: block;
  margin-bottom: 6px;
}

/* 顔写真の切り抜きエディタ(位置調整+拡大 → mypage.js) */
.photo-editor {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
}

.crop-box {
  position: relative;
  width: 240px;
  height: 240px;
  max-width: 100%;
  margin: 10px 0;
  overflow: hidden;
  border: 2px solid var(--red);
  border-radius: 8px;
  background: #eee;
  touch-action: none; /* 枠内のドラッグを画面スクロールと区別する */
  cursor: grab;
}

.crop-box img {
  position: absolute;
  max-width: none; /* 全体CSSの縮小指定を打ち消し、原寸ベースで動かす */
  user-select: none;
  pointer-events: none;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crop-zoom-row input[type="range"] { flex: 1; max-width: 240px; }

.member-card .name { font-size: 18px; font-weight: bold; margin-top: 8px; }
.member-card .company { font-size: 14px; color: var(--text-sub); }

.tag {
  display: inline-block;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 999px;
  font-size: 12px;
  padding: 1px 10px;
  margin: 6px 0;
}

.member-card .catch {
  font-size: 14px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;      /* 4行まで表示、あふれた分は省略 */
  min-height: 6.8em;          /* 4行分の高さを常に確保し、カードの高さを揃える */
}

.member-card .distance { font-size: 13px; color: var(--text-sub); }

.empty-message {
  text-align: center;
  color: var(--text-sub);
  padding: 40px 0;
}

/* ========== 会員詳細 ========== */
.detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 760px) {
  .detail-layout { grid-template-columns: 1fr; }
}

.profile-box { text-align: center; }
.profile-box .name { font-size: 23px; font-weight: bold; margin-top: 10px; }
.profile-box .company { color: var(--text-sub); }
.profile-box .catch { color: var(--text); font-weight: bold; margin: 8px 0; }

.contact-list { margin-top: 14px; text-align: left; }

.contact-list .row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 4px;
  font-size: 15px;
  text-decoration: none;
  color: var(--text);
}

.contact-list .row .icon { width: 20px; text-align: center; }

.badge {
  background: #eee;
  border-radius: 6px;
  font-size: 12px;
  padding: 1px 6px;
  color: var(--text-sub);
  white-space: nowrap;
}

.video-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #000;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.media-photos img { border-radius: 8px; width: 100%; }

.description { white-space: pre-wrap; }

/* ========== クラブブログ ========== */
.blog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.blog-page-title { font-size: 19px; font-weight: bold; }

.blog-item {
  display: block;
  color: inherit;
  text-decoration: none;
}

.blog-item:hover { transform: translateY(-2px); }

.blog-item-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--red);
  margin-top: 4px;
}

.blog-item-excerpt {
  font-size: 14px;
  color: var(--text);   /* あらすじは灰色でなく濃い黒で(読みやすさ優先) */
  margin-top: 4px;
}

.blog-post-title { font-size: 23px; margin: 6px 0 14px; }

.blog-cat-section { margin-bottom: 26px; }

/* 会員向け情報のカテゴリ見出し(青い縦棒+カテゴリ名)は大きく見せる */
.blog-cat-section .section-title {
  font-size: 24px;
  border-left-width: 6px;
  padding-left: 10px;
}

/* 動画付き記事(一覧上でそのまま再生できるカード) */
.blog-item-video .blog-item-title { display: inline-block; text-decoration: none; }
.blog-item-video .blog-item-title:hover { text-decoration: underline; }

.blog-more-btn { display: block; width: 100%; margin-top: 4px; }

.blog-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.blog-photos:empty { display: none; }

.blog-photos img { width: 100%; border-radius: 8px; }

/* 記事の添付PDFの埋め込み表示(blog-post.js が描画する) */
.post-pdfs { display: grid; gap: 20px; margin-top: 14px; }
.post-pdfs:empty { display: none; }
.pdf-page {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fff;
}
.pdf-doc .btn { margin-top: 4px; }

/* ========== マイページ編集 ========== */
.photo-edit {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.publish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.publish-row .value { flex: 1; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

.form-error { color: var(--red); font-size: 14px; margin-top: 10px; white-space: pre-wrap; }
.form-ok { color: #2e7d32; font-size: 15px; margin-top: 10px; }

/* ========== 管理者 ========== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

.admin-table th, .admin-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th { background: #fafafa; white-space: nowrap; }

.admin-table .actions { white-space: nowrap; }

.admin-table .btn { padding: 4px 10px; font-size: 13px; }

.table-wrap { overflow-x: auto; }

/* ========== フッター ========== */
.site-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  padding: 24px 0 40px;
}

/* ========== デモモード表示 ========== */
.demo-banner {
  background: #fff3cd;
  border-bottom: 1px solid #ffe08a;
  color: #7a5b00;
  text-align: center;
  font-size: 13px;
  padding: 4px 8px;
}
