/* =========================
   管理画面専用CSS
   style.css の後に読み込む
========================= */

:root {
  --admin-bg: #f3f7f3;
  --admin-card: #ffffff;
  --admin-text: #223126;
  --admin-muted: #617264;
  --admin-border: #d8e3d9;
  --admin-primary: #2f7d4a;
  --admin-primary-dark: #23623a;
  --admin-secondary: #eef4ef;
  --admin-danger: #c64636;
  --admin-danger-dark: #b63c2d;
  --admin-danger-soft-bg: #fff5f4;
  --admin-danger-soft-text: #a33a32;
  --admin-danger-soft-border: #e5b8b3;
  --admin-backup-bg: #f7faf7;
  --admin-backup-text: #2d4a36;
  --admin-backup-border: #c9d8cc;
  --admin-restore-bg: #fff7e8;
  --admin-restore-text: #8a5a00;
  --admin-restore-border: #e2c27a;
  --admin-action-bg: #ffffff;
  --admin-action-text: #314236;
  --admin-action-border: #d6dfd8;
  --admin-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --admin-radius: 18px;
}

/* =========================
   管理画面全体
========================= */
body.admin-page {
  background: linear-gradient(180deg, #f6faf6 0%, #eef5ef 100%);
}

.admin-page .page {
  width: min(1200px, calc(100% - 28px));
  padding-top: 24px;
  padding-bottom: 48px;
}

/* =========================
   ヒーロー
========================= */
.admin-page .hero {
  background: linear-gradient(135deg, #e4f3e8, #f8fbf8);
  border: 1px solid var(--admin-border);
  border-radius: 24px;
  box-shadow: var(--admin-shadow);
  padding: 30px 24px;
  margin-bottom: 24px;
}

.admin-page .hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.3;
}

.admin-page .hero p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* =========================
   ログインボックス・パネル
========================= */
#adminLoginBox.card,
#adminPanelBox.card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 22px;
  box-shadow: var(--admin-shadow);
}

#adminLoginBox.card {
  padding: 28px 22px;
}

#adminPanelBox.card {
  padding: 22px 20px 24px;
}

.admin-login {
  display: grid;
  gap: 14px;
}

.admin-login input[type="password"] {
  height: 54px;
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  background: #fff;
  font-size: 1rem;
}

.admin-login .btn {
  min-height: 52px;
}

/* =========================
   管理ツールバー
========================= */
.admin-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-toolbar-left {
  display: flex;
  align-items: center;
  min-height: 52px;
}

.admin-toolbar-left strong {
  font-size: 1.08rem;
  color: var(--admin-text);
  letter-spacing: 0.01em;
  line-height: 1;
}

.admin-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
}

.admin-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-action-group-danger {
  padding-left: 4px;
}

/* =========================
   ツールバーのボタン意味分け
========================= */
.admin-toolbar .btn,
.admin-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 0.97rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: 0.2s ease;
}

.admin-toolbar .btn:hover,
.admin-file-label:hover {
  transform: translateY(-1px);
}

.admin-file-label {
  cursor: pointer;
}

/* バックアップ系 */
.admin-toolbar .btn-backup {
  background: var(--admin-backup-bg);
  color: var(--admin-backup-text);
  border-color: var(--admin-backup-border);
}

.admin-toolbar .btn-backup:hover {
  background: #eef5ef;
  border-color: #b9cdbc;
}

/* 復元系 */
.admin-toolbar .btn-restore,
.admin-file-label.btn-restore {
  background: var(--admin-restore-bg);
  color: var(--admin-restore-text);
  border-color: var(--admin-restore-border);
}

.admin-toolbar .btn-restore:hover,
.admin-file-label.btn-restore:hover {
  background: #fff1d6;
  border-color: #d5ae56;
}

/* 操作系 */
.admin-toolbar .btn-action {
  background: var(--admin-action-bg);
  color: var(--admin-action-text);
  border-color: var(--admin-action-border);
}

.admin-toolbar .btn-action:hover {
  background: #f5f7f5;
  border-color: #c6d2c8;
}

/* 危険系（強） */
.admin-toolbar .btn-danger-strong {
  background: var(--admin-danger);
  color: #fff;
  border-color: var(--admin-danger-dark);
}

.admin-toolbar .btn-danger-strong:hover {
  background: var(--admin-danger-dark);
  border-color: #a73528;
}

