/* チャットアイコン */
#wacb-chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--wacb-color-icon, #0073aa);
    color: white;
    width: auto; 
    min-width: 50px;
    height: 50px;
    padding: 0 15px;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 9998;
}

#wacb-chat-icon:not(.has-text) {
    width: 50px;
    padding: 0;
}

#wacb-chat-icon svg {
    flex-shrink: 0;
}

/* ★★★ カスタム画像モード時のスタイル ★★★ */
/* 背景色・影・枠線・余白・角丸をすべて無効化 */
#wacb-chat-icon.has-custom-image {
    /* ★修正: !important を削除（jQueryのhide()を有効にするため） */
    display: block;

    background-color: transparent !important;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    
    /* コンテナのサイズ制限を解除 */
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    
    /* 位置指定 (右下が基準点となる) */
    position: fixed;
    bottom: 20px;
    right: 20px;
    
    transform: none !important;
}

/* ★★★ カスタム画像のスタイル ★★★ */
.wacb-custom-icon-img {
    display: block;
    
    /* サイズ制限を解除し、本来のサイズを表示 */
    height: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    
    object-fit: contain;
    border-radius: 0 !important;
}

/* テキスト非表示モードの時も同様 */
#wacb-chat-icon:not(.has-text) .wacb-custom-icon-img {
    height: auto !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 0 !important;
}

.wacb-icon-text {
    margin-left: 10px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

#wacb-chat-icon:not(.has-text) .wacb-icon-text {
    display: none;
}


/* チャットウィンドウ */
#wacb-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-width: 90%;
    height: 500px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ヘッダー */
#wacb-chat-header {
    background-color: var(--wacb-color-header, #0073aa);
    color: white;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#wacb-close-btn {
    cursor: pointer;
    font-size: 30px;
    font-weight: bold;
    line-height: 1;
    padding: 0 5px;
    transition: opacity 0.2s;
}
#wacb-close-btn:hover {
    opacity: 0.8;
}


/* チャットログ */
#wacb-chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wacb-message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}
.wacb-message p {
    margin: 0;
    padding: 0;
    font-size: 14px;
    text-align: left; /* 左寄せ */
}
/* ボット（AI）のメッセージ */
.wacb-message.wacb-bot {
    background-color: var(--wacb-color-bot-bg, #e9e9eb);
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}
/* ユーザーのメッセージ */
.wacb-message.wacb-user {
    background-color: var(--wacb-color-user-bg, #0073aa);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}
.wacb-message.wacb-loading p {
    font-style: italic;
    color: #555;
}

/* 入力エリア */
#wacb-chat-input {
    display: flex;
    border-top: 1px solid #ddd;
    padding: 10px;
}
#wacb-user-message {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    /* ★ 修正1: 14pxから16pxに変更して自動ズームを無効化 */
    font-size: 16px; 
    margin-right: 10px;
}
/* 送信ボタン */
#wacb-send-btn {
    background-color: var(--wacb-color-send-btn, #0073aa);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
}
#wacb-send-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

/* チャットウィンドウ最下部の注釈リンク */
#wacb-privacy-link {
    font-size: 10px;
    color: #999;
    text-align: center;
    padding: 5px 10px 8px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    line-height: 1.3;
}
#wacb-privacy-link a {
    color: #999;
    text-decoration: underline;
    cursor: pointer;
}
#wacb-privacy-link a:hover {
    color: #555;
}

/* 規約モーダルのスタイル */
#wacb-tac-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wacb-tac-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.wacb-tac-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    z-index: 100001;
    font-family: sans-serif;
}

.wacb-tac-body {
    padding: 20px 25px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    text-align: left; /* 左寄せ */
}
.wacb-tac-body h2 {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    color: #0073aa;
}
.wacb-tac-body h3 {
    font-size: 15px;
    margin-top: 20px;
    margin-bottom: 5px;
    color: #333;
}
.wacb-tac-body ul {
    margin: 5px 0 10px 20px;
    padding: 0;
    list-style-type: disc;
}

#wacb-tac-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}
#wacb-tac-close-btn:hover {
    color: #d63638;
}

.wacb-tac-footer {
    padding: 10px 20px;
    border-top: 1px solid #eee;
    text-align: center;
    background: #f9f9f9;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
#wacb-tac-agree-close {
    padding: 8px 20px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
#wacb-tac-agree-close:hover {
    background-color: #005177;
}

.pagetop {
    display: none!important;
}

/* レスポンシブ対応 (1000px以下) */
@media screen and (max-width: 1000px) {
    #wacb-chat-icon {
        bottom: 70px;
        right: 10px;
    }
    
    #wacb-chat-window {
        bottom: 140px;
        right: 10px;
    }
    
    .wacb-message p {
        font-size: 16px;
    }
    
    #wacb-send-btn {
        font-size: 16px;
    }
}