/* ==================== 左下角弹窗样式 ==================== */
.popup {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 1000;
    width: 514px;
    overflow: hidden;
    border-radius: 12px;
    padding: 25px 20px 25px 25px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(164, 22, 38, 0.25);
    display: none;
    border-left: 5px solid #a41626;
    transform: translateX(-100%); /* 初始隐藏在左侧 */
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.5s ease;
}

.popup.visible {
    display: block;
    transform: translateX(0);
    opacity: 1;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(0) scale(1.03);
    }
    50% {
        transform: translateX(0) scale(1);
    }
    75% {
        transform: translateX(0) scale(1.02);
    }
}

.popup-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.popup-logo {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 20px;
    flex-shrink: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(164, 22, 38, 0.3);
}

.popup-logo .logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.popup-text {
    flex: 1;
}

.popup-title {
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
    color: #a41626;
    margin-bottom: 8px;
}

.popup-subtitle {
    font-size: 18px;
    color: #666;
}

.popup-subtitle .highlight {
    color: #a41626;
    font-weight: 700;
}

.popup-actions {
    display: flex;
    gap: 15px;
    padding-left: 90px;
}

.primary-btn {
    background: linear-gradient(to right, #a41626, #c51d31);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(164, 22, 38, 0.3);
}

.primary-btn:hover {
    background: linear-gradient(to right, #8c1320, #a41626);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(164, 22, 38, 0.4);
}

.text-btn {
    background: transparent;
    color: #a41626;
    border: 2px solid #a41626;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.text-btn:hover {
    background: rgba(164, 22, 38, 0.1);
    transform: translateY(-2px);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:before, .close-btn:after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #999;
    border-radius: 1px;
}

.close-btn:before {
    transform: rotate(45deg);
}

.close-btn:after {
    transform: rotate(-45deg);
}

.close-btn:hover:before, .close-btn:hover:after {
    background: #a41626;
}

/* ==================== 右侧悬浮工具栏 ==================== */
.side-toolbar {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-tool-item {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(164, 22, 38, 0.15);
    transition: box-shadow 0.3s ease;
    overflow: visible;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

.side-tool-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #a41626 0%, #c51d31 100%);
    position: absolute;
    right: 0;
    top: 0;
    z-index: 3;
    border-radius: 8px;
}

.side-tool-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.side-tool-item:hover .side-tool-icon {
    background: linear-gradient(135deg, #8c1320 0%, #a41626 100%);
}

.side-tool-content {
    position: absolute;
    right: 100%;
    top: 0;
    width: 150px;
    height: 50px;
    opacity: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease;
    transform: translateX(-20px);
    pointer-events: none;
    background: white;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 15px rgba(164, 22, 38, 0.1);
}

/* 微信公众号内容区域特殊样式 */
.side-tool-item.wechat-item .side-tool-content {
    height: 180px;
    justify-content: flex-start;
    padding-top: 20px;
}

.side-tool-item:hover .side-tool-content {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.side-tool-title {
    font-weight: 600;
    color: #a41626;
    margin-bottom: 2px;
    font-size: 14px;
    white-space: nowrap;
}

.side-tool-desc {
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
    white-space: nowrap;
}

.side-qrcode {
    text-align: center;
    margin-top: 8px;
}

.side-qrcode img {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    border: 1px solid #eee;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .popup {
        width: calc(100% - 48px);
        max-width: 400px;
        left: 24px;
        bottom: 80px; /* 避免与底部工具栏重叠 */
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-subtitle {
        font-size: 16px;
    }
    
    .popup-actions {
        padding-left: 0;
        flex-direction: column;
    }
    
    .primary-btn, .text-btn {
        font-size: 16px;
        padding: 10px 20px;
        width: 100%;
    }
    
    .side-toolbar {
        right: 10px;
    }
    
    .side-tool-content {
        width: 130px;
    }
    
    .side-tool-item.wechat-item .side-tool-content {
        height: 160px;
        width: 140px;
    }
}

@media (max-width: 480px) {
    .popup {
        width: calc(100% - 32px);
        left: 16px;
        bottom: 70px;
        padding: 20px;
    }
    
    .popup-header {
        flex-direction: column;
        text-align: center;
    }
    
    .popup-logo {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .popup-text {
        margin-left: 0;
    }
}


/* ==================== 中间弹窗样式（无背景虚化） ==================== */
.middle-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* 去除backdrop-filter */
    z-index: 1001;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.middle-popup.active {
    display: flex;
    opacity: 1;
}

.middle-popup-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 15px 40px rgba(164, 22, 38, 0.2); /* 初始阴影 */
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

/* 红色外发光呼吸效果 */
@keyframes redGlowBreathing {
    0%, 100% {
        box-shadow: 
            0 0 0 0 rgba(164, 22, 38, 0.3),
            0 15px 40px rgba(164, 22, 38, 0.2);
    }
    50% {
        box-shadow: 
            0 0 0 10px rgba(164, 22, 38, 0.15),
            0 20px 50px rgba(164, 22, 38, 0.25);
    }
}

/* 卡片缩放呼吸效果 */
@keyframes cardBreathing {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(0) scale(1.01);
    }
}

.middle-popup.active .middle-popup-content {
    transform: translateY(0) scale(1);
    animation: 
        cardBreathing 3s ease-in-out infinite,
        redGlowBreathing 3s ease-in-out infinite;
}

/* 弹窗头部 */
.middle-popup-header {
    background: linear-gradient(135deg, #a41626, #c51d31);
    padding: 25px;
    display: flex;
    align-items: center;
    position: relative;
}

.middle-popup-avatar {
    position: relative;
    width: 60px;
    height: 60px;
    margin-right: 15px;
    flex-shrink: 0;
}

.middle-popup-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.middle-popup-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.middle-popup-info {
    flex: 1;
    color: white;
}

.middle-popup-title {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.middle-popup-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.middle-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.middle-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 弹窗内容 */
.middle-popup-body {
    padding: 25px;
}

/* 消息气泡 */
.middle-popup-message {
    margin-bottom: 25px;
}

.message-bubble {
    background: #f5f5f5;
    border-radius: 18px;
    padding: 15px;
    position: relative;
    max-width: 85%;
    border-bottom-left-radius: 4px;
}

.message-bubble:before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 16px;
    height: 16px;
    background: #f5f5f5;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.message-bubble p {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
}

.message-time {
    font-size: 12px;
    color: #999;
    display: block;
    text-align: right;
}

/* 功能特色 */
.middle-popup-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateX(5px);
    background: #f0f3fa;
}

.feature-icon {
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

.feature-text {
    flex: 1;
}

.feature-text strong {
    display: block;
    color: #a41626;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-text p {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* 弹窗底部按钮 */
.middle-popup-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
}

.middle-popup-btn {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.middle-popup-btn.primary {
    background: linear-gradient(135deg, #a41626, #c51d31);
    color: white;
    box-shadow: 0 6px 20px rgba(164, 22, 38, 0.3);
}

.middle-popup-btn.primary:hover {
    background: linear-gradient(135deg, #8c1320, #a41626);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(164, 22, 38, 0.4);
}

.middle-popup-btn.secondary {
    background: white;
    color: #a41626;
    border: 2px solid #a41626;
}

.middle-popup-btn.secondary:hover {
    background: rgba(164, 22, 38, 0.1);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 20px;
    margin-right: 8px;
}

/* ==================== 淡入淡出动画 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

.middle-popup.fade-in .middle-popup-content {
    animation: 
        fadeIn 0.6s ease-out forwards,
        cardBreathing 3s ease-in-out infinite 0.6s,
        redGlowBreathing 3s ease-in-out infinite 0.6s;
}

.middle-popup.fade-out .middle-popup-content {
    animation: fadeOut 0.5s ease-in forwards;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .middle-popup-content {
        width: 95%;
        max-width: 380px;
    }
    
    .middle-popup-header {
        padding: 20px;
    }
    
    .middle-popup-avatar {
        width: 50px;
        height: 50px;
    }
    
    .middle-popup-title {
        font-size: 18px;
    }
    
    .middle-popup-body {
        padding: 20px;
    }
    
    .middle-popup-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .middle-popup-btn {
        padding: 14px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .middle-popup-content {
        width: 95%;
        max-width: 350px;
    }
    
    .middle-popup-header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .middle-popup-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .middle-popup-info {
        text-align: center;
    }
    
    .feature-item {
        padding: 12px;
    }
    
    /* 移动端减小呼吸动画幅度 */
    @keyframes cardBreathing {
        0%, 100% {
            transform: translateY(0) scale(1);
        }
        50% {
            transform: translateY(0) scale(1.005);
        }
    }
}