/* ==========================================
   客服浮动组件样式 — 亚全物流官网
   ========================================== */

/* ===== 浮动按钮 ===== */
.cs-float-btn {
    position: fixed;
    right: 28px;
    bottom: 100px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c, #ff6b4a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9997;
    box-shadow: 0 4px 20px rgba(231,76,60,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: cs-bounce 1.8s ease-in-out infinite, cs-glow 2s ease-in-out infinite;
}
.cs-float-btn:hover {
    transform: scale(1.18) rotate(-5deg);
    box-shadow: 0 8px 36px rgba(231,76,60,0.7);
    animation: none;
}

/* 上下弹跳动画 */
@keyframes cs-bounce {
    0%, 100% { transform: translateY(0); }
    30%      { transform: translateY(-8px); }
    50%      { transform: translateY(-2px); }
    70%      { transform: translateY(-5px); }
}

/* 光晕呼吸 */
@keyframes cs-glow {
    0%   { box-shadow: 0 4px 20px rgba(231,76,60,0.45), 0 0 0 0 rgba(231,76,60,0.45); }
    50%  { box-shadow: 0 4px 28px rgba(231,76,60,0.55), 0 0 0 16px rgba(231,76,60,0); }
    100% { box-shadow: 0 4px 20px rgba(231,76,60,0.45), 0 0 0 0 rgba(231,76,60,0); }
}

/* 未读消息红点 */
.cs-notify-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #ff0;
    border-radius: 50%;
    border: 2px solid #e74c3c;
    animation: cs-dot-blink 1.2s ease-in-out infinite;
}
@keyframes cs-dot-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}

/* ===== 面板容器 ===== */
.cs-panel {
    position: fixed;
    right: 28px;
    bottom: 175px;
    width: 370px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}
.cs-panel.cs-show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ===== 面板头部 ===== */
.cs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0a3d6b, #1a6fbf);
    color: #fff;
}
.cs-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.cs-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s;
    line-height: 1;
    padding: 0 2px;
}
.cs-close:hover { opacity: 1; }

/* ===== Tab 切换 ===== */
.cs-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}
.cs-tabs .cs-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    color: #888;
    transition: color 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
}
.cs-tabs .cs-tab.cs-active {
    color: #0a3d6b;
    border-bottom-color: #0a3d6b;
    font-weight: 600;
}

/* ===== 邮件表单 ===== */
.cs-email-form {
    padding: 16px 18px;
    overflow-y: auto;
}
.cs-form-group {
    margin-bottom: 10px;
}
.cs-form-group label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}
.cs-form-group input,
.cs-form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.cs-form-group input:focus,
.cs-form-group textarea:focus {
    border-color: #0a3d6b;
}
.cs-form-group textarea {
    min-height: 72px;
    resize: vertical;
    font-family: inherit;
}
.cs-send-btn {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #0a3d6b, #1a6fbf);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cs-send-btn:hover { opacity: 0.88; }
.cs-send-btn:disabled { opacity: 0.6; cursor: default; }
.cs-form-status {
    margin-top: 8px;
    font-size: 12px;
    display: none;
}
.cs-form-status.cs-success { color: #27ae60; display: block; }
.cs-form-status.cs-error   { color: #e74c3c; display: block; }

/* ===== 聊天区域 ===== */
.cs-chat-area {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.cs-chat-area.cs-active {
    display: flex;
}

.cs-chat-messages {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    background: #f7f8fa;
}

/* 单条消息 */
.cs-chat-msg {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}
.cs-chat-msg.cs-user {
    flex-direction: row;
}
.cs-chat-msg.cs-bot {
    flex-direction: row-reverse;
}
.cs-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.cs-chat-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.cs-chat-msg.cs-user .cs-chat-bubble {
    background: #fff;
    color: #333;
    border-top-left-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.cs-chat-msg.cs-bot .cs-chat-bubble {
    background: linear-gradient(135deg, #0a3d6b, #1a6fbf);
    color: #fff;
    border-top-right-radius: 2px;
}

/* 消息时间戳 */
.cs-msg-time {
    font-size: 10px;
    color: #bbb;
    text-align: right;
    margin-top: 4px;
    line-height: 1.2;
}
.cs-chat-msg.cs-bot .cs-msg-time {
    color: rgba(255,255,255,0.6);
}

/* 正在输入动画 */
.cs-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #bbb;
    border-radius: 50%;
    animation: cs-blink 1.2s infinite both;
}
.cs-typing span:nth-child(2) { animation-delay: 0.2s; }
.cs-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cs-blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* 聊天输入区 */
.cs-chat-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    gap: 8px;
}
.cs-chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.cs-chat-input-area input:focus { border-color: #0a3d6b; }
.cs-chat-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a3d6b, #1a6fbf);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.cs-chat-send:hover { opacity: 0.85; }

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .cs-panel {
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 70vh;
        bottom: 80px;
    }
    .cs-float-btn {
        right: 16px;
        bottom: 80px;
        width: 56px;
        height: 56px;
    }
}

/* ===== 自动弹出闪烁动画 ===== */
@keyframes cs-notify-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(231,76,60,0.7); }
    50%  { box-shadow: 0 0 0 12px rgba(231,76,60,0); }
    100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}
