/* カスタムプロパティでボタンと吹き出しの位置を連動させる */
:root {
    --chatbot-toggle-top: 300px;
}

/* GTranslateウィジットの表示優先度を下げる */
.gt_switcher .gt_option {
    z-index: 898 !important;
}
.gt_switcher .gt_selected {
    z-index: 899 !important;
}
/* 資料請求ウィンドウの表示優先度を下げる */
.bfb_closed {
    z-index: 999 !important;
}
.bfb_view_pc {
    z-index: 998 !important;
}

/* チャットボタン */
#chatbot-toggle {
    position: fixed;
    top: var(--chatbot-toggle-top); /* 位置を変数で指定 */
    right: -25px;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 9999; /* 最前面に表示 */
}

/* チャット吹き出し */
#chatbot-tooltip {
    position: fixed;
    top: calc(var(--chatbot-toggle-top) + 15px); /* ボタンの下に連動させる */
    right: 80px; /* チャットボタンの左に配置 */
    background: #E6E6CC; /* 吹き出しの背景色 */
    color: black; /* 文字色 */
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 14px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
    white-space: nowrap; /* 文字の長さに合わせて自動調整 */
    max-width: 200px; /* 最大幅を設定 */
    z-index: 9999;
}

/* 吹き出しの右側に小さい三角を追加 */
#chatbot-tooltip::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -10px; /* 吹き出しの右端に配置 */
    transform: translateY(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent #E6E6CC; /* 吹き出しの色に合わせる */
}

/* チャットボタンが非表示のとき吹き出しも非表示 */
#chatbot-toggle[style*="display: none"] ~ #chatbot-tooltip {
    display: none;
}

/* チャットウィンドウ */
#chatbot-window {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 80px;
    right: 70px;
    width: 400px; /* 横幅を400pxに変更 */
    height: 450px; /* 初期の高さ */
    max-height: 80vh; /* 画面に収まるようにする */
    background: #f4f4f4;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 1px solid #ccc;
    z-index: 9998; /* チャットボタンの下で最前面 */
}

/* チャットヘッダー */
#chatbot-header {
    position: relative;
    background: #63635e;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    cursor: move; /* マウスカーソルをドラッグ可能な形状に */
}

#chatbot-header:active {
    cursor: grabbing; /* クリック中はつかんでいる状態のカーソル */
}

#chatbot-header button {
    position: absolute;
    top: 5px;
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

/* メッセージエリア（親要素） */
#chatbot-messages {
    flex: 1; /* 可変にする */
    overflow-y: auto; /* メッセージが増えるとスクロール */
    padding: 10px;
    background: #f4f4f4;
    display: flex;
    flex-direction: column; /* メッセージを縦並びにする */
    max-height: calc(100% - 50px); /* 入力エリアの分を引く */
}

/* メッセージ入力エリア */
#chatbot-input {
    display: flex;
    position: absolute; /* 最下部に固定 */
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #ccc;
    z-index: 1000; /* メッセージが重ならないようにする */
}

#chatbot-text {
    flex: 1;
    padding: 8px;
    border: none;
}

#chatbot-send {
    background: #63635e;
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
}

/* 吹き出しスタイル */
.chat-message {
    display: inline-block; /* テキストに合わせた横幅 */
    max-width: 80%; /* 最大幅を設定 */
    min-width: 50px; /* 最小幅を設定 */
    word-wrap: break-word; /* 長い単語がある場合に折り返し */
    padding: 8px;
    margin: 5px;
    border-radius: 10px;
    user-select: text !important; /* テキスト選択を許可 */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* ボットの吹き出し */
.chat-message.bot {
    background: white;
    border: 1px solid #63635e;
    text-align: left;
    position: relative;
    align-self: flex-start; /* ボットの吹き出しを左寄せ */
    padding-left: 40px;
    margin-bottom: 70px;
}

/* ボットの回答:強調 */
.chat-message strong {
    color: #63635e;
}

/* ボットのアイコン */
.chat-message.bot::before {
    content: "";
    background: url('https://xn--w8j8bac3czf5bl7e.com/wp-content/uploads/blog/81c0de2d915f4a602e8682796d06b475-e1751871541220.png') no-repeat center/cover;
    width: 30px;
    height: 30px;
    position: absolute;
    left: 5px;
    top: 5px;
    border-radius: 50%;
}

/* ユーザーの吹き出し */
.chat-message.user {
    background: #63635e;
    color: white;
    text-align: left;       /* 吹き出し内のテキストは左寄せ */
    border: 1px solid #d24d4d;
    align-self: flex-end;   /* ユーザーの吹き出しを右寄せ */
    margin-bottom: 30px;
}

/* 最小化ボタン */
#chatbot-minimize {
    right: 35px;
}

