/* ==========================================================================
   小学校保護者専用ページ＆管理システム スタイルシート (style.css)
   ========================================================================== */

/* --- デザインシステム変数 --- */
:root {
  --primary: #1e40af;            /* 信頼感のあるネイビーブルー */
  --primary-light: #eff6ff;      /* 薄いブルートーン */
  --primary-hover: #1d4ed8;
  --secondary: #0d9488;          /* 温かみのあるティールグリーン */
  --accent-emergency: #dc2626;   /* 緊急連絡用レッド */
  --accent-emergency-bg: #fef2f2;
  --accent-event: #ea580c;       /* 行事・お知らせ用オレンジ */
  --accent-event-bg: #fff7ed;
  --accent-tayori: #2563eb;      /* 学校だより用ブルー */
  --accent-tayori-bg: #eff6ff;
  --accent-daily: #059669;       /* 日々の様子用エメラルドグリーン */
  --accent-daily-bg: #ecfdf5;

  --bg-main: #f1f5f9;            /* 目に優しいスレートグレー背景 */
  --card-bg: #ffffff;
  --text-main: #1e293b;          /* 視認性の高いダークスレート */
  --text-sub: #64748b;           /* 控えめなサブテキスト */
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", Meiryo, sans-serif;
}

/* リセット＆基本設定 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.65;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

/* コンテナ（スマホファースト & PC中央揃え） */
.app-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   ヘッダー
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.school-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.school-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.page-tagline {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-school-home {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d9488;
  background-color: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-school-home:hover, .btn-school-home:active {
  background-color: #ccfbf1;
  color: #0f766e;
  border-color: #5eead4;
  transform: translateY(-1px);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-logout:hover, .btn-logout:active {
  background-color: #e2e8f0;
  color: var(--text-main);
}

/* ==========================================================================
   カテゴリ切り替えタブ（スマホ2段折り返し対応）
   ========================================================================== */
.category-nav-wrapper {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  position: sticky;
  top: 63px;
  z-index: 90;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 2px 0;
}

.tab-btn {
  flex: 1 1 calc(33.333% - 6px);
  min-width: 90px;
  max-width: 200px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  box-sizing: border-box;
}

.tab-btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.25);
}

.tab-btn.emergency {
  border-color: #fecaca;
  color: #dc2626;
  background-color: #fffafb;
}

.tab-btn.emergency.active {
  background: var(--accent-emergency);
  color: #ffffff;
  border-color: var(--accent-emergency);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   タイムライン表示エリア
   ========================================================================== */
.timeline-container {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 記事カード（Instagram/LINEタイムライン風） */
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* 緊急連絡カードの特別装飾 */
.post-card.category-emergency {
  border-left: 5px solid var(--accent-emergency);
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 60px);
}

.card-header {
  padding: 16px 16px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.badge-daily {
  background-color: var(--accent-daily-bg);
  color: var(--accent-daily);
}

.badge-tayori {
  background-color: var(--accent-tayori-bg);
  color: var(--accent-tayori);
}

.badge-event {
  background-color: var(--accent-event-bg);
  color: var(--accent-event);
}

.badge-emergency {
  background-color: var(--accent-emergency-bg);
  color: var(--accent-emergency);
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.97); }
}

.post-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-body {
  padding: 0 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-main);
}

.post-card.category-emergency .post-title {
  color: #991b1b;
}

.post-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #334155;
  word-break: break-word;
  white-space: pre-wrap;
}

.post-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 写真ギャラリー表示（アスペクト比維持・高さ固定撤廃） */
.card-media {
  margin: 6px 0 10px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: transparent;
}

/* 共通写真ギャラリーコンテナ */
.photo-gallery {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 個別写真アイテム枠（中央寄せ・はみ出し防止） */
.photo-item {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8fafc;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  width: 100%;
}

.photo-item img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: contain; /* 上下左右の切り抜きを無くし写真全体を表示 */
  border-radius: var(--radius-sm);
  margin: 0 auto;
}

/* 1枚の場合：横幅いっぱい（最大400px）で自然な高さ */
.photo-gallery-1 .photo-item {
  max-width: 400px;
  margin: 0 auto;
  border: none;
  background: transparent;
}

.photo-gallery-1 .photo-item img {
  max-width: 400px;
}

/* 2枚の場合：横並び2分割、自然な高さ */
.photo-gallery-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-gallery-2 .photo-item {
  width: 100%;
  height: auto;
}

/* 3枚の場合：1枚目を上段に大きく配置、2枚目・3枚目を下段に横並び配置 */
.photo-gallery-3 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.photo-gallery-3 .photo-featured {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border: none;
  background: transparent;
}

.photo-gallery-3 .photo-featured img {
  max-width: 400px;
}

.photo-gallery-3 .photo-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.photo-gallery-3 .photo-sub-row .photo-item {
  width: 100%;
  height: auto;
}

