/* ===============================================
   グローバルCSS競合リセット
   style.css の nav ul { display: flex } 等を上書き
   =============================================== */

.sidebar .sidebar-menu {
  display: block !important;
  flex-direction: unset !important;
  gap: 0 !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  align-items: unset !important;
}

.sidebar .sidebar-menu li {
  display: list-item !important;
  width: 100% !important;
  text-align: left !important;
  margin-bottom: 0 !important;
}

.sidebar .sidebar-nav {
  position: static !important;
  right: unset !important;
  height: auto !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  border-left: none !important;
  box-shadow: none !important;
  z-index: auto !important;
}

/* ===============================================
   サイドバー基本スタイル
   =============================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: rgba(10, 25, 47, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid rgba(0, 229, 255, 0.1);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 999;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* スクロールバーカスタマイズ */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.3);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.5);
}

/* ===============================================
   サイドバーヘッダー
   =============================================== */

.sidebar-header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-logo a {
  font-size: 1.75rem;
  font-weight: 700;
  color: #00e5ff;
  text-decoration: none;
  font-family: 'Jost', sans-serif;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

.sidebar-logo a:hover {
  color: #ffffff;
}

.sidebar-close {
  display: none; /* デスクトップでは非表示 */
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.sidebar-close:hover {
  color: #00e5ff;
}

/* ===============================================
   ナビゲーション
   =============================================== */

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section-title {
  padding: 0.75rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #00e5ff;
  opacity: 0.7;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-link i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.sidebar-link:hover {
  background: rgba(0, 229, 255, 0.1);
  border-left-color: #00e5ff;
  padding-left: 2rem;
}

.sidebar-link:hover i {
  opacity: 1;
}

/* アクティブページ */
.sidebar-link.active {
  background: rgba(0, 229, 255, 0.15);
  border-left-color: #00e5ff;
  font-weight: 600;
}

/* NEWバッジ */
.badge-new {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: linear-gradient(135deg, #ff6b00, #dc2626);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 12px;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* LINEボタン特別スタイル */
.sidebar-link.line-button {
  background: rgba(6, 199, 85, 0.1);
  border-left-color: #06C755;
  margin: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.sidebar-link.line-button:hover {
  background: rgba(6, 199, 85, 0.2);
  padding-left: 1.5rem;
}

/* 外部リンクアイコン */
.external .fa-external-link-alt {
  opacity: 0.5;
  font-size: 0.75rem;
}

/* ===============================================
   サイドバーフッター
   =============================================== */

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ===============================================
   ハンバーガーボタン（モバイル用）
   =============================================== */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: rgba(10, 25, 47, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-toggle span {
  display: block;
  width: 25px;
  height: 2px;
  background: #00e5ff;
  margin: 5px 0;
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: #00e5ff;
}

.sidebar-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

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

.sidebar-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ===============================================
   オーバーレイ（モバイル用）
   =============================================== */

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ===============================================
   メインコンテンツ調整
   =============================================== */

body.sidebar-enabled {
  margin-left: 280px;
}

body.sidebar-enabled main,
body.sidebar-enabled footer {
  transition: margin-left 0.3s ease;
}

/* fixed要素はmargin-leftが効かないため、left/widthで調整 */
body.sidebar-enabled header {
  left: 280px !important;
  width: calc(100% - 280px) !important;
  transition: left 0.3s ease, width 0.3s ease;
}

/* ===============================================
   サブメニュー
   =============================================== */

.sidebar-submenu-parent {
  position: relative;
}

.sidebar-submenu {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  padding-left: 20px;
  border-left: 2px solid rgba(102, 126, 234, 0.2);
}

.sidebar-submenu li {
  margin: 0;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: #64748b;
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

.sidebar-sublink:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--primary-color);
  padding-left: 20px;
}

.sidebar-sublink i {
  font-size: 0.85rem;
  opacity: 0.8;
}

.sidebar-sublabel {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
  font-style: italic;
}

.sidebar-sublink:hover .sidebar-sublabel {
  color: var(--primary-color);
}

/* ===============================================
   レスポンシブ対応
   =============================================== */

@media (max-width: 1024px) {
  /* モバイルではサイドバーを画面外に配置 */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  /* ハンバーガーボタンを表示 */
  .sidebar-toggle {
    display: block;
  }

  /* 閉じるボタンを表示 */
  .sidebar-close {
    display: block;
  }

  /* メインコンテンツの調整を解除 */
  body.sidebar-enabled {
    margin-left: 0;
  }

  /* オーバーレイを有効化 */
  .sidebar-overlay {
    display: none;
  }
}

/* タブレット調整 */
@media (max-width: 768px) {
  .sidebar {
    width: 280px;
  }
}

/* スマホ調整 */
@media (max-width: 480px) {
  .sidebar {
    width: 85%;
    max-width: 300px;
  }
}
