/* Exclusive menu for AG-Partner website - 企業サイト風改良版 */
.sidebar {
  position: fixed;
  display: flex;
  flex-direction: column;
  z-index: 200;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  padding: 15px;
  transition: all 0.3s ease;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, #3300ff, #6633ff);
  border-radius: 8px 0 0 8px;
}

/* メニューアイテムを横並びに */
.menu-items {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex-wrap: wrap;
}

.cb_fix {
  display: flex;
  align-items: center;
  background-color: #f5f7fa;
  border: 1px solid #e5e9f0;
  border-radius: 6px;
  padding: 10px 15px;
  min-width: 140px;
  transition: all 0.3s ease;
}

.cb_fix:hover {
  background-color: #eef1f8;
  border-color: #3300ff;
  transform: translateY(-3px);
  box-shadow: 0 2px 8px rgba(51, 0, 255, 0.1);
}

.Apply_icon {
  width: 24px;
  height: 24px;
  background-color: white;
  border-radius: 6px;
  padding: 4px;
  border: 1px solid #e5e9f0;
  object-fit: contain;
  transition: all 0.3s ease;
  display: inline-block; /* 必ず表示されるように */
}

.cb_fix:hover .Apply_icon {
  transform: scale(1.05);
  border-color: #3300ff;
}

.Apply {
  margin-left: 10px;
  font-weight: 600;
  font-size: 14px;
  color: #333333;
  transition: all 0.3s ease;
  white-space: nowrap; /* テキストの折り返しを防止 */
}

.cb_fix:hover .Apply {
  color: #3300ff;
}

/* サイドバータイトル追加 */
.sidebar-title {
  color: #333333;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 5px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e9f0;
  width: calc(100% - 10px);
}

/* ヘッダー内に固定の上部メニュー（PCのみ表示） */
.header-menu {
  display: none; /* デフォルトでは非表示 */
}

/* ヘッダーメニュー専用のスタイル */
/* ヘッダーメニュー専用のスタイル */
@media (min-width: 866px) {
  /* PC版のサイドバースタイル - 右側に配置 */
  .sidebar {
    position: fixed;
    top: 100px;
    right: 25px;
    left: auto;
    transform: none;
    width: auto;
    max-width: 450px;
    z-index: 150;
    opacity: 0; /* 初期状態では非表示 */
    visibility: hidden; /* アクセシビリティと遷移のため */
    transition: 
      opacity 0.3s ease,
      visibility 0.3s ease,
      transform 0.3s ease,
      box-shadow 0.3s ease;
  }
  
  /* スクロール時に表示 */
  .sidebar.show-on-scroll {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }
  
  .sidebar:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateX(-5px);
  }
  
  /* サイドバーの中身を横並びに変更 */
  .sidebar .menu-items {
    flex-direction: row; /* 縦並びから横並びに変更 */
    gap: 10px;
    flex-wrap: nowrap; /* 折り返しを防止 */
  }
  
  .sidebar .cb_fix {
    width: auto; /* 幅を自動に変更 */
    min-width: 120px; /* 最小幅を設定 */
    flex: 0 1 auto; /* フレックスアイテムの伸縮を調整 */
  }
}

/* タブレット・スマホ共通のスタイル */
@media (max-width: 865px) {
  .sidebar {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 450px;
    z-index: 999;
    /* モバイルでは常に表示 */
    opacity: 1;
    visibility: visible;
  }
  
  .sidebar::before {
    width: 100%;
    height: 4px;
    top: 0;
    left: 0;
    border-radius: 15px 15px 0 0;
  }
  
  /* タイトルはシンプルに保ちつつ中央配置 */
  .sidebar-title {
    text-align: center;
    margin-bottom: 10px;
    font-size: 13px;
  }
  
  .menu-items {
    display: flex;
    justify-content: center;
    gap: 10px;
  }
  
  .cb_fix {
    flex: 1;
    padding: 8px 12px;
    min-width: 0;
    justify-content: center;
  }
  
  .Apply {
    font-size: 13px;
    margin-left: 8px;
  }
  
  .Apply_icon {
    width: 20px;
    height: 20px;
    padding: 3px;
  }
}

/* スマホ向けのスタイル修正 */
@media (max-width: 480px) {
  .sidebar {
    width: 94%;
    padding: 10px;
  }
  
  .menu-items {
    gap: 8px;
  }
  
  .cb_fix {
    padding: 8px 10px;
  }
  
  .Apply {
    font-size: 12px;
  }
  
  .Apply_icon {
    width: 18px;
    height: 18px;
  }
}

/* 特に小さい画面向け (iPhone SE等) */
@media (max-width: 360px) {
  .menu-items {
    flex-direction: column;
    align-items: center;
  }
  
  .cb_fix {
    width: 90%;
    margin-bottom: 5px;
  }
}