/* /static/css/support-chat.css */
/* 客服聊天组件样式 */

/* 浮动客服按钮 */
.support-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 900;
    transition: all 0.3s ease;
    border: none;
    font-size: 14px;
    font-weight: 600;
}

.support-float-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.support-float-btn i {
    font-size: 18px;
    margin-right: 4px;
}

.support-float-btn .chat-text {
    display: none;
}

@media (min-width: 768px) {
    .support-float-btn {
        width: auto;
        padding: 12px 20px;
        border-radius: 28px;
    }
    .support-float-btn .chat-text {
        display: inline;
        margin-left: 4px;
    }
}

/* 聊天窗口 */
.support-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 720px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 899;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.support-chat-window.open {
    display: flex;
}

/* 三列布局主体 */
.support-chat-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.support-chat-messages {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 右侧面板 */
.support-side-panel {
    width: 260px;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.support-panel-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.support-panel-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.support-panel-tab:hover {
    color: #667eea;
    background: #f0f0ff;
}

.support-panel-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
    background: #fff;
}

.support-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.support-panel-loading,
.support-panel-empty {
    text-align: center;
    padding: 24px 12px;
    color: #999;
    font-size: 13px;
}

/* 面板商品项 */
.support-panel-search {
    padding: 8px 8px 4px;
    border-bottom: 1px solid #f0f0f0;
}
.support-panel-search-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    background: #fafafa;
}
.support-panel-search-input:focus {
    border-color: #5b5fc7;
    background: #fff;
}
.support-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 4px 8px;
}
.support-panel-product {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.support-panel-product:hover {
    background: #f5f5ff;
}
.support-p-main {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
.support-panel-product img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.support-p-noimg {
    width: 44px;
    height: 44px;
    background: #f0f0f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    flex-shrink: 0;
    font-size: 16px;
}
.support-p-info {
    flex: 1;
    min-width: 0;
}
.support-p-name {
    font-size: 12px;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 2px;
}
.support-p-sku {
    font-size: 10px;
    color: #999;
    margin-bottom: 2px;
}
.support-p-price {
    font-size: 13px;
    color: #e53935;
    font-weight: 600;
}
.support-p-send-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #5b5fc7, #7b68ee);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.support-p-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(91,95,199,0.4);
}
.support-p-send-btn:active {
    transform: scale(0.95);
}

/* 面板订单项 */
.support-panel-order {
    padding: 10px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.support-panel-order:hover {
    background: #f0f0ff;
}

.support-o-num {
    font-size: 12px;
    color: #333;
    font-weight: 500;
    margin-bottom: 4px;
}

.support-o-status {
    font-size: 11px;
    color: #667eea;
    display: inline-block;
    background: #f0f0ff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
}

.support-o-total {
    font-size: 13px;
    color: #e53935;
    font-weight: 600;
}

/* 消息卡片样式 */
.support-msg-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s;
    width: 220px;
}

.support-msg-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.support-msg-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.support-card-noimg {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 32px;
}

.support-card-body {
    padding: 10px 12px;
}

.support-card-title {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.support-card-price {
    font-size: 15px;
    color: #e53935;
    font-weight: 700;
}

.support-card-meta {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* 状态点 */
.support-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
}

.support-status-dot.online {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.support-status-dot.offline {
    background: #999;
}

/* 聊天窗口头部 */
.support-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.support-chat-header-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-chat-header-title i {
    font-size: 20px;
}

.support-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* 排队状态 */
.support-queue-status {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.support-queue-status.connected {
    background: #d4edda;
    color: #155724;
}

.support-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.support-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
}

.support-message.agent {
    background: #fff;
    color: #333;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.support-message.system {
    background: transparent;
    color: #888;
    font-size: 12px;
    text-align: center;
    align-self: center;
}

.support-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    text-align: right;
}

.support-message.agent .support-message-time {
    color: #999;
}

/* 图片消息 */
.support-message-image {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.support-message-image:hover {
    transform: scale(1.02);
}

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

.support-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 100px;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.support-chat-input:focus {
    border-color: #667eea;
}

.support-chat-upload {
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.support-chat-upload:hover {
    background: #667eea;
    color: #fff;
}

.support-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s;
}

.support-chat-send:hover {
    transform: scale(1.1);
}

.support-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.support-chat-typing {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 12px;
    align-self: flex-start;
}

.support-chat-typing span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* 未读消息指示器 */
.support-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #e53935;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.support-unread-badge.show {
    display: flex;
}

/* 响应式调整 */
@media (max-width: 767px) {
    .support-chat-window {
        width: calc(100vw - 20px);
        height: 500px;
    }

    .support-side-panel {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .support-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .support-float-btn {
        bottom: 16px;
        right: 16px;
    }

    .support-side-panel {
        display: none !important;
    }

    .support-msg-card {
        width: 180px;
    }

    .support-msg-card img,
    .support-card-noimg {
        height: 110px;
    }
}

/* 图片预览模态框 */
.support-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.support-image-modal.open {
    display: flex;
}

.support-image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.support-image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
}