/* 旧クラス互換性フォールバック（万が一のキャッシュ用） */
.photo-grid-1 img, .photo-grid-2 img, .photo-grid-3 img {
  object-fit: contain !important;
  height: auto !important;
  max-width: 100%;
}
.photo-grid-3 {
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

/* 写真のキャプション・案内（AI悪用抑止等のプライバシー注記） */
.photo-privacy-notice {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.photo-privacy-notice.photo-notice-event {
  color: #0284c7;
  font-weight: 600;
}

/* PDF添付ボタン（親指で押しやすい全幅大型ボタン） */
.pdf-download-wrap {
  margin-top: 6px;
}

.btn-pdf-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  min-height: 52px;
}

.btn-pdf-view:hover, .btn-pdf-view:active {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.4);
}

.btn-pdf-view .pdf-icon {
  font-size: 1.35rem;
}

.btn-pdf-view .pdf-sub {
  font-size: 0.75rem;
  font-weight: normal;
  opacity: 0.9;
  display: block;
}

/* 空状態のメッセージ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  color: var(--text-sub);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

/* ==========================================================================
   合言葉ログイン画面（parents.php）
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #e0f2fe 0%, #f1f5f9 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 24px;
  text-align: center;
}

.login-school-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.login-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 24px;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #f8fafc;
  color: var(--text-main);
}

.form-input:focus {
  border-color: var(--border-focus);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-sub);
  line-height: 1.4;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
  transition: all 0.2s ease;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
}

.btn-secondary {
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: #e2e8f0;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* アラートメッセージ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.alert-error {
  background-color: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-success {
  background-color: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.alert-warning {
  background-color: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

/* ==========================================================================
   管理者画面（admin.php）特有スタイル
   ========================================================================== */
.admin-container {
  max-width: 800px;
}

.admin-header {
  background: #1e293b;
  color: #ffffff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.admin-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* 操作マニュアル用スタイル（視認性向上と他ボタンとの調和） */
.admin-nav-manual {
  color: #fef08a;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-weight: 700;
}

.admin-nav-manual:hover {
  color: #ffffff;
  background: rgba(245, 158, 11, 0.32);
  border-color: #fbbf24;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.admin-main {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* 管理セクション（カード） */
.admin-section {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-content {
  padding: 20px;
}

/* 編集中のハイライトヘッダー */
.editing-banner {
  background-color: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #92400e;
  font-weight: 700;
}

/* カテゴリ選択（大きなボタン風ラジオグループ） */
.category-radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.category-radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-sub);
  background-color: #f8fafc;
  transition: all 0.2s ease;
  user-select: none;
}

.category-radio-label input[type="radio"] {
  display: none;
}

.category-radio-label:hover {
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.category-radio-label.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.15);
}

