/* =============================================
   chatbot.css - 住まい工房 チャットbot
   ============================================= */

/* フローティングボタン */
#chatbot_btn {
    display: none;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 88px;
    height: 88px;
    background: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: transform 0.2s, opacity 0.3s ease;
}
#chatbot_btn:hover {
    transform: scale(1.06);
}
#chatbot_btn.chatbot_btn_visible {
    opacity: 1;
    pointer-events: auto;
}
#chatbot_btn img {
    width: 88px;
    height: 88px;
    border-radius: 0;
    object-fit: contain;
}
#chatbot_btn span {
    display: none;
}

/* オーバーレイ */
#chatbot_overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.15);
    z-index: 9001;
}

/* チャット小窓 */
#chatbot_window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 500px;
    height: 680px;
    min-width: 320px;
    min-height: 400px;
    background: none;
    border: none;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    flex-direction: column;
    z-index: 9002;
    font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "メイリオ", Meiryo, sans-serif;
    letter-spacing: 0.05em;
    font-size: 15px;
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease, height 0.3s ease;
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
}

#chatbot_window.chatbot_open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

#chatbot_window.chatbot_minimized {
    height: 240px !important;
    min-height: unset !important;
    opacity: 0.85;
}

/* ヘッダー */
#chatbot_header {
    background: rgba(60, 20, 0, 0.8);
    color: #fff;
    padding: 8px 20px 8px 12px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 15px;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}
#chatbot_header_btns {
    display: flex;
    align-items: center;
    gap: 12px;
}
#chatbot_close,
#chatbot_minimize {
    color: #fff !important;
    text-decoration: none !important;
    font-size: 18px;
    line-height: 1;
    opacity: 0.85;
    cursor: pointer;
}
#chatbot_close {
    margin-right: 4px;
}
#chatbot_close:hover,
#chatbot_minimize:hover {
    opacity: 1;
    text-decoration: none;
}

.chatbot_reset_btn {
    font-size: 11px !important;
    opacity: 0.75 !important;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: normal !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* メッセージエリア */
#chatbot_messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
    background: rgba(20, 5, 0, 0.5);
    display: flex;
    flex-direction: column;
}

#chatbot_load_more {
    text-align: center;
    padding: 6px 0 10px;
    font-size: 12px;
    flex-shrink: 0;
}
#chatbot_load_btn {
    color: #ccc;
    text-decoration: none;
}
#chatbot_load_btn:hover {
    color: #8a4e14;
}

/* メッセージ行 */
.chatbot_row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
    width: 100%;
}
.chatbot_user_row {
    justify-content: flex-end;
}

/* アイコン */
.chatbot_icon_wrap {
    width: 58px;
    flex-shrink: 0;
}
.chatbot_circle {
    width: 46px;
    height: 46px;
    border: 1px solid #ddd;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.chatbot_circle img {
    height: 40px;
    position: relative;
    top: 3px;
    left: -6px;
}

/* アシスタント吹き出し */
.chatbot_bubble {
    display: inline-block;
    margin-left: 8px;
    border: 1px solid #888;
    border-radius: 4px 10px 10px 10px;
    padding: 14px 24px 18px 20px;
    background: #fff;
    line-height: 1.7;
    max-width: calc(100% - 70px);
    word-break: break-word;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    font-size: 14px;
    text-align: justify;
    word-break: break-all;
    color: #000;
}

.chatbot_bubble a {
    color: #0066cc !important;
    text-decoration: underline !important;
}

/* ユーザー吹き出し */
.chatbot_user_bubble {
    display: inline-block;
    background: #fff5e6;
    border: 1px solid #f8c880;
    border-radius: 10px 4px 10px 10px;
    padding: 10px 14px;
    line-height: 1.7;
    max-width: calc(100% - 20px);
    word-break: break-word;
    text-align: justify;
    word-break: break-all;
    font-size: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    color: #000;
}