/* 危険系（弱） */
.admin-toolbar .btn-danger-soft {
  background: var(--admin-danger-soft-bg);
  color: var(--admin-danger-soft-text);
  border-color: var(--admin-danger-soft-border);
}

.admin-toolbar .btn-danger-soft:hover {
  background: #fdeceb;
  border-color: #dca19a;
}

/* =========================
   管理画面の通知
========================= */
.admin-page .notice {
  border-radius: 16px;
  font-size: 0.98rem;
  line-height: 1.8;
}

.admin-page .notice.info {
  background: #f2e9d1;
  color: #8a5d00;
  border: 1px solid #e1c56a;
  padding: 14px 16px;
  margin-bottom: 18px;
}

/* =========================
   投稿一覧（管理画面）
========================= */
#adminPostList.post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 900px) {
  #adminPostList.post-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================
   管理画面カード
========================= */
#adminPostList .post-card {
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--admin-shadow);
  background: #fff;
  display: flex;
  flex-direction: column;
}

#adminPostList .post-card-header {
  padding: 16px 18px 14px;
  background: #fbfdfb;
  border-bottom: 1px solid var(--admin-border);
}

#adminPostList .post-author {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--admin-text);
  word-break: break-word;
  min-height: auto;
  max-height: none;
  overflow: visible;
}

#adminPostList .post-image-wrap {
  background: #f4f8f4;
}

#adminPostList .post-image {
  width: 100%;
  height: 260px;
  object-fit: cover;
  cursor: zoom-in;
}

#adminPostList .post-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

#adminPostList .post-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#adminPostList .post-date {
  color: var(--admin-muted);
  font-size: 0.94rem;
}

#adminPostList .post-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  color: var(--admin-text);
  max-height: none;
  overflow: visible;
  font-size: 1rem;
}

#adminPostList .post-admin-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

#adminPostList .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  background: #edf6ef;
  color: var(--admin-primary);
}

#adminPostList .small {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--admin-muted);
  background: #f8fbf8;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 10px 12px;
  word-break: break-all;
}

/* =========================
   管理カード内ボタン
========================= */
#adminPostList .actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 8px;
}

#adminPostList .actions .btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

#adminPostList .btn-primary {
  background: var(--admin-primary);
  color: #fff;
}

#adminPostList .btn-primary:hover {
  background: var(--admin-primary-dark);
}

#adminPostList .btn-secondary {
  background: var(--admin-secondary);
  color: #314236;
}

#adminPostList .btn-secondary:hover {
  background: #e2ebe3;
}

#adminPostList .btn-danger {
  background: var(--admin-danger);
  color: #fff;
}

#adminPostList .btn-danger:hover {
  filter: brightness(0.96);
}

/* =========================
   エラー表示
========================= */
#adminPostList .image-error {
  padding: 18px;
  background: #fff4f4;
  color: #9d352d;
  font-weight: 700;
  border-bottom: 1px solid var(--admin-border);
}

/* =========================
   モーダル
========================= */
.admin-page .image-modal {
  background: rgba(0, 0, 0, 0.86);
  padding: 24px;
}

.admin-page .image-modal-inner {
  max-width: min(96vw, 1280px);
  max-height: 92vh;
}

.admin-page .image-modal img {
  max-width: 100%;
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.admin-page .image-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #233126;
  font-size: 1.45rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

/* =========================
   スマホ・タブレット
========================= */
@media (max-width: 980px) {
  .admin-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-toolbar-right {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body.admin-page .page {
    width: min(100%, calc(100% - 18px));
    padding-top: 16px;
    padding-bottom: 32px;
  }

  .admin-page .hero,
  #adminLoginBox.card,
  #adminPanelBox.card {
    padding: 16px;
  }

  .admin-toolbar-right,
  .admin-action-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-action-group .btn,
  .admin-file-label {
    width: 100%;
  }

  #adminPostList .post-image {
    height: 220px;
  }

  #adminPostList .post-body {
    padding: 14px 14px 16px;
  }
}

/* =========================
   hero右上ボタン
========================= */
.hero {
  position: relative;
}

/* =========================
   hero内 ボタン（右寄せ）
========================= */
body.admin-page .hero-top-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: 18px;
}

/* ボタン */
body.admin-page .btn-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #2f7d4a;
  border: 1px solid #cfe3d4;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 700;
}

body.admin-page .btn-return:hover {
  background: #f3f7f4;
}
