/**
 * bootstrap-custom.css
 * Bootstrap 5対応のカルーセル(スライドバナー)のためのスタイル
 * 見た目と動作を改善した更新版
 */

/* カルーセルの基本スタイル */
.carousel {
  position: relative;
}

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Bootstrap 5とBootstrap 4の両方のクラスに対応 */
.item,
.carousel-item {
  position: relative;
  display: none;
  float: left;
  width: 100%;
  margin-right: -100%;
  backface-visibility: hidden;
  transition: transform .6s ease-in-out;
}

.item.active,
.carousel-item.active {
  display: block;
}

.carousel-item-next:not(.carousel-item-start),
.active.carousel-item-end,
.item.carousel-item-next:not(.carousel-item-start),
.active.item.carousel-item-end {
  transform: translateX(100%);
}

.carousel-item-prev:not(.carousel-item-end),
.active.carousel-item-start,
.item.carousel-item-prev:not(.carousel-item-end),
.active.item.carousel-item-start {
  transform: translateX(-100%);
}

/* スライドトランジションのアニメーション */
.carousel-item-next,
.carousel-item-prev,
.carousel-item.active,
.item.carousel-item-next,
.item.carousel-item-prev,
.item.active {
  display: block;
  transition: transform 0.6s ease-in-out;
}

/* カルーセルコントロールのスタイル */
.carousel-control-prev,
.carousel-control-next,
.left.carousel-control,
.right.carousel-control {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15%;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.15s ease;
  background-color: rgba(30, 87, 153, 0.1); /* 薄い青色の背景 */
  color: #1e5799; /* 濃い青色のテキスト */
}

.carousel-control-prev:hover,
.carousel-control-next:hover,
.left.carousel-control:hover,
.right.carousel-control:hover {
  opacity: 0.9;
  background-color: rgba(30, 87, 153, 0.2); /* ホバー時の背景色 */
}

.carousel-control-prev,
.left.carousel-control {
  left: 0;
}

.carousel-control-next,
.right.carousel-control {
  right: 0;
}

/* 矢印アイコンのスタイル - 青色に変更 */
.glyphicon-chevron-left,
.glyphicon-chevron-right {
  display: inline-block;
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

/* 青色の矢印アイコン */
.glyphicon-chevron-left:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%231e5799' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3E%3C/svg%3E");
}

.glyphicon-chevron-right:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%231e5799' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5L3.75 4l-2.5 2.5L2.75 8l4-4-4-4z'/%3E%3C/svg%3E");
}

/* Bootstrap 5のdata-bs-属性サポート */
[data-bs-ride="carousel"],
[data-ride="carousel"] {
  touch-action: manipulation;
}

/* 停止・再開ボタンのスタイル */
#sampleCarouselPause,
#sampleCarouselCycle {
  cursor: pointer;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  color: #333;
  padding: 5px 10px;
  border-radius: 3px;
  transition: background-color 0.3s;
}

#sampleCarouselPause:hover,
#sampleCarouselCycle:hover {
  background-color: #e0e0e0;
}

