/**
 * Eastern Global Chatbot Styles
 * 對話機器人樣式
 *
 * @version 1.0
 * @author Eastern Global
 */

/* ===== 主容器 ===== */
.eastern-chatbot {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== 對話視窗 ===== */
.chatbot-window {
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    position: fixed;
    bottom: 0;
    right: 24px;
}

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

/* ===== 標題列 ===== */
.chatbot-header {
    background: linear-gradient(135deg, #6dba28 0%, #5a9920 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chatbot-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* ===== 訊息區域 ===== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f7;
    scroll-behavior: smooth;
}

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

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

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

/* ===== 訊息氣泡 ===== */
.chatbot-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);
    }
}

.chatbot-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

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

.chatbot-message-user .chatbot-message-content {
    background: linear-gradient(135deg, #6dba28 0%, #5a9920 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-bot .chatbot-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chatbot-message-bot .chatbot-message-content a {
    color: #6dba28;
    text-decoration: underline;
}

.chatbot-message-bot .chatbot-message-content a:hover {
    color: #5a9920;
}

/* ===== 正在輸入指示器 ===== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

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

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

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

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

/* ===== 產品卡片 ===== */
.chatbot-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
}

.chatbot-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.chatbot-product-card .product-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f5f5f5;
}

.chatbot-product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-product-card .product-info {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 96px;
}

.chatbot-product-card .product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.chatbot-product-card .product-serial {
    font-size: 12px;
    color: #666;
    margin: 0 0 6px 0;
}

.chatbot-product-card .product-brief {
    font-size: 12px;
    color: #888;
    margin: 0 0 8px 0;
    line-height: 1.4;
    flex: 1;
}

.chatbot-product-card .product-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.chatbot-product-card .btn-view-detail,
.chatbot-product-card .btn-add-inquiry {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.chatbot-product-card .btn-view-detail {
    background: #6dba28;
    color: white;
}

.chatbot-product-card .btn-view-detail:hover {
    background: #5a9920;
}

.chatbot-product-card .btn-add-inquiry {
    background: white;
    color: #6dba28;
    border: 1px solid #6dba28;
}

.chatbot-product-card .btn-add-inquiry:hover {
    background: #f0f8e8;
}

/* ===== 快速回覆 ===== */
.chatbot-quick-replies {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-reply-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #6dba28;
    color: #6dba28;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: #6dba28;
    color: white;
}

/* ===== 輸入區域 ===== */
.chatbot-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #6dba28;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6dba28 0%, #5a9920 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

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

/* ===== 詢價流程樣式 ===== */
.chatbot-inquiry-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.inquiry-option-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid #6dba28;
    color: #6dba28;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.inquiry-option-btn:hover {
    background: #6dba28;
    color: white;
    transform: translateX(4px);
}

.chatbot-inquiry-actions {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.inquiry-confirm-btn,
.inquiry-cancel-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.inquiry-confirm-btn {
    background: #6dba28;
    color: white;
}

.inquiry-confirm-btn:hover {
    background: #5a9920;
    transform: scale(1.02);
}

.inquiry-cancel-btn {
    background: #f5f5f5;
    color: #666;
}

.inquiry-cancel-btn:hover {
    background: #e0e0e0;
}

/* ===== 響應式設計 ===== */
@media (max-width: 480px) {
    .eastern-chatbot {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .chatbot-inquiry-actions {
        flex-direction: column;
    }
}
