/* ベースラッパー */
#wpcb-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

/* 開閉ボタン */
#wpcb-toggle-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f72e3, #004494);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#wpcb-toggle-btn:hover {
    transform: scale(1.08);
}

/* チャットウィンドウ本体 */
#wpcb-window {
    width: 360px;
    height: 540px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 85px;
    right: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
    border: 1px solid #f0f0f0;
}
#wpcb-window.wpcb-hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

/* ヘッダー */
.wpcb-header {
    background: linear-gradient(135deg, #0f72e3, #004494);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}
.wpcb-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
#wpcb-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#wpcb-close-btn:hover { opacity: 1; }

/* メッセージエリア */
#wpcb-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc; /* ごく薄いブルーグレー（清潔感） */
    display: flex;
    flex-direction: column;
    gap: 16px;
}
/* スクロールバー装飾 */
#wpcb-messages::-webkit-scrollbar { width: 6px; }
#wpcb-messages::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }

/* 吹き出し共通 */
.wpcb-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: wpcb-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
}

/* ボットの吹き出し */
.wpcb-msg-bot {
    background: #ffffff;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}
.wpcb-msg-bot a { color: #0f72e3; font-weight: bold; text-decoration: none;}
.wpcb-msg-bot a:hover { text-decoration: underline; }

/* ユーザーの吹き出し */
.wpcb-msg-user {
    background: #0f72e3;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* クイックリプライボタン */
#wpcb-quick-replies {
    padding: 0 16px 12px;
    background: #f8fafc;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wpcb-quick-btn {
    background: #ffffff;
    color: #0f72e3;
    border: 1px solid #0f72e3;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.wpcb-quick-btn:hover {
    background: #0f72e3;
    color: #ffffff;
}

/* メッセージ内の回答リンクボタン */
.wpcb-link-btn {
    display: inline-block;
    margin-top: 8px;
    margin-right: 8px;
    padding: 8px 16px;
    background-color: #f8fafc;
    color: #0f72e3;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    transition: all 0.2s;
}
.wpcb-link-btn:hover {
    background-color: #0f72e3;
    color: #fff !important;
    text-decoration: none;
}

/* 入力エリア */
.wpcb-input-container {
    display: flex;
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}
#wpcb-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 10px 16px;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}
#wpcb-input:focus { border-color: #0f72e3; background: #fff;}
#wpcb-send-btn {
    background: none;
    border: none;
    color: #0f72e3;
    font-weight: bold;
    font-size: 14px;
    padding: 0 12px;
    cursor: pointer;
}

@keyframes wpcb-pop-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* スマホ対応（レスポンシブ） */
@media (max-width: 480px) {
    /* ラッパーの余白を少し詰める */
    #wpcb-wrapper {
        bottom: 16px;
        right: 16px;
    }
    
    /* アイコンを少し小さく */
    #wpcb-toggle-btn {
        width: 52px;
        height: 52px;
    }
    #wpcb-toggle-btn svg {
        width: 24px;
        height: 24px;
    }

    /* チャット画面を少し小さく */
    #wpcb-window {
        width: calc(100vw - 32px);
        height: 480px; /* フル画面ではなく少し小さめの固定高さ */
        max-height: calc(100vh - 100px);
        right: 0;
        bottom: 65px;
    }
    
    /* 吹き出しの文字サイズなども微調整 */
    .wpcb-header {
        padding: 12px 16px;
        font-size: 14px;
    }
    .wpcb-msg {
        font-size: 13px;
        padding: 10px 14px;
    }
}
