/* チャットボットのコンテナ */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background-color: #e1d7c6;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, sans-serif;
    z-index: 1000;
}

/* ヘッダー */
#chatbot-header {
    background-color: #69766c;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#chatbot-header h3 {
    margin: 0;
    font-size: 1.1em;
    margin-left: 10px;
}

#chatbot-close-btn {
    cursor: pointer;
    font-size: 1.5em;
    padding: 0 5px;
}

/* ヘッダーのボットアバター */
#bot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    vertical-align: middle;
}

/* メッセージ表示エリア */
#chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 75%;
    word-wrap: break-word;
    display: flex;
    align-items: flex-start;
}

.user-message {
    background-color: #e1ffc7;
    align-self: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.bot-message {
    background-color: #f5f5f5;
    align-self: flex-start;
    margin-right: auto;
}

/* メッセージ内のアバター */
.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    margin-right: 0;
    margin-left: 8px;
}

/* メッセージ内のテキスト部分 */
.message-content {
    flex-grow: 1;
}

/* 入力エリア */
#chatbot-input-area {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

#chatbot-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 1em;
}

#chatbot-send-btn {
    background-color: #69766c;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1em;
}

#chatbot-send-btn:hover {
    background-color: #69766c;
}

/* チャットボットを開くボタン */
#chatbot-open-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #525740 /* 紫系の色に調整 */
    color: white;
    border: none;
    border-radius: 30px; /* 角丸にする */
    height: auto; /* コンテンツに合わせて高さを調整 */
    padding: 8px 15px; /* 内側の余白 */
    font-size: 1em;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex; /* Flexboxでアイコンとテキストを横並び */
    align-items: center; /* 垂直方向中央揃え */
    z-index: 999;
    overflow: hidden; /* 画像がはみ出さないように */
    white-space: nowrap; /* テキストが改行されないように */
}

#chatbot-open-btn:hover {
    background-color: #69766c;
}

/* チャットボットを開くボタン内のアイコン */
.chatbot-open-icon {
    width: 40px; /* アイコンのサイズを調整 */
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px; /* アイコンとテキストの間隔 */
    flex-shrink: 0; /* アイコンが縮まないように */
}

/* チャットボットを開くボタン内のテキストコンテナ */
.chatbot-text-content {
    display: flex;
    flex-direction: column;
    text-align: left; /* テキストを左寄せ */
}

.chatbot-text-content h4 {
    margin: 0;
    font-size: 1em; /* 見出しのフォントサイズ */
    font-weight: bold;
    line-height: 1.2;
}

.chatbot-text-content p {
    margin: 0;
    font-size: 0.8em; /* 文言のフォントサイズ */
    line-height: 1.2;
    color: #fff; /* 薄めの色にする */
}

/* 選択肢ボタンのスタイル */
.option-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-width: 90%;
}

.option-button {
    background-color: #e1d7c6;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    color: #333;
    transition: background-color 0.2s;
}

.option-button:hover {
    background-color: #e0e0e0;
}

/* チャットボットを開くボタン内のテキストコンテナ */
.chatbot-text-content {
    display: flex;
    flex-direction: column;
    text-align: left; /* テキストを左寄せ */
}

.chatbot-text-content h4 {
    margin: 0;
    font-size: 1em; /* 見出しのフォントサイズ */
    font-weight: bold;
    line-height: 1.2;
}

.chatbot-text-content p {
    margin: 0;
    font-size: 0.8em; /* 文言のフォントサイズ */
    line-height: 1.2;
    color: #fff; /* 薄めの色にする */
}

/* 選択肢ボタンのスタイル */
.option-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-width: 90%;
}

.option-button {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    color: #333;
    transition: background-color 0.2s;
}

.option-button:hover {
    background-color: #e0e0e0;
}

/* ====================================================== */
/* 4.7インチスマートフォン向けの中央表示スタイル */
/* ====================================================== */
@media (max-width: 420px) { /* iPhone SE, 6/7/8 などに対応する最大幅 */
    #chatbot-container {
        width: calc(100% - 40px); /* 左右に20pxずつの余白を持たせる */
        left: 50%;               /* 左端から50%の位置に移動 */
        transform: translateX(-50%); /* 要素の幅の半分だけ左にずらし、中央に配置 */
        right: auto;             /* rightプロパティを解除 */
        bottom: 20px;            /* 下からの位置は維持 */
        height: 80vh;            /* 画面の高さに対する割合で高さを調整 */
    }

    #chatbot-open-btn {
        right: 50%;              /* 開くボタンも同様に中央に配置 */
        transform: translateX(50%); /* 要素の幅の半分だけ右にずらし、中央に配置 */
        left: auto;              /* leftプロパティを解除 */
        bottom: 20px;            /* 下からの位置は維持 */
    }
}