/* タブ関連のブートストラップ5対応スタイル */
/* すべてのスタイルをリセットして見本通りに修正 */
.nav-tabs {
  border-bottom: 1px solid #838383;
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-tabs > li {
  position: relative;
  margin-right: 0;
  margin-bottom: 0;
}

.nav-tabs > li > a {
  display: block;
  padding: 10px 15px;
  border: 1px solid #838383;
  border-radius: 0;
  text-decoration: none;
  color: #162F65;
  font-weight: normal;
  text-decoration: underline;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: #6B5A55;
  font-weight: normal;
  text-decoration: underline;
  background-color: #fff;
  border: 1px solid #838383;
  border-bottom-color: #fff;
  position: relative;
  z-index: 2;
}

/* トピックスがアクティブな時の左線を透明に */
.nav-tabs > li:first-child.active > a,
.nav-tabs > li:first-child.active > a:hover,
.nav-tabs > li:first-child.active > a:focus {
  border-left-color: transparent !important; 
}

/* 最後のタブ（国税庁等について）がアクティブな時の右線を透明に */
.nav-tabs > li:last-child.active > a,
.nav-tabs > li:last-child.active > a:hover,
.nav-tabs > li:last-child.active > a:focus {
  border-right-color: transparent !important; 
}

.tab-content {
  border-left: 1px solid #838383;
  border-right: 1px solid #838383;
  border-bottom: 1px solid #838383;
  padding: 15px;
  background-color: #fff;
  position: relative;
  top: -1px;
  z-index: 1;
}

/* 追加の枠線修正 - 右側の線を消して重複を防ぐ */
.nav-tabs > li:not(:last-child) > a {
  border-right: none;
}

/* Bootstrap 5互換用 */
.nav-tabs .nav-item:not(:last-child) .nav-link {
  border-right: none;
}

/* 右端の線の調整を復活 */
.nav-tabs:after,
.nav-tabs::after,
.nav:after,
.nav::after {
  display: none !important;
}

/* Bootstrap 5互換用 */
.nav-tabs .nav-item {
  position: relative;
  margin-right: 0;
  margin-bottom: 0;
}

.nav-tabs .nav-link {
  display: block;
  padding: 10px 15px;
  border: 1px solid #838383;
  border-radius: 0;
  text-decoration: underline;
  color: #162F65;
  font-weight: normal;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link.active:hover,
.nav-tabs .nav-link.active:focus {
  color: #6B5A55;
  font-weight: normal;
  text-decoration: underline;
  background-color: #fff;
  border: 1px solid #838383;
  border-bottom-color: #fff;
  position: relative;
  z-index: 2;
}

/* Bootstrap 5互換用 - トピックスがアクティブな時の左線を透明に */
.nav-tabs .nav-item:first-child .nav-link.active,
.nav-tabs .nav-item:first-child .nav-link.active:hover,
.nav-tabs .nav-item:first-child .nav-link.active:focus {
  border-left-color: transparent !important;
}

/* Bootstrap 5互換用 - 最後のタブがアクティブな時の右線を透明に */
.nav-tabs .nav-item:last-child .nav-link.active,
.nav-tabs .nav-item:last-child .nav-link.active:hover,
.nav-tabs .nav-item:last-child .nav-link.active:focus {
  border-right-color: transparent !important;
}

.tab-content > .tab-pane {
  display: none;
}

.tab-content > .active {
  display: block;
}

.tab-content > .tab-pane.fade {
  opacity: 0;
}

.tab-content > .tab-pane.fade.in,
.tab-content > .tab-pane.fade.show {
  opacity: 1;
}

/* Bootstrap 4 と 5 の両方をサポート */
.fade.in,
.fade.show {
  opacity: 1;
}

/* レスポンシブ対応のためのスタイル追加 */

/* 小さい画面（モバイル等）のレイアウト */
@media screen and (max-width: 767px) {
  /* タブを縦に並べる */
  .nav-tabs {
    flex-direction: column;
    border-bottom: none;
  }
  
  .nav-tabs > li,
  .nav-tabs .nav-item {
    width: 100%;
    margin-bottom: -1px;
  }
  
  .nav-tabs > li > a,
  .nav-tabs .nav-link {
    border: 1px solid #838383;
    margin-right: 0;
  }
  
  /* アクティブタブのスタイル調整 */
  .nav-tabs > li.active > a,
  .nav-tabs > li.active > a:hover,
  .nav-tabs > li.active > a:focus,
  .nav-tabs .nav-link.active,
  .nav-tabs .nav-link.active:hover,
  .nav-tabs .nav-link.active:focus {
    border-bottom-color: #838383;
  }
  
  /* トピックスタブの左線を元に戻す */
  .nav-tabs > li:first-child.active > a,
  .nav-tabs > li:first-child.active > a:hover,
  .nav-tabs > li:first-child.active > a:focus,
  .nav-tabs .nav-item:first-child .nav-link.active,
  .nav-tabs .nav-item:first-child .nav-link.active:hover,
  .nav-tabs .nav-item:first-child .nav-link.active:focus {
    border-left-color: #838383 !important;
  }
  
  /* 最後のタブの右線を元に戻す */
  .nav-tabs > li:last-child.active > a,
  .nav-tabs > li:last-child.active > a:hover,
  .nav-tabs > li:last-child.active > a:focus,
  .nav-tabs .nav-item:last-child .nav-link.active,
  .nav-tabs .nav-item:last-child .nav-link.active:hover,
  .nav-tabs .nav-item:last-child .nav-link.active:focus {
    border-right-color: #838383 !important;
  }
  
  /* タブコンテンツのスタイル調整 */
  .tab-content {
    border-top: 1px solid #838383;
    top: 0;
  }
  
  /* 右側の線の調整 */
  .nav-tabs > li:not(:last-child) > a,
  .nav-tabs .nav-item:not(:last-child) .nav-link {
    border-right: 1px solid #838383;
  }
}

/* 中間サイズの画面対応 */
@media screen and (min-width: 768px) and (max-width: 991px) {
  /* 必要に応じて追加 */
}

/* 大きい画面（デスクトップ等）のレイアウト - 念のため明示的に設定 */
@media screen and (min-width: 768px) {
  .nav-tabs {
    flex-direction: row;
    border-bottom: 1px solid #838383;
  }
}
/* エディタモードでのタブ表示用スタイル */
.edit-mode-visible {
  display: block !important;
  opacity: 1 !important;
  position: relative !important;
  border-top: 3px dashed #f00 !important;
  margin-top: 30px !important;
}

.edit-mode-visible::before {
  content: attr(id) " タブの内容";
  position: absolute;
  top: -25px;
  left: 0;
  background: #ffeeee;
  padding: 3px 8px;
  border: 1px solid #f99;
  font-weight: bold;
  color: #c00;
}

/* ただし、実際の表示では元の動作に戻す */
@media screen {
  .tab-pane.fade:not(.show) {
    display: none !important;
  }
  
  .edit-mode-visible::before {
    display: none !important;
  }
  
  .edit-mode-visible {
    border-top: none !important;
    margin-top: 0 !important;
  }
}
/* タブのフォーカス時の黒い枠を消す */
.nav-tabs > li > a:focus,
.nav-tabs .nav-link:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: #ddd !important;
}

/* アクティブタブのフォーカス時のスタイル */
.nav-tabs > li.active > a:focus,
.nav-tabs .nav-link.active:focus {
  border-bottom-color: transparent !important;
}

/* すべてのタブリンクでのフォーカスアウトラインを削除 */
a:focus, 
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none !important;
}