/* ============================================
   マイページ サイドバーレイアウト
   ============================================ */

/* マイページではヘッダーを非表示 */
.mypage-has-sidebar .l-header-lv1-top {
  display: none !important;
}

/* 2カラムレイアウト（ヘッダーなし） */
.mypage-layout {
  display: flex;
  min-height: 100vh;
  margin-top: 0;
}

.mypage-layout__content {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  margin-left: 220px;
}

/* サイドバー表示時はmainのmargin-topを無効化 */
.mypage-layout .l-main-lv1 {
  margin-top: 0 !important;
}

/* マイページ用シンプルフッター */
.mypage-footer {
  margin-left: 220px;
  padding: 20px 32px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
}

.mypage-footer__links {
  margin-bottom: 8px;
}

.mypage-footer__links a {
  font-size: 12px;
  color: #999;
  text-decoration: none;
  margin: 0 8px;
}

.mypage-footer__links a:hover {
  color: #666;
  text-decoration: underline;
}

.mypage-footer__copy {
  font-size: 12px;
  color: #999;
}

.mypage-footer__copy a {
  color: #999;
  text-decoration: none;
}

.mypage-footer__copy a:hover {
  color: #666;
  text-decoration: underline;
}

/* サイドバー - 固定・スクロール不可 */
.mypage-sidebar {
  width: 220px;
  min-width: 220px;
  background: #121f32 !important;
  padding: 0;
  overflow: hidden;
  position: fixed !important;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* ロゴ */
.mypage-sidebar__logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.mypage-sidebar__logo-link {
  font-size: 22px;
  font-weight: 800;
  color: #fff !important;
  text-decoration: none !important;
  letter-spacing: 3px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.mypage-sidebar__logo-link:hover {
  color: #fff !important;
  text-decoration: none !important;
}

/* ナビゲーション */
.mypage-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* スクロールバーを目立たなく */
.mypage-sidebar__nav::-webkit-scrollbar {
  width: 3px;
}
.mypage-sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.mypage-sidebar__group {
  margin-bottom: 2px;
  padding: 0 10px;
}

.mypage-sidebar__group--border-top {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  margin-top: 4px;
}

/* グループトグルボタン（見出し＋矢印） */
.mypage-sidebar__group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.mypage-sidebar__group-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* カテゴリタイトル（押せない見出し） */
.mypage-sidebar__group-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  user-select: none;
  margin: 0;
  padding: 0;
}

/* 開閉矢印 */
.mypage-sidebar__group-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.mypage-sidebar__group.is-open > .mypage-sidebar__group-toggle .mypage-sidebar__group-arrow {
  transform: rotate(0deg);
}

.mypage-sidebar__group:not(.is-open) > .mypage-sidebar__group-toggle .mypage-sidebar__group-arrow {
  transform: rotate(-90deg);
}

/* リスト（トグル開閉対象） */
.mypage-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.mypage-sidebar__group.is-open > .mypage-sidebar__list {
  max-height: 500px;
  opacity: 1;
}

.mypage-sidebar__group:not(.is-open) > .mypage-sidebar__list {
  max-height: 0;
  opacity: 0;
}

/* メニューリンク（押せる） */
.mypage-sidebar__link {
  display: block;
  padding: 7px 10px 7px 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7) !important;
  text-decoration: none !important;
  border-radius: 6px;
  transition: all 0.15s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.mypage-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
  text-decoration: none !important;
  border-left-color: rgba(255, 255, 255, 0.3);
}

/* アクティブ状態 */
.mypage-sidebar__link.is-active {
  background: rgba(57, 112, 231, 0.25) !important;
  color: #fff !important;
  font-weight: 600;
  border-left-color: #3970e7;
}

.mypage-sidebar__link.is-active:hover {
  background: rgba(57, 112, 231, 0.35) !important;
}

/* 外部リンク */
.mypage-sidebar__link--external {
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 12px;
  border-left-color: transparent !important;
}

.mypage-sidebar__link--external:hover {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* ボタン型リンク（Google連携解除等） */
.mypage-sidebar__link--btn {
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
}

/* アカウント・プラン CTA */
.mypage-sidebar__plan-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff !important;
  text-decoration: none !important;
  background: linear-gradient(135deg, #3970e7 0%, #6d5ce7 100%);
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.mypage-sidebar__plan-cta:hover {
  background: linear-gradient(135deg, #2d5fd4 0%, #5a49d4 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(57, 112, 231, 0.35);
  color: #fff !important;
  text-decoration: none !important;
}

.mypage-sidebar__plan-cta.is-active {
  background: linear-gradient(135deg, #2d5fd4 0%, #5a49d4 100%);
  box-shadow: 0 2px 8px rgba(57, 112, 231, 0.3);
}

.mypage-sidebar__plan-cta-icon {
  font-size: 16px;
  line-height: 1;
}

/* フッター（ログアウト） */
.mypage-sidebar__footer {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mypage-sidebar__logout {
  display: block;
  padding: 8px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4) !important;
  text-decoration: none !important;
  border-radius: 6px;
  transition: all 0.15s ease;
  text-align: center;
}

.mypage-sidebar__logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171 !important;
  text-decoration: none !important;
}

/* SP サイドバートグルボタン */
.mypage-sidebar-toggle {
  display: none;
}

/* SP オーバーレイ */
.mypage-sidebar-overlay {
  display: none;
}

/* ============================================
   SP (max-width: 959px)
   ============================================ */
@media (max-width: 959px) {
  .mypage-layout {
    display: block;
    margin-top: 0;
  }

  .mypage-layout__content {
    margin-left: 0;
  }

  /* フッターもリセット */
  .mypage-footer {
    margin-left: 0;
  }

  .mypage-sidebar {
    left: -260px;
    width: 260px;
    min-width: 260px;
    transition: left 0.3s ease;
    box-shadow: none;
    z-index: 1000;
  }

  .mypage-sidebar.is-open {
    left: 0;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
  }

  .mypage-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    background: #121f32;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    flex-direction: column;
    gap: 4px;
    padding: 0;
  }

  .mypage-sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
  }

  .mypage-sidebar-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .mypage-sidebar-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .mypage-sidebar-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mypage-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .mypage-sidebar-overlay.is-open {
    display: block;
  }
}
