/* =========================================================
   企画系共通 v2（各ページ CSS の後に読み込む）
   戻す: body.plan-v2 を外す / 各 *_legacy.css に差し替え
   ========================================================= */

body.plan-v2 {
  font-family: "M PLUS Rounded 1c", sans-serif !important;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(210, 235, 255, 0.9), rgba(255,255,255,0) 60%),
    radial-gradient(900px 480px at 92% 8%, rgba(210, 245, 220, 0.55), rgba(255,255,255,0) 55%),
    linear-gradient(180deg, #eef6ff 0%, #f5f7fb 42%, #f7f8fa 100%) !important;
  background-size: auto !important;
  color: #2C3E50;
  overflow-x: hidden;
}

body.plan-v2 .container {
  margin: 0 auto 48px !important;
  max-width: 1100px !important;
  padding: 28px 24px 48px !important;
  min-height: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
}

/* ----- ページヘッド ----- */
body.plan-v2 .plan-page-head {
  margin-bottom: 18px;
}

body.plan-v2 .plan-page-head .title,
body.plan-v2 .container > .title,
body.plan-v2 .container .title {
  text-align: left !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  color: #1f2a37 !important;
  margin: 0 0 8px !important;
  padding: 0 0 12px 10px !important;
  border-bottom: 2px solid rgba(76, 175, 80, 0.25) !important;
  position: relative;
}

body.plan-v2 .plan-page-head .title::before,
body.plan-v2 .container > .title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 4px;
  height: 1.1em;
  border-radius: 999px;
  background: #4CAF50;
}

body.plan-v2 .sub-title {
  margin: 0 0 16px !important;
  padding: 0 !important;
  border: none !important;
  text-align: left !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #7a8794 !important;
  line-height: 1.65 !important;
}

body.plan-v2 .register-reminder {
  margin: 0 0 12px !important;
  padding: 10px 12px !important;
  background: #fff5f5 !important;
  border: 1px solid rgba(224, 82, 82, 0.25) !important;
  color: #c62828 !important;
  font-size: 13px !important;
  text-align: left !important;
}

body.plan-v2 .register-reminder p {
  margin: 0 !important;
  color: inherit !important;
}

/* ----- 上部ナビ ----- */
body.plan-v2 .top-left-buttons {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  margin: 16px auto 12px !important;
  max-width: 1100px !important;
  padding: 10px 12px !important;
  background: #fff !important;
  border: 1px solid rgba(44, 62, 80, 0.08) !important;
  border-radius: 0 !important;
  box-sizing: border-box;
}

body.plan-v2 .top-button,
body.plan-v2 .top-left-buttons .top-button,
body.plan-v2 a.top-button,
body.plan-v2 button.top-button {
  background: #fff !important;
  color: #2C3E50 !important;
  border: 1px solid rgba(44, 62, 80, 0.14) !important;
  border-radius: 0 !important;
  padding: 8px 12px !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transform: none !important;
  filter: none !important;
  cursor: pointer;
}

