/* ===================================
   七月科技 - 在线客服组件样式
   Chat Widget Styles
   =================================== */

.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

/* 聊天按钮 */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #0080ff 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.6);
}

.chat-icon {
    width: 28px;
    height: 28px;
    color: #050811;
}

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

.chat-notification {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ff3366;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: notificationPulse 2s ease-in-out infinite;
}

@keyframes notificationPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 聊天容器 */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 500px;
    background: rgba(10, 18, 32, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

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

/* 聊天头部 */
.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.1);
    border: 2px solid rgba(0, 212, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
}

.chat-info {
    flex: 1;
}

.chat-info h4 {
    font-family: var(--font-display);
    font-size: 16px;
    margin-bottom: 4px;
    color: #e8f4f8;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #7a8b9a;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

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

.chat-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8b9a;
    transition: all 0.2s ease;
    padding: 0;
}

.chat-close:hover {
    background: rgba(255, 51, 102, 0.1);
    border-color: rgba(255, 51, 102, 0.3);
    color: #ff3366;
}

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

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.4);
}

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.message-content {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    max-width: calc(100% - 50px);
}

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

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

/* 用户消息 */
.message-user {
    flex-direction: row-reverse;
}

.message-user .message-content {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(0, 128, 255, 0.1) 100%);
    border-color: rgba(0, 212, 255, 0.3);
}

/* 快捷回复 */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply {
    padding: 8px 14px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    color: #00d4ff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.quick-reply:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

/* 输入区域 */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    background: rgba(5, 8, 17, 0.5);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 24px;
    font-size: 14px;
    color: #e8f4f8;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.chat-input::placeholder {
    color: #4a5568;
}

.chat-input:focus {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #0080ff 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #050811;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.chat-send svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* 时间戳 */
.message-time {
    font-size: 11px;
    color: #4a5568;
    margin-top: 6px;
    text-align: right;
}

/* 响应式 */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-container {
        position: fixed;
        bottom: 90px;
        right: 20px;
        left: 20px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: 500px;
    }
    
    .chat-toggle {
        width: 54px;
        height: 54px;
    }
    
    .chat-icon {
        width: 24px;
        height: 24px;
    }
}

/* 动画 - 气泡弹出 */
.chat-container.opening {
    animation: chatPopup 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chatPopup {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 消息进入动画 */
.message-enter {
    animation: messageEnter 0.3s ease forwards;
}

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

/* 禁用状态 */
.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 最小化状态 */
.chat-container.minimized {
    height: 60px;
    overflow: hidden;
}

.chat-container.minimized .chat-messages,
.chat-container.minimized .chat-input-area {
    display: none;
}

/* 最大化状态（桌面端） */
@media (min-width: 1024px) {
    .chat-container.maximized {
        width: 500px;
        height: 600px;
    }
}

/* 浮动标签 */
.chat-label {
    position: absolute;
    right: 70px;
    bottom: 18px;
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    font-size: 13px;
    color: #00d4ff;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.chat-widget:hover .chat-label {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* 提示动画 */
.chat-hint {
    position: absolute;
    bottom: 80px;
    right: 0;
    padding: 12px 16px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 12px;
    font-size: 13px;
    color: #00ff88;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.chat-hint.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-hint::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(0, 255, 136, 0.2);
}