/* 入力エリア */
#chatbot_input_area {
    display: flex;
    padding: 10px;
    border-top: 1px solid rgba(60, 20, 0, 0.4);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0 0 8px 8px;
    align-items: flex-end;
    flex-shrink: 0;
}
#chatbot_input {
    flex: 1;
    border: 1px solid rgba(90, 55, 15, 0.6);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 16px; /* iOSズーム防止 */
    resize: none;
    font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    line-height: 1.6;
    max-height: 120px;
    overflow-y: auto;
}
#chatbot_input:focus {
    outline: none;
    border-color: rgba(90, 55, 15, 0.95);
}
#chatbot_send {
    margin-left: 8px;
    padding: 6px 14px;
    align-self: stretch;
    background: linear-gradient(160deg, #ffaa00, #e05000);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}
#chatbot_send:hover {
    opacity: 0.85;
}
#chatbot_send_icon {
    font-size: 20px;
    line-height: 1.2;
}
#chatbot_send_label {
    font-size: 14px;
    letter-spacing: 0.05em;
}

/* リサイズハンドル（jQueryUI） */
.ui-resizable-handle {
    z-index: 9003;
}

/* スマホ：全画面 */
@media screen and (max-width: 600px) {
    #chatbot_window {
        width: 100% !important;
        height: 100dvh !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: auto !important;
        border-radius: 8px;
        min-width: unset;
        min-height: unset;
    }
    #chatbot_header {
        border-radius: 8px 8px 0 0;
    }
    #chatbot_btn {
        bottom: 16px;
        right: 16px;
        width: 76px;
        height: 76px;
    }
    #chatbot_btn img {
        width: 76px;
        height: 76px;
    }
}

/* こぼ吹き出しのアニメーション */
@keyframes kobo_slide_in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
.chatbot_bubble.kobo_animate {
    animation: kobo_slide_in 0.3s ease-out forwards;
}

@keyframes user_slide_in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
.chatbot_user_bubble.user_animate {
    animation: user_slide_in 0.25s ease-out forwards;
}

/* 最小化ボタン（スマホのみ表示） */
#chatbot_minimize {
    display: inline;
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
    opacity: 0.85;
    cursor: pointer;
}
#chatbot_minimize:hover {
    opacity: 1;
}

@media screen and (max-width: 600px) {
    #chatbot_window.chatbot_minimized {
        height: 40vh !important;
        min-height: unset !important;
        top: auto !important;
        bottom: 0 !important;
        opacity: 0.85;
    }
    #chatbot_window.chatbot_minimized #chatbot_messages {
        overflow-y: auto;
        background: rgba(20, 5, 0, 0.5);
    }
}

/* スクロールバーを透明に近づける */
#chatbot_messages::-webkit-scrollbar {
    width: 6px;
}
#chatbot_messages::-webkit-scrollbar-track {
    background: transparent;
}
#chatbot_messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}
#chatbot_messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* ローディング表示 */
.chatbot_processing_msg {
    color: #bbb;
    font-size: 12px;
}
.chatbot_thinking_msg {
    color: #666;
    font-size: 13px;
}

/* 棒グラフアニメーション */
.chatbot_bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}
.chatbot_bars span {
    display: inline-block;
    width: 3px;
    background: #8a5a20;
    border-radius: 2px;
    animation: chatbot_bar_bounce 1s ease-in-out infinite;
}
.chatbot_bars span:nth-child(1) { animation-delay: 0s;    height: 6px; }
.chatbot_bars span:nth-child(2) { animation-delay: 0.15s; height: 10px; }
.chatbot_bars span:nth-child(3) { animation-delay: 0.3s;  height: 14px; }
.chatbot_bars span:nth-child(4) { animation-delay: 0.45s; height: 8px; }

@keyframes chatbot_bar_bounce {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50%       { transform: scaleY(1);   opacity: 1; }
}

/* 物件サムネイル付きリンク行 */
.kobo_bk_link_row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0;
}
.kobo_bk_thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid #ddd;
}
.kobo_bk_link_row a {
    word-break: break-all;
    font-size: 13px;
}
