/* 全局盒模型设置 */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ========== 基础样式（桌面端默认） ========== */

/* 客服系统基础样式 */
.online-customer-service {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

/* 悬浮菜单样式 */
.float-service-menu {
    position: relative;
}

.service-main-btn {
    background: linear-gradient(135deg, #ff6b95, #ff3d77);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 149, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10000;
}

.service-main-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 149, 0.4);
}

.service-main-btn i {
    font-size: 20px;
}

.service-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    margin-bottom: 15px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
}

.service-dropdown.show {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

.service-option {
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.service-option:last-child {
    border-bottom: none;
}

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

.service-option i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.tg-option i {
    color: #0088cc;
}

.qq-option i {
    color: #12b7f5;
}

.chat-option i {
    color: #ff6b95;
}

/* 聊天窗口样式（桌面端） */
.chat-window {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    margin-bottom: 15px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9997;
}

.chat-window.show {
    display: flex;
    animation: slideInUp 0.3s ease;
}

.chat-header {
    background: linear-gradient(135deg, #ff6b95, #ff3d77);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.chat-title i {
    font-size: 18px;
}

.chat-status {
    font-size: 12px;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.admin-message {
    flex-direction: row;
}

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

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar i {
    font-size: 20px;
    color: #6c757d;
}

.admin-message .avatar i {
    color: #10b981;
}

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

.message-text {
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
}

.admin-message .message-text {
    background: #10b981;
    color: white;
    border-top-left-radius: 5px;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 5px;
}

.user-message .message-text {
    background: #ff6b95;
    color: white;
    border-top-right-radius: 5px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

.admin-message .message-time {
    text-align: left;
}

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

.quick-reply {
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 15px;
    font-size: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quick-reply:hover {
    background: #ff6b95;
    color: white;
    border-color: #ff6b95;
}

/* 系统消息 */
.system-message {
    text-align: center;
    margin: 10px 0;
    padding: 5px 10px;
    flex-shrink: 0;
}

.system-message .message-text {
    background: #e9ecef;
    color: #6c757d;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    display: inline-block;
    max-width: 80%;
}

.system-message .message-time {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 2px;
}

/* 聊天输入区 */
.chat-footer {
    border-top: 1px solid #e9ecef;
    padding: 15px 0;
    background: white;
    flex-shrink: 0;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding: 0 15px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border 0.3s ease;
    box-sizing: border-box;
    min-width: 0;
}

.chat-input:focus {
    border-color: #ff6b95;
}

.chat-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff6b95, #ff3d77);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

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

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.chat-tips {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    padding: 0 15px;
    line-height: 1.4;
}

/* 未读消息标记 */
.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-weight: bold;
    z-index: 10001;
    animation: pulse 1.5s infinite;
}

/* QQ客服弹窗样式 */
#qqModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

#qqModal > div {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

#qqModal h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

#qqModal > div > p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.5;
}

#qqModal > div > div:has(span#qqNumber) {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #0088cc;
}

#qqModal > div > div:last-child {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#qqModal button,
#qqModal a {
    padding: 10px 20px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
    min-width: 120px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#qqModal button:first-child {
    background: #0088cc;
}

#qqModal a {
    background: #12b7f5;
}

#qqModal button:last-child {
    background: #6c757d;
}

/* ========== 移动端样式 ========== */

/* 移动端 - 覆盖桌面端样式 */
.online-customer-service.mobile-view {
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 9999;
}

/* 移动端聊天窗口 */
.online-customer-service.mobile-view .chat-window {
    width: calc(100vw - 40px) !important;
    height: 60vh !important;
    max-height: 500px;
    min-height: 300px;
    right: 0;
    left: 0;
    margin: 0 auto;
    bottom: 70px;
    position: fixed;
    border-radius: 15px;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.2);
}

.online-customer-service.mobile-view .chat-window.show {
    display: flex;
    animation: slideUpMobile 0.3s ease;
}

/* 移动端聊天内容 */
.online-customer-service.mobile-view .chat-body {
    height: auto !important;
    padding: 15px;
    font-size: 15px;
}

/* 移动端客服按钮 */
.online-customer-service.mobile-view .service-main-btn {
    padding: 12px 20px;
    font-size: 14px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 10000;
}

/* 移动端下拉菜单 */
.online-customer-service.mobile-view .service-dropdown {
    position: fixed;
    bottom: 70px;
    right: 20px;
    left: auto;
    min-width: 160px;
    z-index: 9999;
}

/* 移动端聊天输入 */
.online-customer-service.mobile-view .chat-input {
    font-size: 16px;
    padding: 12px 15px;
}

/* 移动端消息内容 */
.online-customer-service.mobile-view .message-content {
    max-width: 80% !important;
}

/* 移动端消息文本 */
.online-customer-service.mobile-view .message-text {
    font-size: 15px;
    line-height: 1.5;
}

/* 移动端快捷回复 */
.online-customer-service.mobile-view .quick-reply {
    font-size: 13px;
    padding: 10px 15px;
}

/* ========== 小屏幕手机适配 ========== */
@media (max-width: 375px) {
    .online-customer-service.mobile-view .chat-window {
        width: calc(100vw - 30px) !important;
        height: 55vh !important;
        bottom: 65px;
    }
    
    .online-customer-service.mobile-view .chat-body {
        padding: 12px;
    }
    
    .online-customer-service.mobile-view .service-main-btn {
        padding: 10px 18px;
        font-size: 13px;
        bottom: 15px;
        right: 15px;
    }
    
    .online-customer-service.mobile-view .service-dropdown {
        bottom: 65px;
        right: 15px;
        min-width: 150px;
    }
}

/* ========== 超小屏幕适配 ========== */
@media (max-width: 320px) {
    .online-customer-service.mobile-view .chat-window {
        width: calc(100vw - 20px) !important;
        height: 50vh !important;
        bottom: 60px;
    }
    
    .online-customer-service.mobile-view .chat-body {
        padding: 10px;
    }
    
    .online-customer-service.mobile-view .quick-reply {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ========== 横屏模式适配 ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .online-customer-service.mobile-view .chat-window {
        height: 80vh !important;
        width: 70vw !important;
        max-width: 400px;
        right: 20px;
        left: auto;
    }
}

/* ========== 平板适配 ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-window {
        width: 400px;
        height: 550px;
    }
    
    .online-customer-service {
        bottom: 40px;
        right: 40px;
    }
}

/* 动画 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

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

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 确保滚动条样式 */
.chat-body::-webkit-scrollbar {
    width: 4px;
}

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

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: #ff6b95;
}

.loading-spinner .spin {
    font-size: 40px;
    animation: spin 1s linear infinite;
    display: block;
    margin-bottom: 10px;
}

.loading-spinner span {
    font-size: 16px;
    font-weight: 600;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 版权信息样式 */
.copyright-footer {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid #e9ecef;
    margin-top: 30px;
    background: #f8f9fa;
}

.copyright-text {
    line-height: 1.6;
}