/* ============================================================
   xf.css - 悬浮按钮 + 分享组件样式（磨砂玻璃风格）
   ============================================================ */

/* ============ 通用磨砂玻璃基础 ============ */
.xf-glass {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ 圆形悬浮按钮 ============ */
.xf-fab {
    position: fixed;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.5px;
    cursor: pointer;
    outline: none;
    z-index: 1000;
    overflow: hidden;
}
.xf-fab:hover {
    transform: translateY(-4px) scale(1.06);
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #fff;
}
.xf-fab:active {
    transform: translateY(-1px) scale(0.98);
}
.xf-fab svg {
    width: 18px;
    height: 18px;
    margin-bottom: 1px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.xf-fab .xf-label {
    font-size: 10px;
    opacity: 0.95;
}

/* ============ 各按钮位置与主题色 ============ */
#appButton {
    bottom: 240px;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.85), rgba(192, 57, 43, 0.85));
    border-color: rgba(255, 255, 255, 0.45);
}
#appButton:hover {
    background: linear-gradient(135deg, rgba(231, 76, 60, 1), rgba(192, 57, 43, 1));
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#homeButton {
    bottom: 190px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.85), rgba(41, 128, 185, 0.85));
    border-color: rgba(255, 255, 255, 0.45);
}
#homeButton:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 1), rgba(41, 128, 185, 1));
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* 分享按钮（右下角，圆形磨砂玻璃） */
.xf-share-btn {
    position: fixed;
    right: 20px;
    bottom: 140px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(41, 128, 185, 0.9));
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.xf-share-btn:hover {
    transform: translateY(-4px) scale(1.06);
    background: linear-gradient(135deg, rgba(52, 152, 219, 1), rgba(41, 128, 185, 1));
    box-shadow: 0 10px 28px rgba(52, 152, 219, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #fff;
}
.xf-share-btn.active {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.95), rgba(176, 42, 55, 0.95));
    box-shadow: 0 10px 28px rgba(220, 53, 69, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.xf-share-btn svg {
    width: 18px;
    height: 18px;
    margin-bottom: 1px;
    fill: #fff;
}
.xf-share-btn span {
    font-size: 10px;
    line-height: 1;
    opacity: 0.95;
}

#topButton {
    bottom: 90px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.85), rgba(39, 174, 96, 0.85));
    border-color: rgba(255, 255, 255, 0.45);
}
#topButton:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 1), rgba(39, 174, 96, 1));
    box-shadow: 0 8px 24px rgba(46, 204, 113, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#hideButton {
    bottom: 40px;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.85), rgba(142, 68, 173, 0.85));
    border-color: rgba(255, 255, 255, 0.45);
}
#hideButton:hover {
    background: linear-gradient(135deg, rgba(155, 89, 182, 1), rgba(142, 68, 173, 1));
    box-shadow: 0 8px 24px rgba(155, 89, 182, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#showButton {
    bottom: 20px;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.9), rgba(230, 126, 34, 0.9));
    border-color: rgba(255, 255, 255, 0.45);
}
#showButton:hover {
    background: linear-gradient(135deg, rgba(243, 156, 18, 1), rgba(230, 126, 34, 1));
    box-shadow: 0 8px 24px rgba(243, 156, 18, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ============ 分享面板（右下角，磨砂玻璃卡片） ============ */
.xf-share-panel {
    position: fixed;
    bottom: 100px;
    right: 70px;
    width: 320px;
    padding: 20px;
    border-radius: 18px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(30, 41, 59, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}
.xf-share-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.xf-share-panel::before {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(30, 41, 59, 0.55);
    backdrop-filter: blur(20px);
}
.xf-share-panel h4 {
    margin: 0 0 14px 0;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    letter-spacing: 1px;
    opacity: 0.95;
}

/* 二维码区 */
.xf-share-qrcode {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    margin-bottom: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.xf-share-qrcode img {
    width: 130px;
    height: 130px;
    display: block;
    margin: 0 auto 8px;
    border-radius: 6px;
}
.xf-share-qrcode p {
    font-size: 12px;
    color: #475569;
    margin: 0;
}
.xf-refresh-qrcode-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.55;
}
.xf-refresh-qrcode-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.12);
    transform: rotate(180deg);
}
.xf-refresh-qrcode-btn svg {
    width: 14px;
    height: 14px;
    fill: #334155;
}