body.plan-v2 .top-button:hover,
body.plan-v2 .top-left-buttons .top-button:hover {
  background: #f7faf8 !important;
  color: #1f2a37 !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

body.plan-v2 .top-button:nth-child(1),
body.plan-v2 .top-button.top-button--primary,
body.plan-v2 a.top-button[href*="planregister"],
body.plan-v2 a.top-button[href*="group/create"] {
  background: #4CAF50 !important;
  color: #fff !important;
  border-color: #4CAF50 !important;
}

body.plan-v2 .top-button:nth-child(1):hover,
body.plan-v2 a.top-button[href*="planregister"]:hover,
body.plan-v2 a.top-button[href*="group/create"]:hover {
  background: #43a047 !important;
  color: #fff !important;
}

body.plan-v2 .favorite-list-btn {
  background: #fff !important;
  color: #c62828 !important;
  border-color: rgba(198, 40, 40, 0.28) !important;
  box-shadow: none !important;
}

body.plan-v2 .favorite-list-btn:hover {
  background: #fff5f5 !important;
  box-shadow: none !important;
}

/* 企画系ナビ（通常企画 / My企画） */
body.plan-v2 a.top-button[href*="planlist"],
body.plan-v2 a.top-button[href*="myplanlist"] {
  background: #f3faf4 !important;
  color: #2e7d32 !important;
  border-color: rgba(76, 175, 80, 0.45) !important;
}

body.plan-v2 a.top-button[href*="planlist"]:hover,
body.plan-v2 a.top-button[href*="myplanlist"]:hover {
  background: #e8f5e9 !important;
  color: #1b5e20 !important;
}

/* グループ系ナビ（グループ一覧 / Myグループ） */
body.plan-v2 a.top-button[href*="kikaku/group/"]:not([href*="create"]),
body.plan-v2 a.top-button[href*="/group/my"],
body.plan-v2 a.top-button.top-button--group {
  background: #f3f7fb !important;
  color: #1565c0 !important;
  border-color: rgba(33, 150, 243, 0.4) !important;
}

body.plan-v2 a.top-button[href*="kikaku/group/"]:not([href*="create"]):hover,
body.plan-v2 a.top-button[href*="/group/my"]:hover,
body.plan-v2 a.top-button.top-button--group:hover {
  background: #e8f1f8 !important;
  color: #0d47a1 !important;
}

/* 現在ページを強調 */
body.plan-v2 a.top-button.top-button--group.is-active,
body.plan-v2 a.top-button[href*="kikaku/group/"].is-active,
body.plan-v2 a.top-button[href*="/group/my"].is-active {
  background: #1565c0 !important;
  color: #fff !important;
  border-color: #1565c0 !important;
}

body.plan-v2 a.top-button.top-button--group.is-active:hover {
  background: #0d47a1 !important;
  color: #fff !important;
}

/* 企画ブロックとグループブロックの間に区切り線 */
body.plan-v2 a.top-button[href*="planlist"] + a.top-button[href*="kikaku/group/"]:not([href*="create"]),
body.plan-v2 a.top-button[href*="myplanlist"] + a.top-button[href*="kikaku/group/"]:not([href*="create"]),
body.plan-v2 a.top-button[href*="myplanlist"] + a.top-button[href*="/group/my"] {
  margin-left: 12px !important;
  position: relative;
}

body.plan-v2 a.top-button[href*="planlist"] + a.top-button[href*="kikaku/group/"]:not([href*="create"])::before,
body.plan-v2 a.top-button[href*="myplanlist"] + a.top-button[href*="kikaku/group/"]:not([href*="create"])::before,
body.plan-v2 a.top-button[href*="myplanlist"] + a.top-button[href*="/group/my"]::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: rgba(44, 62, 80, 0.2);
}

body.plan-v2 .plan-howto-btn {
  border: 1px solid rgba(44, 62, 80, 0.14) !important;
}

/* ----- 検索・ソート ----- */
body.plan-v2 .list-control-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin: 0 0 18px !important;
}

body.plan-v2 .search-form {
  margin: 0 !important;
  flex: 1 1 240px;
  max-width: 420px;
}

