/* ============================================
   scroll-tab-button.css
   横スクロールタブ ボタン制御スタイル
   使用方法: id="scroll-tab-button1" のように
             連番でIDを付与してください
   ============================================ */

/* タブリスト */
[id*="scroll-tab-button"] .cmp-tabs__tablist {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    gap: 8px;
    padding: 0 0 8px 0;
    list-style: none;
    margin: 0;
    width: 100% !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* スクロールバー */
@media (max-width: 767px) {
    [id*="scroll-tab-button"] .cmp-tabs__tablist {
        scrollbar-width: auto !important;
        -ms-overflow-style: auto !important;
    }

    [id*="scroll-tab-button"] .cmp-tabs__tablist::-webkit-scrollbar {
        height: 12px !important;
    }

    [id*="scroll-tab-button"] .cmp-tabs__tablist::-webkit-scrollbar-track {
        background: #eeeeee !important;
        border-top: 5px solid #ffffff !important;
        border-bottom: 5px solid #ffffff !important;
    }

    [id*="scroll-tab-button"] .cmp-tabs__tablist::-webkit-scrollbar-thumb {
        background: #999999 !important;
        border-top: 5px solid #ffffff !important;
        border-bottom: 5px solid #ffffff !important;
        border-radius: 0 !important;
    }

    [id*="scroll-tab-button"] .cmp-tabs__tablist::-webkit-scrollbar-thumb:hover,
    [id*="scroll-tab-button"] .cmp-tabs__tablist::-webkit-scrollbar-thumb:active {
        background: #000000 !important;
    }
}

/* タブアイテム（共通） */
[id*="scroll-tab-button"] .cmp-tabs__tab {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap !important;
    text-align: center;
    box-sizing: border-box !important;
    background-color: #888888;
    color: #ffffff;
    padding: 10px 16px;
    cursor: pointer;
    border: 2px solid #888888;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.4 !important;
    font-weight: bold;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    min-width: auto !important;
    width: auto !important;
}

/* アクティブタブ */
[id*="scroll-tab-button"] .cmp-tabs__tab--active,
[id*="scroll-tab-button"] .cmp-tabs__tab[aria-selected="true"] {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

/* ホバー */
@media (min-width: 768px) {
    [id*="scroll-tab-button"] .cmp-tabs__tab:hover {
        background-color: #000;
        color: #ffffff;
        border-color: #000000;
    }
}

/* ============================================
   ボタンラッパー：デフォルト非表示
   ============================================ */
[id*="scroll-tab-button"] .cmp-tabs__btn {
    display: none;
}

/* ============================================
   1200px未満：横並びレイアウト
   ============================================ */
@media (min-width: 768px) and (max-width: 1199px) {

    /* ボタン＋タブリストを横並びにするラッパー */
    [id*="scroll-tab-button"] .scroll-tab-button__row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    /* タブリストは残りの幅をすべて使う */
    [id*="scroll-tab-button"] .scroll-tab-button__row .cmp-tabs__tablist {
        flex: 1 1 0% !important;
        width: 0 !important;
        min-width: 0 !important;
    }

    /* タブアイテム：縮まない・最小幅固定 */
    [id*="scroll-tab-button"] .cmp-tabs__tab {
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
        /* 縮まない */
        flex-basis: auto !important;
        min-width: 80px !important;
        /* 最小幅固定 */
        white-space: nowrap !important;
        word-break: normal;
    }

    /* 前へ・次へボタン共通 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        min-width: 36px;
        align-self: stretch;
        background-color: #ffffff;
        cursor: pointer;
        flex-shrink: 0;
        user-select: none;
        transition: background-color 0.2s;
        box-sizing: border-box;
        margin-bottom: 8px;
    }

    /* ホバー */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev:hover,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next:hover {
        background-color: #eeeeee;
    }

    /* 非活性（スクロール端） */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev.is-disabled,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next.is-disabled {
        background-color: #ffffff;
        border-color: #cccccc;
        cursor: default;
        pointer-events: none;
    }

    /* spanは非表示 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev span,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next span {
        display: none;
    }

    /* 矢印を::beforeで生成 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev::before,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next::before {
        content: '';
        display: block;
        width: 10px;
        height: 10px;
        border-top: 2px solid #000000;
        border-right: 2px solid #000000;
        border-bottom: none;
        border-left: none;
    }

    /* 左矢印 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev::before {
        transform: rotate(-135deg) translateX(-2px);
    }

    /* 右矢印 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-next::before {
        transform: rotate(45deg) translateX(-2px);
    }

    /* 非活性時の矢印色 */
    [id*="scroll-tab-button"] .cmp-tabs__btn-prev.is-disabled::before,
    [id*="scroll-tab-button"] .cmp-tabs__btn-next.is-disabled::before {
        border-color: #cccccc;
    }
}

/* ============================================
   1200px以上：タブを均等配置・ボタン非表示
   ============================================ */
@media (min-width: 1200px) {

    [id*="scroll-tab-button"] .cmp-tabs__tablist {
        overflow-x: hidden !important;
    }

    [id*="scroll-tab-button"] .cmp-tabs__tab {
        flex-grow: 1 !important;
        flex-shrink: 1 !important;
        flex-basis: 0 !important;
        min-width: 0 !important;
        white-space: normal !important;
        word-break: break-word;
    }
}

/* ============================================
   767px以下：スマホはタッチスクロールのみ
   ============================================ */
@media (max-width: 767px) {

    /* タブアイテム：縮まない */
    [id*="scroll-tab-button"] .cmp-tabs__tab {
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
        flex-basis: auto !important;
        min-width: 80px !important;
        white-space: nowrap !important;
        word-break: normal;
    }
}