/* assets/css/chatbot-styles.css */
/* ルートコンテナ */
#cbg-chat-root {
    position: relative;
    z-index: 2147483647;
}
/* トグルボタン */
#cbg-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 76px;
    background: #592645;
    color: #fff;
    padding: 12px 16px;
    border-radius: 24px;
    cursor: pointer;
    font-family: sans-serif;
    z-index: 10000;
}

/* チャットウィンドウ */
#cbg-chat-window {
    position: fixed;
    bottom: 77px;
    right: 55px;
    width: 300px;
    max-height: 500px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}
#cbg-chat-window.open {
    display: flex;
}

/* ヘッダー */
#cbg-chat-header {
    background: #592645;
    color: #fff;
    padding: 8px 12px;
    font-weight: bold;
    font-family: "Kosugi Maru", sans-serif;
    font-size: 16px;
}

/* メッセージエリア */
#cbg-chat-messages {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

/* 個別メッセージ */
.cbg-msg {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    font-family: sans-serif;
}
.cbg-user {
    background: #e5f1fb;
    align-self: flex-end;
}
.cbg-bot {
    background: #f1f0f0;
    align-self: flex-start;
}

/* 入力フォーム */
#cbg-chat-form {
    display: flex;
    border-top: 1px solid #ddd;
}
#cbg-chat-input {
    flex: 1;
    border: none;
    padding: 8px;
    outline: none;
    font-family: sans-serif;
}
#cbg-chat-form button {
    background: #592645;
    color: #fff;
    border: none;
    padding: 0 16px;
    cursor: pointer;
    font-family: sans-serif;
}
/* CSS */
@keyframes cbg-bounce-in {
    0%   { transform: scale(0.5) translateY(20px); opacity:0; }
    60%  { transform: scale(1.1) translateY(-5px); opacity:1; }
    100% { transform: scale(1)   translateY(0); }
  }
  .cbg-msg.animate-bounce {
    animation: cbg-bounce-in 0.4s ease-out both;
  }
  
  /* CSS */
@keyframes flip-in {
    0%   { transform: rotateX(-90deg); opacity:0; }
    100% { transform: rotateX(0);     opacity:1; }
  }
  .cbg-msg.flip {
    transform-origin: top center;
    animation: flip-in 0.4s ease-out forwards;
  }

/* 画像コンテナ */
.cbg-image-container {
    margin: 8px 0;
    text-align: center;
    min-height: 50px;
    position: relative;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
}

.cbg-external-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block !important;
    margin: 0 auto;
    transition: transform 0.3s ease;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* プレースホルダー画像の非表示 */
.cbg-image-container img[src*="lazy_placeholder.gif"],
.cbg-image-container img[data-src],
.cbg-image-container img[data-lazy-src],
.cbg-image-container img[data-srcset],
.cbg-image-container img[data-lazy-srcset] {
    display: none !important;
}

/* プレースホルダー画像を含むコンテナの非表示 */
.cbg-image-container:has(img[src*="lazy_placeholder.gif"]),
.cbg-image-container:has(img[data-src]),
.cbg-image-container:has(img[data-lazy-src]),
.cbg-image-container:has(img[data-srcset]),
.cbg-image-container:has(img[data-lazy-srcset]) {
    display: none !important;
}

/* 画像のホバーエフェクト */
.cbg-external-image:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* タイピングインジケーター */
.cbg-typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 4px;
}

.cbg-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.cbg-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

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

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

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

/* ローディングメッセージのスタイル */
.cbg-loading {
    opacity: 0.7;
}

/* リスト表示 */
#cbg-chat-messages ul,
#cbg-chat-messages ol {
    margin: 0 0 1em 0em;
    padding-left: 1em;
}

#cbg-chat-messages li {
    margin-bottom: 0.4em;
}