/* ==================== 浮动按钮组合 ==================== */
.float-buttons-wrapper {
    position: fixed;
    z-index: 1000;
    --float-offset-x: 30px;
    --float-offset-y: 120px;
}

/* 水平位置 */
.float-buttons-wrapper:not(.position-left) {
    right: var(--float-offset-x);
}
.float-buttons-wrapper.position-left {
    left: var(--float-offset-x);
}

/* 垂直位置 */
.float-buttons-wrapper.position-v-top {
    top: var(--float-offset-y);
}
.float-buttons-wrapper.position-v-middle {
    top: 50%;
    transform: translateY(-50%);
}
.float-buttons-wrapper.position-v-bottom {
    bottom: var(--float-offset-y);
}

/* 按钮组容器 */
.float-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* 圆形按钮组 */
.float-btn-group {
    background: var(--bg-primary);
    border-radius: 28px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 单个按钮 */
.float-btn {
    width: clamp(42px, 8vw, 52px);
    height: clamp(42px, 8vw, 52px);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    color: var(--text-secondary);
}

.float-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.float-btn i {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.float-btn:hover i {
    transform: scale(1.15);
}

/* 分隔线 */
.float-btn:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: var(--border-color);
}

/* 主题切换按钮 */
.float-btn.theme-toggle {
    color: #9c27b0;
}

.float-btn.theme-toggle:hover {
    background: rgba(156, 39, 176, 0.1);
}

body.dark-theme .float-btn.theme-toggle {
    color: #ffca28;
}

/* QQ客服按钮 */
.float-btn.qq-btn {
    color: #12B7F5;
}

.float-btn.qq-btn:hover {
    background: rgba(18, 183, 245, 0.1);
}

/* 返回顶部 */
.float-btn.back-to-top {
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.float-btn.back-to-top:hover {
    color: var(--primary-color);
    background: rgba(24, 144, 255, 0.1);
}

.float-btn.back-to-top i {
    font-size: 16px;
}

/* 浮动提示 */
.float-btn-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.float-btn-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.8);
}

.float-btn:hover .float-btn-tooltip {
    opacity: 1;
    visibility: visible;
}

/* 悬浮窗在左侧时，tooltip在右边 */
.float-buttons-wrapper.position-left .float-btn-tooltip {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 12px;
}

.float-buttons-wrapper.position-left .float-btn-tooltip::after {
    left: auto;
    right: 100%;
    border-left-color: transparent;
    border-right-color: rgba(0, 0, 0, 0.8);
}

/* 黑暗主题 */
body.dark-theme .float-btn-group {
    background: #1e1e1e;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-theme .float-btn {
    color: #888;
}

body.dark-theme .float-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
}

body.dark-theme .float-btn.theme-toggle {
    color: #ffca28;
}

body.dark-theme .float-btn.qq-btn {
    color: #12B7F5;
}

body.dark-theme .float-btn.back-to-top {
    color: #888;
}

body.dark-theme .float-btn.back-to-top:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .float-btn-tooltip {
    background: rgba(30, 30, 30, 0.95);
}

body.dark-theme .float-btn-tooltip::after {
    border-left-color: rgba(30, 30, 30, 0.95);
}

/* 响应式 */
@media (max-width: 768px) {
    .float-buttons-wrapper {
        --float-offset-x: clamp(10px, 3vw, 16px);
        --float-offset-y: clamp(10px, 3vw, 16px);
    }
    
    .float-btn i {
        font-size: 15px;
    }
    
    .float-btn-tooltip {
        display: none;
    }

    .float-btn-group {
        border-radius: 22px;
    }
}

/* ========== H5收起/展开功能 ========== */
/* 默认隐藏收起和展开按钮，仅H5显示 */
.float-collapse-btn,
.float-expand-btn {
    display: none;
}

@media (max-width: 768px) {
    /* 收起按钮 */
    .float-collapse-btn {
        display: flex;
        color: #94a3b8 !important;
    }
    .float-collapse-btn:hover {
        color: #ef4444 !important;
        background: rgba(239, 68, 68, 0.1);
    }
    .float-collapse-btn i {
        font-size: 13px;
    }

    /* 展开按钮（小圆点） */
    .float-expand-btn {
        display: none;
        width: clamp(30px, 6vw, 36px);
        height: clamp(30px, 6vw, 36px);
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
        color: #64748b;
        font-size: 14px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        transition: all 0.25s ease;
        backdrop-filter: blur(10px);
    }
    .float-expand-btn:active {
        transform: scale(0.9);
    }
    body.dark-theme .float-expand-btn {
        background: rgba(30, 30, 30, 0.9);
        color: #888;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    /* 收起状态 */
    .float-buttons-wrapper.collapsed .float-buttons {
        display: none;
    }
    .float-buttons-wrapper.collapsed .float-expand-btn {
        display: flex;
    }
}

/* ==================== 二维码弹窗 ==================== */
.qrcode-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.qrcode-modal.show {
    display: flex;
}

.qrcode-modal-content {
    position: relative;
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.qrcode-modal-content img {
    max-width: min(250px, calc(100vw - 80px));
    max-height: min(250px, calc(100vw - 80px));
    border-radius: 8px;
}

.qrcode-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-modal-close:hover {
    background: var(--primary-color);
    color: white;
}

/* 二维码弹窗暗色主题 */
body.dark-theme .qrcode-modal-content {
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .qrcode-modal-close {
    background: #333;
    color: #aaa;
}

body.dark-theme .qrcode-modal-close:hover {
    background: #444;
    color: #fff;
}