body.plan-v2 .search-input-wrapper {
  position: relative !important;
  display: block !important;
  max-width: none !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.plan-v2 .search-icon {
  position: absolute !important;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px !important;
  height: 16px !important;
  opacity: 0.55;
  pointer-events: none;
}

body.plan-v2 .search-input {
  width: 100% !important;
  padding: 11px 12px 11px 36px !important;
  border: 1px solid rgba(44, 62, 80, 0.14) !important;
  border-radius: 0 !important;
  background: #fff !important;
  font-family: inherit !important;
  font-size: 14px !important;
  color: #2C3E50 !important;
  box-sizing: border-box;
}

body.plan-v2 .search-input:focus {
  outline: none;
  border-color: rgba(76, 175, 80, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
}

body.plan-v2 .sort-form {
  margin: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

body.plan-v2 .sort-form select {
  appearance: none !important;
  -webkit-appearance: none !important;
  border-radius: 0 !important;
  border: 1px solid rgba(44, 62, 80, 0.14) !important;
  padding: 10px 32px 10px 12px !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #2C3E50 !important;
  background-color: #fff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%237a8794' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 14px 14px !important;
}

body.plan-v2 .sort-form select:focus-visible {
  outline: 2px solid rgba(76, 175, 80, 0.55);
  outline-offset: 1px;
}

/* ----- カードグリッド ----- */
body.plan-v2 .thumbnail-grid,
body.plan-v2 .favorite-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  margin: 8px 0 16px !important;
}

body.plan-v2 .thumbnail-card,
body.plan-v2 .fav-card {
  background: #fff !important;
  border: 1px solid rgba(44, 62, 80, 0.08) !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 6px 18px rgba(44, 62, 80, 0.05) !important;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}

body.plan-v2 .thumbnail-card:hover,
body.plan-v2 .fav-card:hover {
  border-color: rgba(76, 175, 80, 0.4) !important;
  box-shadow: 0 10px 24px rgba(44, 62, 80, 0.1) !important;
  transform: translateY(-2px);
}

body.plan-v2 .thumbnail-img {
  width: 100% !important;
  aspect-ratio: 16 / 9;
  object-fit: cover !important;
  display: block;
  border-radius: 0 !important;
}

body.plan-v2 .thumbnail-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eef1f4;
}

body.plan-v2 .thumbnail-info {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.plan-v2 .participant-count,
body.plan-v2 .deadline {
  background: rgba(31, 42, 55, 0.78) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 4px 8px !important;
  border-radius: 0 !important;
  line-height: 1.3;
}

body.plan-v2 .closed-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: #e53935 !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  padding: 4px 8px !important;
  border-radius: 0 !important;
}

body.plan-v2 .favorite-float-btn {
  position: absolute;
  right: 10px;
  bottom: 58px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(44, 62, 80, 0.12) !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #c62828 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.12);
}

body.plan-v2 .favorite-float-btn.is-favorited {
  background: #fff5f5 !important;
}

body.plan-v2 .thumbnail-title-with-icon {
  display: flex !important;
  gap: 10px !important;
  align-items: center !important;
  padding: 10px 12px !important;
  background: #fff !important;
}

body.plan-v2 .creator-icon {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 1px solid rgba(44, 62, 80, 0.12) !important;
  flex-shrink: 0;
}

body.plan-v2 .thumbnail-title-creater {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

body.plan-v2 .thumbnail-title-creater span:first-child {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #7a8794 !important;
}

body.plan-v2 .thumbnail-title-creater span:last-child {
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #1f2a37 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- ページネーション ----- */
body.plan-v2 .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #7a8794;
}

body.plan-v2 .pagination a {
  padding: 8px 14px;
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.14);
  color: #2C3E50;
  text-decoration: none;
  font-weight: 700;
}

body.plan-v2 .pagination a:hover {
  border-color: rgba(76, 175, 80, 0.45);
  background: #f7faf8;
}

/* ----- 使い方モーダル ----- */
body.plan-v2 .plan-howto-dialog {
  border-radius: 0 !important;
  border: 1px solid rgba(44, 62, 80, 0.08) !important;
  box-shadow: 0 16px 40px rgba(44, 62, 80, 0.18) !important;
}

body.plan-v2 .plan-howto-head {
  background: #f7faf8 !important;
  border-bottom: 1px solid rgba(44, 62, 80, 0.08);
}

body.plan-v2 .plan-howto-title {
  font-weight: 800 !important;
  color: #1f2a37 !important;
}

body.plan-v2 .plan-howto-action {
  background: #4CAF50 !important;
  border-radius: 8px !important;
  font-weight: 800 !important;
}

body.plan-v2 .plan-howto-action:hover {
  background: #43a047 !important;
}

/* ----- フォーム共通 ----- */
body.plan-v2 input[type="text"],
body.plan-v2 input[type="number"],
body.plan-v2 input[type="datetime-local"],
body.plan-v2 input[type="date"],
body.plan-v2 input[type="url"],
body.plan-v2 input[type="email"],
body.plan-v2 textarea,
body.plan-v2 select {
  border-radius: 0 !important;
  border-color: rgba(44, 62, 80, 0.14) !important;
  font-family: inherit !important;
}

body.plan-v2 button[type="submit"],
body.plan-v2 .submit-btn,
body.plan-v2 .btn-primary,
body.plan-v2 .plan-submit-btn,
body.plan-v2 .save-btn {
  background: #4CAF50 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  font-family: inherit !important;
  font-weight: 800 !important;
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.28);
}

