/* スマホ用下部ヘッダー */
.mobile-bottom-header {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #7b8397;
  border-top: 1px solid #5a6270;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* PC表示時は新ヘッダーを非表示 */
@media only screen and (min-width: 737px) {
  .mobile-bottom-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(100%) !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}

.mobile-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  max-width: 100%;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #fff;
  padding: 8px 4px;
  min-width: 0;
  flex: 1;
  transition: background-color 0.3s ease;
}

.mobile-nav-item:hover {
  background-color: #5a6270;
}

.mobile-nav-icon {
  font-size: 18px;
  margin-bottom: 2px;
  display: block;
}

.mobile-nav-text {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

  /* スマホ表示時のみ表示 */
  @media only screen and (max-width: 736px) {
    .mobile-bottom-header {
      display: block;
    }
    
    /* 旧ヘッダーが開いている時は新ヘッダーを非表示 */
    .hamburger.active ~ .mobile-bottom-header,
    .hamburger.active + .mobile-bottom-header,
    .mobile-bottom-header:has(~ .hamburger.active),
    .hamburger.active .mobile-bottom-header,
    .hamburger.active + * .mobile-bottom-header,
    .hamburger.active ~ * .mobile-bottom-header,
    .hamburger.active ~ footer ~ .mobile-bottom-header,
    .hamburger.active ~ main ~ .mobile-bottom-header,
    .hamburger.active ~ * ~ .mobile-bottom-header,
    .hamburger.active ~ * ~ * .mobile-bottom-header,
    .hamburger.active ~ * ~ * ~ .mobile-bottom-header,
    .hamburger.active ~ * ~ * ~ * .mobile-bottom-header,
    .hamburger.active ~ * ~ * ~ * ~ .mobile-bottom-header {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      transform: translateY(100%) !important;
      position: absolute !important;
      left: -9999px !important;
      z-index: -1 !important;
      width: 0 !important;
      height: 0 !important;
      overflow: hidden !important;
      pointer-events: none !important;
    }
    
    /* グローバルナビが開いている時の新ヘッダー非表示 */
    .global-nav.active ~ .mobile-bottom-header,
    .global-nav.active + .mobile-bottom-header,
    .mobile-bottom-header:has(~ .global-nav.active),
    .global-nav.active .mobile-bottom-header,
    .global-nav.active + * .mobile-bottom-header,
    .global-nav.active ~ * .mobile-bottom-header,
    .global-nav.active ~ footer ~ .mobile-bottom-header,
    .global-nav.active ~ main ~ .mobile-bottom-header,
    .global-nav.active ~ * ~ .mobile-bottom-header,
    .global-nav.active ~ * ~ * .mobile-bottom-header,
    .global-nav.active ~ * ~ * ~ .mobile-bottom-header,
    .global-nav.active ~ * ~ * ~ * .mobile-bottom-header,
    .global-nav.active ~ * ~ * ~ * ~ .mobile-bottom-header {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      transform: translateY(100%) !important;
      position: absolute !important;
      left: -9999px !important;
      z-index: -1 !important;
      width: 0 !important;
      height: 0 !important;
      overflow: hidden !important;
      pointer-events: none !important;
    }
    
    /* フッターの下に余白を追加してヘッダーと重ならないようにする */
    .footer {
      margin-bottom: 100px;
      padding-bottom: 30px;
    }
    
    /* コピーライト部分にも余白を追加 */
    .footer .under {
      margin-bottom: 40px;
    }
    
    /* スマホ用下部ヘッダーの高さ分の余白を確保 */
    body {
      padding-bottom: 100px;
    }
  
  /* 旧ヘッダー（ハンバーガーメニュー）が開いている時の調整 */
  .global-nav.active {
    z-index: 1001;
  }
  
  /* 旧ヘッダーが開いている時は新ヘッダーを一時的に非表示 */
  .mobile-bottom-header.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(100%) !important;
  }
  
  /* ハンバーガーメニューが開いている時の新ヘッダー非表示 */
  .hamburger.active ~ .mobile-bottom-header,
  .hamburger.active + .mobile-bottom-header,
  .mobile-bottom-header:has(~ .hamburger.active),
  .hamburger.active .mobile-bottom-header,
  .hamburger.active + * .mobile-bottom-header,
  .hamburger.active ~ * .mobile-bottom-header,
  .hamburger.active ~ footer ~ .mobile-bottom-header,
  .hamburger.active ~ main ~ .mobile-bottom-header,
  .hamburger.active ~ * ~ .mobile-bottom-header,
  .hamburger.active ~ * ~ * .mobile-bottom-header,
  .hamburger.active ~ * ~ * ~ .mobile-bottom-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(100%) !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  /* グローバルナビが開いている時の新ヘッダー非表示 */
  .global-nav.active ~ .mobile-bottom-header,
  .global-nav.active + .mobile-bottom-header,
  .mobile-bottom-header:has(~ .global-nav.active),
  .global-nav.active .mobile-bottom-header,
  .global-nav.active + * .mobile-bottom-header,
  .global-nav.active ~ * .mobile-bottom-header,
  .global-nav.active ~ footer ~ .mobile-bottom-header,
  .global-nav.active ~ main ~ .mobile-bottom-header,
  .global-nav.active ~ * ~ .mobile-bottom-header,
  .global-nav.active ~ * ~ * .mobile-bottom-header,
  .global-nav.active ~ * ~ * ~ .mobile-bottom-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(100%) !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  /* メニューが開いている時の新ヘッダー非表示（より強力なセレクタ） */
  .hamburger.active ~ * .mobile-bottom-header,
  .global-nav.active ~ * .mobile-bottom-header,
  .hamburger.active ~ footer ~ .mobile-bottom-header,
  .global-nav.active ~ footer ~ .mobile-bottom-header,
  .hamburger.active ~ main ~ .mobile-bottom-header,
  .global-nav.active ~ main ~ .mobile-bottom-header,
  .hamburger.active ~ * ~ * .mobile-bottom-header,
  .global-nav.active ~ * ~ * .mobile-bottom-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(100%) !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  /* 旧ヘッダーが開いている時のコンテンツ調整 */
  .global-nav.active ~ main {
    margin-bottom: 0;
  }
  
  /* index.html以外のページ用の調整 */
  body:not(.guidance) .footer {
    margin-bottom: 100px;
  }
  
  body:not(.guidance) .footer .under {
    margin-bottom: 40px;
  }
  
  /* index.html専用の調整 */
  body.guidance .footer {
    margin-bottom: 120px;
  }
  
  body.guidance .footer .under {
    margin-bottom: 50px;
  }
}
