/* フローティングチャットウィジェット - モダンレッド&グレーテーマ */
#ai-chat-widget-container.ai-chat-floating {
    position: fixed;
    bottom: 20px;
    left: 20px;  /* right から left に変更 */
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* チャットバブル(常時表示) */
#ai-chat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #c51c2e 0%, #a01624 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(197, 28, 46, 0.35);
    transition: all 0.3s ease;
    color: white;
}

#ai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(197, 28, 46, 0.5);
    background: linear-gradient(135deg, #d62030 0%, #c51c2e 100%);
}

#ai-chat-bubble svg {
    width: 28px;
    height: 28px;
}

/* チャットウィンドウ */
#ai-chat-window {
    position: absolute;
    bottom: 80px;
    left: 0;  /* right から left に変更 */
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    border: 1px solid #e5e7eb;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ヘッダー */
#ai-chat-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    padding: 18px 20px;
    border-bottom: 2px solid #c51c2e;
}

.chat-header-content h3 {
    margin: 0 0 6px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
}

.chat-subtitle {
    margin: 0;
    font-size: 0.8em;
    opacity: 0.9;
    color: #d1d5db;
    line-height: 1.4;
}

.chat-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    gap: 10px;
}

#language-selector {
    display: flex;
    gap: 6px;
    flex: 1;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #c51c2e;
}

.lang-btn.active {
    background: #c51c2e;
    color: white;
    border-color: #c51c2e;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* メッセージエリア */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.system-message {
    justify-content: center;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 0.9em;
}

.user-message .message-content {
    background: linear-gradient(135deg, #c51c2e 0%, #a01624 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(197, 28, 46, 0.2);
}

.assistant-message .message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.system-message .message-content {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    text-align: center;
    font-size: 0.8em;
    max-width: 90%;
}

/* 入力エリア */
#ai-chat-input-area {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: #f9fafb;
}

#ai-chat-input:focus {
    border-color: #c51c2e;
    box-shadow: 0 0 0 3px rgba(197, 28, 46, 0.1);
    background: white;
}

#ai-chat-send {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, #c51c2e 0%, #a01624 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(197, 28, 46, 0.2);
}

#ai-chat-send:hover {
    background: linear-gradient(135deg, #d62030 0%, #c51c2e 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(197, 28, 46, 0.3);
}

#ai-chat-send:active {
    transform: scale(0.95);
}

#ai-chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#ai-chat-send svg {
    width: 18px;
    height: 18px;
}

/* フッター */
#ai-chat-footer {
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #6b7280;
    font-size: 11px;
}

/* スクロールバー */
#ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#ai-chat-messages::-webkit-scrollbar-track {
    background: #f3f4f6;
}

#ai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

#ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* モバイル対応 */
@media (max-width: 768px) {
    #ai-chat-widget-container.ai-chat-floating {
        bottom: 10px;
        left: 10px;  /* right から left に変更 */
    }
    
    #ai-chat-bubble {
        width: 56px;
        height: 56px;
    }
    
    #ai-chat-window {
        position: fixed;
        bottom: 0;
        left: 0;  /* right から left に変更 */
        right: 0;  /* これは残す（全幅） */
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        animation: slideUpMobile 0.3s ease;
        border: none;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .message-content {
        max-width: 85%;
    }
    
    #language-selector {
        flex-wrap: wrap;
    }
    
    .lang-btn {
        font-size: 0.7em;
        padding: 3px 8px;
    }
}

/* 埋め込み型モード(ショートコード用) */
#ai-chat-container {
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

#ai-chat-container #ai-chat-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    padding: 20px;
    border-bottom: 2px solid #c51c2e;
}

#ai-chat-container .chat-header-content h3 {
    margin: 0 0 12px 0;
    font-size: 1.3em;
    font-weight: 600;
}

#ai-chat-container #language-selector {
    display: flex;
    gap: 8px;
}

#ai-chat-container #ai-chat-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

#ai-chat-container #ai-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

#ai-chat-container #ai-chat-input-area {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 10px;
}

#ai-chat-container #ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    background: #f9fafb;
}

#ai-chat-container #ai-chat-input:focus {
    border-color: #c51c2e;
    background: white;
}

#ai-chat-container #ai-chat-send {
    padding: 12px 28px;
    background: linear-gradient(135deg, #c51c2e 0%, #a01624 100%);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    width: auto;
    height: auto;
    box-shadow: 0 2px 4px rgba(197, 28, 46, 0.2);
}

#ai-chat-container #ai-chat-send:hover {
    background: linear-gradient(135deg, #d62030 0%, #c51c2e 100%);
}

#ai-chat-container #ai-chat-footer {
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
}

@media (max-width: 768px) {
    #ai-chat-container {
        margin: 10px;
        border-radius: 8px;
    }
    
    #ai-chat-container #ai-chat-messages {
        height: 300px;
    }
}
