/* ============================================================
   ヒーローズ・サポート AIチャットボット スタイルシート
   ============================================================ */

:root {
    --chat-primary: #16325c;
    --chat-accent: #f59e0b;
    --chat-bg-glass: rgba(255, 255, 255, 0.95);
    --chat-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* 1. チャットバブル（ボタン） */
#chatbot-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 25px rgba(22, 50, 92, 0.4);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
}

#chatbot-launcher:hover {
    transform: scale(1.1) rotate(5deg);
}

#chatbot-launcher i {
    color: white;
    font-size: 30px;
}

/* 2. チャットウィンドウ */
#chatbot-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: var(--chat-bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255,255,255,0.3);
}

#chatbot-window.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* 3. ヘッダー */
#chatbot-header {
    background: var(--chat-primary);
    padding: 20px 25px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    padding: 2px;
    object-fit: cover;
}

.chatbot-header-info h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 700;
}

.chatbot-header-info span {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* 4. メッセージ履歴エリア */
#cb-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: block; /* Flexから通常のブロックへ変更 */
    background: #ffffff;
}

.cb-msg-container {
    margin-bottom: 20px;
    clear: both;
    overflow: hidden;
}

.cb-msg-bubble {
    display: inline-block;
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-all;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cb-msg-bot {
    float: left;
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 2px;
}

.cb-msg-user {
    float: right;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

/* 予約フロー専用スタイル */
.cb-booking-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    padding: 15px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.cb-date-row {
    margin-bottom: 15px;
}

.cb-date-label {
    font-weight: 700;
    color: var(--chat-primary);
    margin-bottom: 8px;
    display: block;
    font-size: 0.85rem;
}

.cb-time-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.cb-slot {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.cb-slot:hover {
    border-color: var(--chat-primary);
    background: #f1f5f9;
}

.cb-slot.selected {
    background: var(--chat-primary);
    color: white;
    border-color: var(--chat-primary);
    box-shadow: 0 2px 8px rgba(22, 50, 92, 0.3);
}

.cb-slot.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #f1f5f9;
}

.cb-booking-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
    text-align: center;
}

.cb-confirm-btn {
    background: var(--chat-accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.cb-confirm-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* クイックリプライのスタイルの微調整 */
.cb-quick-replies {
    clear: both;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: var(--chat-primary);
    color: white;
}

.quick-reply-btn {
    background: white;
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: var(--chat-primary);
    color: white;
}

/* 5. 入力エリア */
#chatbot-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

#chatbot-input {
    flex: 1;
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    outline: none;
    background: #f8fafc;
    border-radius: 25px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

#chatbot-input:focus {
    border-color: var(--chat-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 50, 92, 0.1);
}

#chatbot-send {
    background: var(--chat-primary);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

#chatbot-send:hover {
    filter: brightness(1.2);
}

/* レスポンシブ */
@media (max-width: 480px) {
    #chatbot-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    #chatbot-launcher {
        bottom: 20px;
        right: 20px;
    }
}
/* 6. お誘い吹き出し（CTAラベル） */
.chatbot-cta {
    position: absolute;
    right: 85px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: var(--chat-primary);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: 2px solid var(--chat-primary);
    pointer-events: none;
    animation: cb-float 3s ease-in-out infinite;
    opacity: 1;
    transition: opacity 0.3s;
}

/* 吹き出しの三角部分 */
.chatbot-cta::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 10px solid var(--chat-primary);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

@keyframes cb-float {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-8px); }
}

/* ウィンドウが開いている時は吹き出しを隠す */
#chatbot-launcher.active .chatbot-cta {
    opacity: 0;
}

/* モバイル対応：吹き出しを少し小さく、または非表示の検討 */
@media (max-width: 480px) {
    .chatbot-cta {
        right: 80px;
        padding: 8px 14px;
        font-size: 0.75rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
}
