/* ========================================
   在线服务组件 - 现代化设计样式
   ======================================== */

/* 主容器 */
.online-service-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* 触发按钮 */
.service-trigger {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.service-trigger.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 8px 24px rgba(245, 87, 108, 0.4);
}

.trigger-icon {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.service-trigger.active .trigger-icon {
    transform: rotate(180deg);
}

.trigger-icon svg {
    width: 100%;
    height: 100%;
}

/* 脉冲动画 */
.trigger-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: -1;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* 徽章 */
.trigger-badge {
    position: absolute;
    right: 70px;
    background: white;
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.service-trigger:hover .trigger-badge {
    opacity: 1;
    transform: translateX(0);
}

/* 服务面板 */
.service-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 360px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.service-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 面板头部 */
.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.header-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header-icon svg {
    width: 24px;
    height: 24px;
}

.header-content h3 {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.header-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
}

.panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.panel-close svg {
    width: 18px;
    height: 18px;
}

/* 服务列表 */
.service-list {
    padding: 16px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.service-item:last-child {
    margin-bottom: 0;
}

.service-item:hover {
    background: #f8f9fa;
    transform: translateX(4px);
}

.item-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.item-icon svg {
    width: 28px;
    height: 28px;
}

.chat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.wechat-icon {
    background: linear-gradient(135deg, #07C160 0%, #00a854 100%);
    color: white;
}

.phone-icon {
    background: linear-gradient(135deg, #FF6B6B 0%, #ee5a6f 100%);
    color: white;
}

.service-item:hover .item-icon {
    transform: scale(1.1);
}

.item-content {
    flex: 1;
}

.item-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}

.item-content p {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.item-arrow {
    width: 24px;
    height: 24px;
    color: #ccc;
    transition: all 0.3s ease;
}

.service-item:hover .item-arrow {
    color: #667eea;
    transform: translateX(4px);
}

/* 详情面板容器 */
.detail-container {
    position: relative;
    min-height: 400px;
}

.detail-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.back-btn {
    width: 36px;
    height: 36px;
    background: #f8f9fa;
    border: none;
    border-radius: 10px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #e9ecef;
    color: #333;
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.detail-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

/* 聊天面板 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100% - 77px);
}

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

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
}

.message-content {
    max-width: 70%;
}

.message-content p {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

.message.user .message-content p {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-input-box {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.chat-input-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input-box input:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.send-btn svg {
    width: 20px;
    height: 20px;
}

/* 微信面板 */
.wechat-content {
    padding: 40px 24px;
    text-align: center;
}

.qrcode-box {
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.qrcode-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qrcode-placeholder {
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
    border-radius: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.qrcode-placeholder svg {
    width: 80px;
    height: 80px;
    color: #ccc;
}

.qrcode-placeholder p {
    font-size: 14px;
    color: #999;
    margin: 0;
}

.wechat-tip {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.wechat-time {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* 电话面板 */
.phone-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.phone-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.phone-card:hover {
    background: #f0f0f0;
    transform: translateX(4px);
}

.phone-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF6B6B 0%, #ee5a6f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.phone-icon svg {
    width: 28px;
    height: 28px;
}

.phone-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.phone-number {
    display: inline-block;
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.phone-number:hover {
    color: #764ba2;
}

.phone-info p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .online-service-widget {
        bottom: 20px;
        right: 20px;
    }

    .service-trigger {
        width: 56px;
        height: 56px;
    }

    .service-panel {
        width: calc(100vw - 40px);
        max-width: 360px;
        right: -10px;
    }

    .trigger-badge {
        display: none;
    }
}