/* 分享按钮组 */
.xf-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.xf-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 19px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.25s ease;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.xf-share-button:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #fff;
}
.xf-share-button svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}
.xf-share-button.wechat  { background: linear-gradient(135deg, rgba(7, 193, 96, 0.85), rgba(5, 150, 74, 0.85)); }
.xf-share-button.qq      { background: linear-gradient(135deg, rgba(18, 183, 245, 0.85), rgba(12, 145, 196, 0.85)); }
.xf-share-button.weibo   { background: linear-gradient(135deg, rgba(230, 22, 45, 0.85), rgba(190, 15, 35, 0.85)); }
.xf-share-button.sms     { background: linear-gradient(135deg, rgba(0, 102, 204, 0.85), rgba(0, 80, 160, 0.85)); }
.xf-share-button:hover.wechat { background: linear-gradient(135deg, rgba(7, 193, 96, 1), rgba(5, 150, 74, 1)); }
.xf-share-button:hover.qq     { background: linear-gradient(135deg, rgba(18, 183, 245, 1), rgba(12, 145, 196, 1)); }
.xf-share-button:hover.weibo  { background: linear-gradient(135deg, rgba(230, 22, 45, 1), rgba(190, 15, 35, 1)); }
.xf-share-button:hover.sms    { background: linear-gradient(135deg, rgba(0, 102, 204, 1), rgba(0, 80, 160, 1)); }

.xf-share-button.copy,
.xf-share-button.download {
    width: 100%;
    margin-top: 8px;
    border-radius: 19px;
    font-size: 13px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(41, 128, 185, 0.9));
}
.xf-share-button.download {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.9), rgba(39, 174, 96, 0.9));
}
.xf-share-button.copy:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 1), rgba(41, 128, 185, 1));
}
.xf-share-button.download:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 1), rgba(39, 174, 96, 1));
}

/* 消息提示 */
.xf-share-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.95), rgba(39, 174, 96, 0.95));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(46, 204, 113, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 1002;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.xf-share-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* 隐藏状态 */
.xf-hidden {
    display: none !important;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .xf-fab,
    .xf-share-btn {
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 10px;
    }
    .xf-fab svg,
    .xf-share-btn svg { width: 16px; height: 16px; }
    .xf-fab .xf-label,
    .xf-share-btn span { font-size: 9px; }

    #appButton    { bottom: 260px; }
    #homeButton   { bottom: 214px; }
    .xf-share-btn { bottom: 168px; }
    #topButton    { bottom: 122px; }
    #hideButton   { bottom: 76px; }
    #showButton   { bottom: 30px; }

    .xf-share-panel {
        bottom: 100px;
        right: 40px;
        left: 14px;
        width: auto;
        padding: 16px;
        border-radius: 16px;
    }
    .xf-share-panel::before {
        right: 26px;
    }
    .xf-share-button {
        height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .xf-fab,
    .xf-share-btn {
        right: 0px;
        width: 40px;
        height: 40px;
    }

    .xf-fab svg,
    .xf-share-btn svg { width: 15px; height: 15px; }

    #appButton    { bottom: 240px; }
    #homeButton   { bottom: 196px; }
    .xf-share-btn { bottom: 152px; }
    #topButton    { bottom: 108px; }
    #hideButton   { bottom: 64px; }
    #showButton   { bottom: 20px; }

    .xf-share-panel {
        bottom: 100px;
        right: 40px;
        left: 10px;
        padding: 14px;
    }
    .xf-share-panel::before {
        right: 22px;
    }
    .xf-share-qrcode img {
        width: 100px;
        height: 100px;
    }
    .xf-share-button {
        height: 34px;
        padding: 0 10px;
        font-size: 11px;
    }
}

/* 降级方案 */
@supports not (backdrop-filter: blur(12px)) {
    .xf-fab, .xf-share-btn {
        background: rgba(52, 73, 94, 0.9);
    }
    .xf-share-panel {
        background: rgba(30, 41, 59, 0.95);
    }
    .xf-share-button {
        background: rgba(255, 255, 255, 0.2);
    }
}