/* ========================================
   智能客服侧边栏 - 药智云设计系统 v2.0
   配色: 专业蓝色系 (#2C5F8D)
======================================== */

/* 侧边栏容器 */
.smart-customer-service {
    position: fixed;
    right: 24px;
    bottom: 100px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* 客服按钮组 */
.scs-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scs-btn {
    width: 52px;
    height: 52px;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2C5F8D;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.scs-btn:hover {
    background: #2C5F8D;
    color: #ffffff;
    border-color: #2C5F8D;
    transform: translateX(-4px);
}

.scs-btn i {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.scs-btn:hover i {
    transform: scale(1.1);
}

/* 按钮标签提示 */
.scs-btn::before {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 12px);
    background: #2C5F8D;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.scs-btn::after {
    content: '';
    position: absolute;
    right: calc(100% + 4px);
    border: 6px solid transparent;
    border-left-color: #2C5F8D;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.scs-btn:hover::before,
.scs-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* 返回顶部按钮 - 特殊样式 */
.scs-btn.scs-top {
    display: none;
    background: linear-gradient(135deg, #2C5F8D 0%, #4A90C8 100%);
    color: #ffffff;
    border-color: transparent;
}

.scs-btn.scs-top:hover {
    transform: translateY(-4px);
}

/* 微信按钮特殊色 */
.scs-btn.scs-wechat:hover {
    background: #07C160;
    border-color: #07C160;
}

/* ========================================
   聊天窗口
======================================== */
.scs-chat-box {
    position: fixed;
    right: 24px;
    bottom: 180px;
    width: 380px;
    max-height: 560px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
}

.scs-chat-box.active {
    display: flex;
    animation: scsSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 聊天头部 */
.scs-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2C5F8D 0%, #4A90C8 100%);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scs-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scs-chat-header h4 i {
    font-size: 18px;
}

.scs-chat-header .scs-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.scs-chat-header .scs-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #48C9B0;
    border-radius: 50%;
    animation: scsPulse 2s infinite;
}

@keyframes scsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scs-chat-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.scs-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 聊天内容区 */
.scs-chat-body {
    flex: 1;
    background: #F8FAFC;
    overflow: hidden;
}

.scs-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 320px;
    overflow-y: auto;
    padding: 20px;
}

.scs-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.scs-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.scs-chat-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 2px;
}

/* 消息样式 */
.scs-message {
    display: flex;
    gap: 10px;
    animation: scsFadeIn 0.3s ease;
}

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

.scs-message.bot {
    align-items: flex-start;
}

.scs-message.user {
    flex-direction: row-reverse;
}

.scs-message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2C5F8D 0%, #4A90C8 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scs-message-avatar i {
    color: #ffffff;
    font-size: 16px;
}

.scs-message.user .scs-message-avatar {
    background: #5D6D7E;
}

.scs-message-content {
    max-width: 260px;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}

.scs-message.user .scs-message-content {
    background: #2C5F8D;
    color: #ffffff;
    border-color: #2C5F8D;
}

.scs-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #2C3E50;
}

.scs-message.user .scs-message-content p {
    color: #ffffff;
}

.scs-message-content p + p {
    margin-top: 8px;
}

/* 快捷问题按钮 */
.scs-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.scs-quick-btn {
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #4A90C8;
    color: #2C5F8D;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scs-quick-btn:hover {
    background: #2C5F8D;
    border-color: #2C5F8D;
    color: #ffffff;
}

/* 聊天底部输入区 */
.scs-chat-footer {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #E2E8F0;
}

.scs-input-form {
    display: flex;
    gap: 10px;
}

.scs-input-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E2E8F0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.scs-input-form input:focus {
    border-color: #4A90C8;
}

.scs-input-form input::placeholder {
    color: #95A5A6;
}

.scs-input-form button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2C5F8D 0%, #4A90C8 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.scs-input-form button:hover {
    transform: scale(1.05);
}

.scs-input-form button i {
    font-size: 16px;
}

/* 快速留言区 */
.scs-quick-contact {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #E2E8F0;
}

.scs-quick-contact p {
    font-size: 12px;
    color: #5D6D7E;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scs-quick-contact p i {
    color: #4A90C8;
}

.scs-contact-form {
    display: flex;
    gap: 8px;
}

.scs-contact-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

.scs-contact-form input:focus {
    border-color: #4A90C8;
}

.scs-contact-form button {
    padding: 10px 20px;
    background: #2C5F8D;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scs-contact-form button:hover {
    background: #4A90C8;
}

/* ========================================
   信息弹窗
======================================== */
.scs-popup {
    position: fixed;
    right: 90px;
    bottom: 200px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    padding: 24px;
    z-index: 10001;
    display: none;
    min-width: 200px;
}

.scs-popup.active {
    display: block;
    animation: scsFadeIn 0.3s ease;
}

.scs-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: #F1F5F9;
    color: #5D6D7E;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.scs-popup-close:hover {
    background: #E2E8F0;
    color: #2C3E50;
}

.scs-popup h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2C3E50;
}

.scs-popup h4 i {
    color: #2C5F8D;
    font-size: 18px;
}

.scs-popup h4 i.fa-weixin {
    color: #07C160;
}

/* 电话弹窗 */
.scs-phone-number {
    font-size: 24px;
    font-weight: 700;
    color: #2C5F8D;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.scs-phone-time {
    font-size: 13px;
    color: #5D6D7E;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scs-phone-time i {
    color: #4A90C8;
}

/* 微信二维码弹窗 */
.scs-wechat-qr {
    width: 160px;
    height: 160px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    margin-bottom: 12px;
}

.scs-popup .scs-qr-tip {
    font-size: 13px;
    color: #5D6D7E;
    text-align: center;
    margin: 0;
}

/* ========================================
   成功提示
======================================== */
.scs-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10002;
}

.scs-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.scs-toast i {
    color: #27AE60;
    font-size: 22px;
}

.scs-toast span {
    font-size: 15px;
    color: #2C3E50;
    font-weight: 500;
}

/* ========================================
   移动端响应式
======================================== */
@media (max-width: 768px) {
    .smart-customer-service {
        right: 16px;
        bottom: 80px;
    }

    .scs-btn {
        width: 48px;
        height: 48px;
    }

    .scs-btn::before,
    .scs-btn::after {
        display: none;
    }

    .scs-chat-box {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
        max-height: 70vh;
    }

    .scs-chat-messages {
        height: 280px;
    }

    .scs-popup {
        right: 16px;
        left: 16px;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
    }

    .scs-popup.active {
        animation: none;
    }
}

/* 小屏幕隐藏标签 */
@media (max-width: 480px) {
    .scs-buttons {
        gap: 10px;
    }

    .scs-btn {
        width: 44px;
        height: 44px;
    }

    .scs-btn i {
        font-size: 18px;
    }
}
