/* ========================================
   AI智能客服 - 聊天浮窗样式
   主色调：#165DFF（品牌蓝）
   ======================================== */

/* 聊天按钮 */
.ss-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #165DFF 0%, #0E42D2 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(22, 93, 255, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ss-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(22, 93, 255, 0.5);
}

.ss-chat-btn:active {
    transform: scale(0.95);
}

/* 聊天窗口 */
.ss-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 560px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.ss-chat-window.ss-active {
    display: flex;
    animation: ssSlideIn 0.3s ease;
}

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

/* 窗口头部 */
.ss-chat-header {
    background: linear-gradient(135deg, #165DFF 0%, #0E42D2 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

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

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

.ss-chat-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin: 2px 0 0 0;
}

.ss-chat-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ss-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 消息区域 */
.ss-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F7F8FA;
    scroll-behavior: smooth;
}

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

.ss-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ss-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ss-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 消息气泡 */
.ss-message {
    display: flex;
    margin-bottom: 16px;
    animation: ssFadeIn 0.3s ease;
}

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

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

.ss-message.ss-bot {
    justify-content: flex-start;
}

.ss-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.ss-user .ss-message-avatar {
    order: 2;
    margin-left: 8px;
    background: #165DFF;
    color: #fff;
}

.ss-bot .ss-message-avatar {
    order: 1;
    margin-right: 8px;
    background: #fff;
    color: #165DFF;
    border: 1px solid #E5E6EB;
}

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

.ss-user .ss-message-content {
    background: #165DFF;
    color: #fff;
    border-top-right-radius: 4px;
}

.ss-bot .ss-message-content {
    background: #fff;
    color: #1D2129;
    border: 1px solid #E5E6EB;
    border-top-left-radius: 4px;
}

/* 打字动画 */
.ss-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}

.ss-typing span {
    width: 6px;
    height: 6px;
    background: #86909C;
    border-radius: 50%;
    animation: ssTyping 1.4s infinite;
}

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

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

@keyframes ssTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* 快捷问题 */
.ss-quick-questions {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #F2F3F5;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.ss-quick-btn {
    padding: 6px 12px;
    background: #E8F3FF;
    color: #165DFF;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ss-quick-btn:hover {
    background: #B9D8FF;
}

/* 输入区域 */
.ss-chat-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #F2F3F5;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.ss-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid #E5E6EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.ss-chat-input:focus {
    border-color: #165DFF;
}

.ss-chat-input::placeholder {
    color: #C9CDD4;
}

.ss-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #165DFF;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ss-send-btn:hover {
    background: #0E42D2;
}

.ss-send-btn:disabled {
    background: #C9CDD4;
    cursor: not-allowed;
}

/* 欢迎消息 */
.ss-welcome {
    text-align: center;
    padding: 20px 10px;
}

.ss-welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.ss-welcome h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #1D2129;
}

.ss-welcome p {
    margin: 0;
    font-size: 13px;
    color: #86909C;
    line-height: 1.6;
}

/* 响应式 - 移动端 */
@media (max-width: 480px) {
    .ss-chat-window {
        width: calc(100vw - 30px);
        height: 70vh;
        right: 15px;
        bottom: 80px;
    }
    
    .ss-chat-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
}

/* ========================================
   名片组件样式
   ======================================== */

.ss-card-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ss-card-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

/* 销售名片 */
.ss-sales-card {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
    border: 1px solid #b8d4ff;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.ss-sales-card:hover {
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.15);
    transform: translateY(-2px);
}

.ss-sales-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #165DFF 0%, #0E42D2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.ss-sales-info {
    flex: 1;
    min-width: 0;
}

.ss-sales-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.ss-sales-position {
    font-size: 12px;
    color: #165DFF;
    background: rgba(22, 93, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

.ss-sales-contact {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.ss-sales-contact-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-sales-contact-item i {
    color: #165DFF;
    width: 14px;
    font-size: 12px;
}

.ss-sales-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ss-card-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-align: center;
}

.ss-card-btn-primary {
    background: linear-gradient(135deg, #165DFF 0%, #0E42D2 100%);
    color: #fff;
}

.ss-card-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ss-card-btn-outline {
    background: #fff;
    color: #165DFF;
    border: 1px solid #165DFF;
}

.ss-card-btn-outline:hover {
    background: rgba(22, 93, 255, 0.05);
}

/* 经销商名片 */
.ss-distributor-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #165DFF;
    border-radius: 8px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.ss-distributor-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ss-distributor-company {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.ss-distributor-brands {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ss-distributor-brand-tag {
    font-size: 11px;
    color: #0E8A3E;
    background: rgba(14, 138, 62, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.ss-distributor-info {
    font-size: 12px;
    color: #666;
    line-height: 1.8;
}

.ss-distributor-info-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.ss-distributor-info-row i {
    color: #999;
    width: 14px;
    margin-top: 2px;
    font-size: 11px;
}

/* 复制成功提示 */
.ss-copy-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    animation: ssFadeInOut 2s ease forwards;
    pointer-events: none;
}

@keyframes ssFadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .ss-chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        right: 20px;
        bottom: 80px;
    }
    
    .ss-sales-card {
        padding: 12px;
    }
    
    .ss-sales-avatar {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* 微信二维码样式 */
.ss-wechat-qr-wrap {
    text-align: center;
    padding: 10px 0;
}
.ss-wechat-qr {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    border: 2px solid #f0f0f0;
}
.ss-qr-tip {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    margin-bottom: 0;
}

/* 媒体消息样式 */
.ss-media-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.ss-media-image-item {
    position: relative;
    width: calc(50% - 4px);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
}
.ss-media-image-item img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.3s;
}
.ss-media-image-item img.loaded {
    opacity: 1;
}
.ss-media-image-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    text-align: center;
}

.ss-media-videos-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.ss-media-video-item {
    width: 100%;
    cursor: pointer;
}
.ss-media-video-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}
.ss-media-video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.3s;
}
.ss-media-video-thumbnail img.loaded {
    opacity: 1;
}
.ss-media-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}
.ss-media-video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}
.ss-media-video-title {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
    text-align: center;
}
