/* AI Home Vision チャットウィジェット (グラスモーフィズムデザイン) */

/* チャットウィジェット全体のコンテナ */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* チャットトグルボタン */
.ai-chat-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.8), rgba(74, 0, 224, 0.9));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(138, 43, 226, 0.4);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(138, 43, 226, 0.6);
}

.ai-chat-toggle:active {
    transform: scale(0.95);
}

/* バッジ (未読メッセージ数表示) */
.ai-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b30;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
}

/* チャットウィンドウ */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* チャットヘッダー */
.ai-chat-header {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.6), rgba(74, 0, 224, 0.7));
    backdrop-filter: blur(10px);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.ai-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* メッセージコンテナ */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
}

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

.ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(138, 43, 226, 0.5);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 43, 226, 0.7);
}

/* メッセージ */
.ai-chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

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

/* ユーザーメッセージ */
.ai-chat-user {
    flex-direction: row-reverse;
}

/* AIアバター */
.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.8), rgba(74, 0, 224, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

/* メッセージバブル */
.ai-chat-bubble {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    color: white;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-chat-bot .ai-chat-bubble {
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 16px 16px 16px 4px;
}

.ai-chat-user .ai-chat-bubble {
    background: rgba(74, 0, 224, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px 16px 4px 16px;
}

/* ローディングアニメーション */
.ai-chat-loading {
    display: flex;
    gap: 6px;
    padding: 12px 20px;
}

.ai-chat-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: bounce 1.4s infinite ease-in-out both;
}

.ai-chat-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chat-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 入力エリア */
.ai-chat-input-container {
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 10px 14px;
    color: white;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    outline: none;
    transition: all 0.2s ease;
}

.ai-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.ai-chat-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(138, 43, 226, 0.5);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1);
}

/* 送信ボタン */
.ai-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.8), rgba(74, 0, 224, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

.ai-chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(138, 43, 226, 0.5);
}

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

/* レスポンシブデザイン */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .ai-chat-window {
        width: 100%;
        max-width: 100%;
        bottom: 70px;
        right: 0;
        left: 0;
    }

    .ai-chat-toggle {
        margin-left: auto;
    }

    .ai-chat-bubble {
        max-width: 85%;
    }
}