/* 最小化時 */
#chatbot-window.minimized {
    height: 40px; /* ヘッダーだけ表示 */
    overflow: hidden;
}

/* 最小化時に入力エリア(chatbot-input)も隠す */
#chatbot-window.minimized #chatbot-input {
    display: none;
}

/* 閉じるボタン */
#chatbot-close {
    right: 10px;
}

/* 最大化ボタン */
#chatbot-maximize {
    position: absolute;
    padding: 5px 6px 3px 3px;
    right: 60px;
    left: auto;
    top: 5px;
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

/* 最大化時のスタイル */
#chatbot-window.maximized {
    width: 90vw; /* ウィンドウ幅の90% */
    height: 90vh; /* ウィンドウ高さの90% */
    top: 10vh;
    left: 5vw;
    bottom: auto;
    right: auto;
    position: fixed;
}

/* 最大化時に入力エリア(chatbot-input)を表示 */
#chatbot-window.maximized #chatbot-input {
    display: flex;
}

/* 利用規約 */
#chatbot-agreement {
    font-size: 11px;
    text-align: center;
    color: #555;
    padding: 8px 12px 4px 12px;
    border-bottom: 1px solid #ccc;
    background-color: #f4f4f4;
}

/* タイピングアニメーション */
.typing-indicator {
    background-color: white;
    border: 1px solid #63635e;
    border-radius: 10px;
    display: inline-block;
    padding: 15px 15px 15px 40px;
    position: relative;
    margin: 5px 5px 70px 5px;
    align-self: flex-start;
    max-width: 80%;
}

/* ボットのアイコン */
.typing-indicator::before {
    content: "";
    background: url('https://xn--w8j8bac3czf5bl7e.com/wp-content/uploads/blog/81c0de2d915f4a602e8682796d06b475-e1751871541220.png') no-repeat center/cover;
    width: 30px;
    height: 30px;
    position: absolute;
    left: 5px;
    top: 5px;
    border-radius: 50%;
}

/* ドットアニメーション */
.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #63635e;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.3s; }
.typing-indicator span:nth-child(3) {
    animation-delay: 0.6s;
    margin-right: 0;
}

@keyframes typing {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

/* モバイル用スタイル */
@media screen and (max-width: 768px) {
    :root {
        --chatbot-toggle-top: 345px; /* スマホでは位置を下げる */
    }

    #chatbot-toggle img {
        width: 60px;
    }

    #chatbot-toggle {
        top: var(--chatbot-toggle-top);
        right: 20px;
    }

    #chatbot-tooltip {
        top: calc(var(--chatbot-toggle-top) + 15px); /* ボタンに合わせて移動 */
        right: 90px;
        font-size: 12px;
        padding: 6px 10px;
    }

    #chatbot-tooltip::after {
        right: -8px;
        border-width: 4px;
    }

    #chatbot-window {
        width: 90vw;
        height: 75vh;
        right: 5vw;
        bottom: 90px;
    }

    #chatbot-window.maximized {
        width: 95vw;
        height: 90vh;
        left: 2.5vw;
        top: 5vh;
        right: auto;
        bottom: auto;
    }

    #chatbot-header {
        font-size: 14px;
        padding: 8px;
    }

    #chatbot-input {
        font-size: 14px;
    }

    #chatbot-send {
        padding: 6px 10px;
    }
}

.content_title {
    margin-bottom: 600px;
    font-size: 30px;
    text-align: center;
}