body.plan-v2 button[type="submit"]:hover,
body.plan-v2 .submit-btn:hover,
body.plan-v2 .btn-primary:hover,
body.plan-v2 .plan-submit-btn:hover,
body.plan-v2 .save-btn:hover {
  background: #43a047 !important;
}

/* ----- 詳細・パネル基調 ----- */
body.plan-v2 .plan-panel,
body.plan-v2 .detail-panel,
body.plan-v2 .join-section,
body.plan-v2 .ranking-section {
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.08);
  border-radius: 0;
  box-shadow: 0 6px 18px rgba(44, 62, 80, 0.05);
}

@media screen and (max-width: 900px) {
  body.plan-v2 .thumbnail-grid,
  body.plan-v2 .favorite-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media screen and (max-width: 640px) {
  body.plan-v2 .container {
    padding: 18px 12px 40px !important;
  }

  body.plan-v2 .plan-page-head .title,
  body.plan-v2 .container > .title {
    font-size: 20px !important;
  }

  body.plan-v2 .top-left-buttons {
    margin-left: 12px !important;
    margin-right: 12px !important;
  }

  body.plan-v2 .thumbnail-grid,
  body.plan-v2 .favorite-grid {
    grid-template-columns: 1fr !important;
  }

  body.plan-v2 .list-control-row {
    flex-direction: column;
    align-items: stretch !important;
  }

  body.plan-v2 .search-form {
    max-width: none;
  }
}

/* ----- 詳細・フォーム追加上書き ----- */
body.plan-v2 .top-button.green,
body.plan-v2 .top-button.blue,
body.plan-v2 .top-button.purple,
body.plan-v2 .top-button.pink {
  background: #fff !important;
  color: #2C3E50 !important;
  border: 1px solid rgba(44, 62, 80, 0.14) !important;
  box-shadow: none !important;
}

body.plan-v2 .top-button.green {
  background: #4CAF50 !important;
  color: #fff !important;
  border-color: #4CAF50 !important;
}

body.plan-v2 a.btn,
body.plan-v2 .btn,
body.plan-v2 .action-btn,
body.plan-v2 .join-btn,
body.plan-v2 .primary-btn,
body.plan-v2 .edit-btn,
body.plan-v2 .create-btn {
  border-radius: 8px !important;
}

body.plan-v2 a[href*="planregister"].top-button,
body.plan-v2 a[href*="group/create"].top-button,
body.plan-v2 a[href*="kikaku_group_create"].top-button {
  background: #4CAF50 !important;
  color: #fff !important;
  border-color: #4CAF50 !important;
}

/* 詳細ページの青グラデ主ボタンを緑へ */
body.plan-v2 .container a.button,
body.plan-v2 .container button.button,
body.plan-v2 .join-submit,
body.plan-v2 .result-save-btn,
body.plan-v2 .plan-action-primary {
  background: #4CAF50 !important;
  background-image: none !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.28) !important;
}

body.plan-v2 .plan-register-form,
body.plan-v2 .plan-edit-form,
body.plan-v2 form.plan-form {
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.08);
  padding: 18px;
  box-shadow: 0 6px 18px rgba(44, 62, 80, 0.05);
}

body.plan-v2 table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
}

body.plan-v2 table th {
  background: #f7f8fa !important;
  color: #7a8794 !important;
  font-weight: 800 !important;
  border-color: rgba(44, 62, 80, 0.08) !important;
}

body.plan-v2 table td {
  border-color: rgba(44, 62, 80, 0.08) !important;
  color: #2C3E50;
}
