/* チャットボットウィジェット - コーポレートサイト版 (v4) */
#corp-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* トグルボタン */
#corp-chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--corp-theme-color, #2563EB);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
}

#corp-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#corp-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* チャットウィンドウ */
#corp-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: corpSlideUp 0.3s ease;
}

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

/* ヘッダー */
#corp-chatbot-header {
    background: var(--corp-theme-color, #2563EB);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

#corp-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#corp-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

#corp-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#corp-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#corp-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#corp-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* メッセージ */
.corp-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: corpFadeIn 0.3s ease;
}

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

.corp-message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
}

.corp-bot-message .corp-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 12px 12px 12px 2px;
}

.corp-user-message {
    align-items: flex-end;
}

.corp-user-message .corp-message-content {
    background: var(--corp-theme-color, #2563EB);
    color: white;
    border-radius: 12px 12px 2px 12px;
}

/* 参考記事リンク */
.corp-message-references {
    margin-top: 12px;
    padding: 12px;
    background: #f0f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    max-width: 85%;
}

.corp-message-references-title {
    font-size: 12px;
    font-weight: 600;
    color: #0066cc;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.corp-message-references-title svg {
    width: 14px;
    height: 14px;
}

.corp-reference-link {
    display: block;
    padding: 8px 10px;
    margin: 6px 0;
    background: white;
    border: 1px solid #d0e3ff;
    border-radius: 6px;
    text-decoration: none;
    color: #0066cc;
    font-size: 13px;
    transition: all 0.2s;
}

.corp-reference-link:hover {
    background: #e6f2ff;
    border-color: #0066cc;
    transform: translateX(4px);
}

.corp-reference-link-title {
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.corp-reference-link-excerpt {
    font-size: 11px;
    color: #666;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ローディング */
.corp-loading-message .corp-message-content {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 12px 20px;
}

.corp-typing-indicator {
    display: flex;
    gap: 4px;
}

.corp-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: corpTyping 1.4s infinite;
}

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

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

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

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

#corp-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#corp-chatbot-input:focus {
    border-color: var(--corp-theme-color, #2563EB);
}

#corp-chatbot-send {
    width: 44px;
    height: 44px;
    background: var(--corp-theme-color, #2563EB);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

#corp-chatbot-send:hover {
    background: color-mix(in srgb, var(--corp-theme-color, #2563EB) 85%, black);
    transform: scale(1.05);
}

#corp-chatbot-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    #corp-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: 600px;
    }

    #corp-chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .corp-message-content,
    .corp-message-references {
        max-width: 95%;
    }
}

/* エラーメッセージ */
.corp-error-message .corp-message-content {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}
