/* chat-sdk.css - 样式文件 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-sdk-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.chat-sdk-container a {
    color: inherit;
    text-decoration: none;
}

.chat-sdk-container button {
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.chat-widget {
    animation: slideIn 0.3s ease-out;
}

.chat-toggle-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.chat-toggle-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
}

.chat-toggle-btn:active {
    transform: scale(0.95) !important;
}

.notification-badge {
    animation: pulse 2s infinite;
}

.chat-header:hover {
    background: linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05));
}

.chat-send-btn:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-input:focus {
    border-color: #489775 !important;
    box-shadow: 0 0 0 2px rgba(24, 244, 25, 0.2);
}

.chat-body {
    scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    animation: fadeIn 0.3s ease;
}

.message.user .message-content {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    color: #1f2937;
    position: relative;
}

.message.user .message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid #489775;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message.agent .message-content {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    color: #1f2937;
    position: relative;
}

.message.agent .message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message.system .message-content {
    position: absolute;
    background: #f6ffed ;
    border: 1px solid #b7eb8f ;
    color: #135200 ;
    align-self: flex-start ;
    max-width: 95% ;
    text-align: center;
}

.message-content a {
    word-break: break-all;
}

.message-content a:hover {
    text-decoration: underline;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 18px;
    align-self: flex-start;
    margin-bottom: 8px;
    max-width: 85%;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-widget {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    .chat-body {
        height: calc(100vh - 140px) !important;
    }

    .chat-toggle-btn {
        width: 50px !important;
        height: 50px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .chat-widget {
        background: #1f1f1f !important;
        color: #e0e0e0 !important;
    }

    .chat-header {
        background: #262626 !important;
    }

    .chat-body {
        background: #141414 !important;
    }

    .chat-footer {
        background: #1f1f1f !important;
        border-top-color: #333 !important;
    }

    .chat-input {
        background: #262626 !important;
        border-color: #434343 !important;
        color: #e0e0e0 !important;
    }

    .message.agent .message-content {
        background: #262626 !important;
        border-color: #434343 !important;
        color: #e0e0e0 !important;
    }

    .message.agent .message-content::before {
        border-right-color: #262626 !important;
    }

    .message-meta {
        color: #8c8c8c !important;
    }

    .chat-body::-webkit-scrollbar-track {
        background: #262626;
    }

    .chat-body::-webkit-scrollbar-thumb {
        background: #434343;
    }

    .chat-body::-webkit-scrollbar-thumb:hover {
        background: #595959;
    }
}