/* assets/chatbot.css - 咲耶ちゃんテーマ（エックスモバイル風デザイン） */

:root {
    --sakuya-pink-vibrant: #E91E63; /* ヘッダーやボタン用の鮮やかなピンク */
    --sakuya-pink-soft: #FCE4EC;    /* 咲耶の吹き出し用のソフトピンク */
    --sakuya-pink-bg: #FFF0F5;      /* 背景用の超薄ピンク */
    --sakuya-white: #FFFFFF;
    --text-color-dark: #333333;
    --text-color-light: #757575;
    --border-color: #E0E0E0;
    --font-family-main: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

/* モバイルズーム防止のためのベーススタイル */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

#cnm-chatbot-widget, #cnm-chatbot-widget * {
    font-family: var(--font-family-main);
    box-sizing: border-box;
}

#cnm-chatbot-toggle {
    background: var(--sakuya-pink-vibrant);
    color: var(--sakuya-white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    border: none;
}
#cnm-chatbot-toggle:hover {
    transform: scale(1.1);
}

#cnm-chatbot-container {
    width: 450px;
    max-height: 80vh;
    height: 600px;
    background: var(--sakuya-white);
    border-radius: 16px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
}

.cnm-chatbot-closed #cnm-chatbot-container {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
.cnm-chatbot-open #cnm-chatbot-container {
    opacity: 1;
    transform: translateY(0);
}

#cnm-chatbot-header {
    background: var(--sakuya-pink-vibrant);
    color: var(--sakuya-white);
    padding: 16px 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#cnm-chatbot-header h4 {
    margin: 0;
    font-size: 16px;
}
#cnm-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cnm-chatbot-messages {
    flex-grow: 1;
    padding: 20px;
    background-color: var(--sakuya-pink-bg);
    overflow-y: auto;
    scroll-behavior: smooth;
    min-height: 400px;
}

/* 吹き出しメッセージのコンテナ */
.cnm-message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-end;
}

/* ボットメッセージ（左側、白背景） */
.cnm-bot-message {
    align-self: flex-start;
    flex-direction: row;
}

/* ユーザーメッセージ（右側、ピンク背景） */
.cnm-user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* アバター（42px円形） */
.cnm-message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--sakuya-white);
}
.cnm-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ボットメッセージのアバター（左側、10pxマージン） */
.cnm-bot-message .cnm-message-avatar {
    margin-right: 10px;
}

/* ユーザーメッセージのアバター（右側、10pxマージン） */
.cnm-user-message .cnm-message-avatar {
    margin-left: 10px;
}

/* メッセージ吹き出し */
.cnm-message-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    line-height: 1.7;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
    max-width: 70%;
}

/* ボットメッセージの吹き出し（白背景、左側に尾） */
.cnm-bot-message .cnm-message-bubble {
    background: var(--sakuya-white);
    color: var(--text-color-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cnm-bot-message .cnm-message-bubble:before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 20px 8px;
    border-color: transparent transparent var(--sakuya-white) transparent;
}

/* ユーザーメッセージの吹き出し（ピンク背景、右側に尾） */
.cnm-user-message .cnm-message-bubble {
    background: var(--sakuya-pink-soft);
    color: var(--text-color-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.cnm-user-message .cnm-message-bubble:before {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 20px 0;
    border-color: transparent transparent var(--sakuya-pink-soft) transparent;
}

/* リンクのスタイル */
.cnm-message-bubble a {
    color: var(--sakuya-pink-vibrant);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}
.cnm-message-bubble a:hover {
    opacity: 0.8;
}

/* 太字のスタイル */
.cnm-message-bubble strong {
    font-weight: 700;
    color: var(--text-color-dark);
}

/* 入力エリア（60px固定） */
#cnm-chatbot-input-area {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background: var(--sakuya-white);
    display: flex;
    align-items: center;
    height: 60px;
    flex-shrink: 0;
}

#cnm-chatbot-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 16px;
    outline: none;
    background: #F9F9F9;
}
#cnm-chatbot-input:focus {
    border-color: var(--sakuya-pink-vibrant);
    background: var(--sakuya-white);
}

#cnm-chatbot-send {
    background: var(--sakuya-pink-vibrant);
    color: var(--sakuya-white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#cnm-chatbot-send:hover {
    background: #c2185b;
}

/* ローディングアニメーション */
.cnm-typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.cnm-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sakuya-pink-vibrant);
    animation: typing 1.4s infinite;
}

.cnm-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.cnm-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* サービス選択ボタンコンテナ */
.cnm-service-selection-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 20px;
    margin: 8px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* サービス選択ボタン */
.cnm-service-button {
    background: linear-gradient(135deg, var(--sakuya-pink-vibrant) 0%, #d81b60 100%);
    color: var(--sakuya-white);
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cnm-service-button:hover {
    background: linear-gradient(135deg, #d81b60 0%, #c2185b 100%);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
    transform: translateY(-2px);
}

.cnm-service-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(233, 30, 99, 0.2);
}

/* タブレットサイズでの最適化 */
@media (max-width: 768px) and (min-width: 481px) {
    #cnm-chatbot-container {
        width: 400px;
    }
}

/* スマートフォンサイズでの最適化 */
@media (max-width: 480px) {
    #cnm-chatbot-container {
        width: 100%;
        height: 100%;
        max-height: none;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border-radius: 0;
        margin: 0;
    }

    #cnm-chatbot-messages {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
    }

    #cnm-chatbot-toggle {
        width: 56px;
        height: 56px;
        right: 16px;
        bottom: 16px;
        font-size: 24px;
    }

    .cnm-chatbot-open #cnm-chatbot-toggle {
        display: none;
    }

    .cnm-message-bubble {
        max-width: 80%;
    }

    .cnm-message-avatar {
        width: 36px;
        height: 36px;
    }

    .cnm-bot-message .cnm-message-avatar {
        margin-right: 8px;
    }

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

    #cnm-chatbot-input {
        font-size: 16px;
    }

    #cnm-chatbot-header {
        padding: 20px;
    }

    #cnm-chatbot-input-area {
        padding: 16px;
        background: var(--sakuya-white);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    /* サービス選択ボタンのモバイル対応 */
    .cnm-service-selection-container {
        padding: 8px 16px;
    }

    .cnm-service-button {
        padding: 10px 16px;
        font-size: 14px;
    }
}