.category-radio-label.cat-emergency.selected {
  border-color: var(--accent-emergency);
  background-color: var(--accent-emergency-bg);
  color: var(--accent-emergency);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

/* 添付ファイル選択セクション */
.attach-type-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.attach-type-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background-color: #f8fafc;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.attach-type-btn.active {
  background-color: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.file-upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background-color: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.file-upload-box:hover {
  border-color: var(--primary);
  background-color: #f1f5f9;
}

.file-upload-icon {
  font-size: 2rem;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: block;
}

.file-upload-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.file-upload-sub {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 4px;
}

/* 添付プレビューエリア */
.preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.preview-item {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-badge-pdf {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px;
  text-align: center;
}

/* 投稿一覧リスト（教員向け直感テーブル/カード） */
.post-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  gap: 12px;
  transition: background 0.15s ease;
}

.post-admin-item:hover {
  background-color: #f8fafc;
}

.post-admin-info {
  flex: 1;
  min-width: 0;
}

.post-admin-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.post-admin-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-admin-snippet {
  font-size: 0.8rem;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.post-admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-edit {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background-color: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-edit:hover {
  background-color: #dbeafe;
}

.btn-delete {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-delete:hover {
  background-color: #fee2e2;
}

/* 設定カード */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.setting-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.current-passcode-display {
  display: inline-block;
  padding: 6px 14px;
  background-color: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin: 6px 0 12px 0;
}

/* フッター */
.site-footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background-color: #ffffff;
  margin-top: auto;
}

.site-footer p {
  margin-bottom: 4px;
}

/* レスポンシブ微調整 */
@media (max-width: 480px) {
  .header-titles .school-name {
    font-size: 0.9rem;
  }
  .post-title {
    font-size: 1.05rem;
  }
  .card-header, .card-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .post-admin-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .post-admin-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ==========================================================================
   緊急連絡のピン留め固定表示枠
   ========================================================================== */
.pinned-emergency-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 4px;
}

.pinned-emergency-card {
  border: 2px solid #ef4444;
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pinned-emergency-header {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.04em;
}

.pinned-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pinned-emergency-body {
  padding: 14px 16px;
  background: #fffafa;
}

/* ==========================================================================
   ページネーション（親指操作対応大型ボタン）
   ========================================================================== */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 8px 8px 8px;
  margin-top: 10px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
  transform: translateY(-1px);
}

.pagination-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.35);
}

.pagination-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.pagination-info {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 6px;
}

/* ==========================================================================
   画像の拡大プレビュー（ライトボックス）
   ========================================================================== */
.photo-item img {
  cursor: zoom-in;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-item img:hover {
  opacity: 0.92;
}

body.modal-open {
  overflow: hidden !important;
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox-overlay.show {
  opacity: 1;
  visibility: visible;
}

.lightbox-container {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-container.lightbox-highres {
  max-width: min(94vw, 860px);
}

.lightbox-badge {
  position: absolute;
  top: -42px;
  left: 0;
  background: rgba(3, 105, 161, 0.9);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.6);
  background: #ffffff;
  transition: max-width 0.2s ease;
}

.lightbox-container.lightbox-highres .lightbox-img {
  max-width: min(100%, 800px);
  max-height: 85vh;
}

.lightbox-close-btn {
  position: absolute;
  top: -46px;
  right: 0;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-full);
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
  background: rgba(239, 68, 68, 0.9);
  border-color: #ef4444;
  transform: scale(1.08);
}

/* ==========================================================================
   PDF全画面モーダル表示
   ========================================================================== */
.pdf-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pdf-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.pdf-modal-header {
  height: 58px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 10;
  flex-shrink: 0;
}

.pdf-modal-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

.pdf-modal-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pdf-modal-newtab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #93c5fd;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pdf-modal-newtab:hover {
  color: #bfdbfe;
}

.pdf-modal-close-btn {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pdf-modal-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.pdf-modal-body {
  flex: 1;
  width: 100%;
  height: calc(100vh - 58px);
  background: #334155;
  overflow: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.pdf-modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ==========================================================================
   管理画面 写真解像度（リサイズ上限）切り替えUI
   ========================================================================== */
.photo-resolution-selector {
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.photo-resolution-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.photo-resolution-hint {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text-muted);
}

.photo-resolution-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.photo-resolution-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.photo-resolution-option:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.photo-resolution-option.is-selected {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.08);
}

.photo-resolution-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

.photo-resolution-option .res-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.photo-resolution-option .res-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.photo-resolution-option .res-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.photo-resolution-option .res-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.res-badge-default {
  background: #e2e8f0;
  color: #475569;
}

.res-badge-event {
  background: #dbeafe;
  color: #1e40af;
}

.photo-resolution-option .res-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==========================================================================
   管理画面 写真添付3分割スロット用スタイル
   ========================================================================== */
.photo-upload-slots {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.photo-slot-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.photo-slot-card.has-file {
  background: #f0fdf4;
  border-color: #86efac;
}

.photo-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.photo-slot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.photo-slot-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.photo-slot-badge.badge-main {
  background-color: #dbeafe;
  color: #1e40af;
}

.photo-slot-badge.badge-sub {
  background-color: #f1f5f9;
  color: #475569;
}

.photo-slot-desc {
  font-size: 0.76rem;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.photo-slot-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.photo-slot-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px;
  background: #ffffff;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
}

.photo-slot-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.photo-slot-info {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.photo-slot-clear-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-slot-clear-btn:hover {
  background: #fee2e2;
}

/* ==========================================================================
   管理画面 ピン留め設定枠・バッジ・ページネーション
   ========================================================================== */
.pin-checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #fecaca;
  background-color: #fffafb;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.pin-checkbox-card:hover {
  background-color: #fef2f2;
  border-color: #f87171;
}

.pin-checkbox-card input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #dc2626;
  cursor: pointer;
  flex-shrink: 0;
}

.pin-checkbox-text {
  display: flex;
  flex-direction: column;
}

.pin-checkbox-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #991b1b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pin-checkbox-desc {
  font-size: 0.78rem;
  color: #7f1d1d;
  margin-top: 2px;
}

.badge-pinned {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-weight: 700;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.admin-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-page-btn:hover:not(.disabled):not(.active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
}

.admin-page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.admin-page-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
  background: #f8fafc;
}

/* --- 年度アーカイブボタン・カード設定 --- */
.btn-warning {
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #d97706, #b45309);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(180, 83, 9, 0.2);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #b45309, #92400e);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.3);
}

.archive-setting-card {
  position: relative;
  transition: box-shadow 0.2s ease;
}

.archive-setting-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* --- 年度切り替えセレクター・アーカイブUI --- */
.year-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #f8fafc;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.year-selector-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.year-selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.year-select {
  padding: 8px 32px 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-width: 170px;
  transition: all 0.2s ease;
}

.year-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 過去年度アーカイブ閲覧中バナー */
.archive-notice-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid #2563eb;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.archive-notice-banner.admin-mode {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 5px solid #eab308;
}

.archive-notice-text {
  font-size: 0.86rem;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.archive-notice-banner.admin-mode .archive-notice-text {
  color: #713f12;
}

/* 閲覧専用ボタンスタイル */
.btn-disabled-action {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background: #e2e8f0 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  box-shadow: none !important;
  transform: none !important;
}

/* アーカイブ公開制御テーブル */
.archive-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.85rem;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.archive-table th {
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 700;
  color: #475569;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.archive-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.archive-table tr:last-child td {
  border-bottom: none;
}

.archive-table tr:hover td {
  background: #f8fafc;
}

.public-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.public-switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #16a34a;
}


