:root {
  --sidebar-width: 260px;
  --sidebar-bg: #2c3e50;
  --sidebar-hover: #34495e;
  --sidebar-active: #1a73e8;
  --text-color: #ecf0f1;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* メインコンテンツのコンテナ調整 */
.main-content {
  flex: 1;
  padding: 20px;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
  background-color: #f8f9fa;
}

/* サイドバー本体 */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  color: var(--text-color);
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow-y: auto; /* サイドバーをスクロール可能にする */
}

#sidebar .sidebar-header {
  padding: 24px;
  font-size: 1.2rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky; /* ヘッダーは固定 */
  top: 0;
  background-color: var(--sidebar-bg);
  z-index: 2;
}

#sidebar .menu-group {
  margin-top: 10px;
}

#sidebar .menu-label {
  padding: 15px 24px 10px;
  font-size: 0.95rem;
  font-weight: bold;
  color: #95a5a6;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
  user-select: none; /* テキスト選択を防ぐ */
}

#sidebar .menu-label:hover {
  color: #fff;
}

#sidebar .menu-label .chevron {
  font-size: 18px;
  transition: transform 0.3s ease;
}

/* 折りたたみ状態 */
#sidebar .menu-group.collapsed .menu-item {
  display: none;
}

#sidebar .menu-group.collapsed .menu-label .chevron {
  transform: rotate(-90deg);
}

#sidebar .menu-item {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  transition: background 0.2s;
  font-size: 0.95rem;
}

#sidebar .menu-item:hover {
  background-color: var(--sidebar-hover);
}

#sidebar .menu-item.active {
  background-color: var(--sidebar-active);
  font-weight: bold;
}

#sidebar .menu-item i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
}

/* ログアウトボタンの特別スタイル */
#logout-link {
  margin: 15px 20px;
  padding: 10px;
  border: 1px solid rgba(231, 76, 60, 0.5); /* 薄い赤色の枠線 */
  border-radius: 6px;
  color: #e74c3c;
  justify-content: center; /* 中央寄せ */
  background-color: rgba(231, 76, 60, 0.05);
  transition: all 0.2s ease;
}

#logout-link:hover {
  background-color: #e74c3c !important;
  color: #fff !important;
  border-color: #e74c3c;
}

#logout-link span {
  margin: 0 4px;
}

/* 印刷時はサイドバーを隠す */
@media print {
  #sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }
}