/* チャットウィジェットのスタイル */
#aiChatWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

.ai-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.ai-chat-icon,
.ai-chat-close {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.ai-chat-close {
    display: none;
    position: absolute;
}

.ai-chat-button.active .ai-chat-icon {
    display: none;
}

.ai-chat-button.active .ai-chat-close {
    display: block;
}

.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    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, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-avatar svg {
    width: 24px;
    height: 24px;
}

.ai-chat-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-subtitle {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-close-btn svg {
    width: 24px;
    height: 24px;
}

/* ゲストフォーム */
.ai-chat-guest-form {
    padding: 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.ai-chat-form-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #374151;
}

.ai-chat-form-content p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-or {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin: 12px 0;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-submit,
.btn-skip {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-skip {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-skip:hover {
    background: #f9fafb;
}

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

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

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

.ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-message .ai-chat-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-message .ai-chat-message-avatar {
    background: #e5e7eb;
    color: #374151;
}

.system-message .ai-chat-message-avatar {
    background: #f59e0b;
    color: white;
}

.ai-chat-message-content {
    flex: 1;
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .ai-chat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.system-message .ai-chat-message-content {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #78350f;
}

.ai-chat-message-content p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.ai-chat-message-content p:last-child {
    margin-bottom: 0;
}

.ai-chat-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.ai-chat-quick-replies button {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.ai-chat-quick-replies button:hover {
    background: #f9fafb;
    border-color: #667eea;
}

.ai-chat-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-chat-typing span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.ai-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.ai-chat-input-container {
    border-top: 1px solid #e5e7eb;
    background: white;
    padding: 12px;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
}

.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.ai-chat-disclaimer {
    margin: 8px 0 0 0;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 90px;
    }
    
    #aiChatWidget {
        right: 10px;
        bottom: 10px;
    }
}
