/* チャットボットのスタイル */
#my-chatbot {
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 全体のボックスサイジング設定 */
#my-chatbot * {
    box-sizing: border-box;
}

/* チャットアイコン */
#my-chatbot #chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 220px;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    z-index: 9999;
}

#my-chatbot #chat-icon:hover {
    transform: scale(1.05);
}

/* チャットコンテナ */
#my-chatbot #chat-container {
    position: fixed;
    width: 420px;
    height: 680px;
    bottom: 20px;
    right: 20px;
    border-radius: 10px;
    background: white;
    display: none;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 10000;
}

#my-chatbot #chat-container.visible {
    display: flex;
}

/* チャットヘッダー */
#my-chatbot #chat-header {
    background-color: var(--chat-header-color, #cc0000);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#my-chatbot #chat-title {
    font-weight: bold;
    color: var(--chat-title-color, white);
    flex-grow: 1;
}

#my-chatbot #close-chat {
    cursor: pointer;
    font-size: 24px;
    color: var(--chat-title-color, white);
    background: none;
    border: none;
    padding: 0;
    margin-left: 10px;
}

/* メッセージエリア */
#my-chatbot #chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
}

/* メッセージスタイル */
#my-chatbot .message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

#my-chatbot .message.user-message {
    justify-content: flex-end;
}

#my-chatbot .message.bot-message {
    justify-content: flex-start;
}

#my-chatbot .message-icon {
    width: 35px;
    height: 35px;
    margin: 0 10px;
    flex-shrink: 0;
}

#my-chatbot .bot-message .message-icon {
    order: -1;
}

#my-chatbot .message-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#my-chatbot .message-content {
    max-width: 70%;
}

#my-chatbot .message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

#my-chatbot .user-message .message-bubble {
    background-color: #007bff;
    color: white;
}

#my-chatbot .bot-message .message-bubble {
    background-color: white;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* タイピングインジケーター */
#my-chatbot .bot-message.loading .message-bubble::after {
    content: '';
    display: inline-block;
    animation: typing 1.4s infinite;
}

@keyframes typing {
    0% { content: 'AIが回答中'; }
    33% { content: 'AIが回答中.'; }
    66% { content: 'AIが回答中..'; }
    100% { content: 'AIが回答中...'; }
}

/* 入力エリア */
#my-chatbot #chat-input-container {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#my-chatbot #user-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#my-chatbot #user-input:focus {
    border-color: #007bff;
}

#my-chatbot #send-button {
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

#my-chatbot #send-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #007bff;
    stroke-width: 2;
}

#my-chatbot #send-button:hover svg {
    stroke: #0056b3;
}

/* フッター */
#my-chatbot #chat-footer {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    background-color: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#my-chatbot #chat-footer a {
    color: #666;
    text-decoration: none;
}

#my-chatbot #chat-footer a:hover {
    text-decoration: underline;
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* スマートフォン向けスタイル */
@media screen and (max-width: 768px) {
    #my-chatbot #chat-icon {
        bottom: 20px;
        right: 5vw;
        width: 50vw;
        max-width: 200px;
        height: auto;
        padding-bottom: 25vw;
    }

    #my-chatbot #chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    #my-chatbot #chat-header {
        padding: 15px;
    }

    #my-chatbot #chat-messages {
        padding: 15px;
    }

    #my-chatbot .message-content {
        max-width: 80%;
    }

    #my-chatbot #user-input {
        font-size: 16px; /* iOSでのズーム防止 */
    }
}

/* body要素のスタイル調整 */
body.chat-open {
    overflow: hidden;
}

/* デバッグ用のスタイルを削除 */
#my-chatbot #chat-icon::after {
    display: none;
}

/* CSS変数 */
:root {
    --chat-header-color: #cc0000;
    --chat-title-color: #ffffff;
}