/**
 * 社交分享按钮样式。
 *
 * 提供文章底部分享栏和浮动分享按钮的样式，
 * 支持微信、微博、QQ、Twitter 等主流平台。
 */

/* 分享容器 */
.portal-share {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--tp-border, #e5e7eb);
    margin-top: 24px;
}
.portal-share__label {
    font-size: 14px;
    color: var(--tp-muted, #6b7280);
    white-space: nowrap;
}
.portal-share__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 分享按钮通用样式 */
.portal-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tp-surface, #f3f4f6);
    color: var(--tp-text, #374151);
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 16px;
}
.portal-share-btn:hover {
    transform: scale(1.1);
}
.portal-share-btn:focus-visible {
    outline: 2px solid var(--tp-primary, #007bfc);
    outline-offset: 2px;
}

/* 各平台颜色 */
.portal-share-btn--wechat:hover {
    background: #07c160;
    color: #fff;
}
.portal-share-btn--weibo:hover {
    background: #e6162d;
    color: #fff;
}
.portal-share-btn--qq:hover {
    background: #12b7f5;
    color: #fff;
}
.portal-share-btn--qzone:hover {
    background: #f2c037;
    color: #fff;
}
.portal-share-btn--twitter:hover {
    background: #1da1f2;
    color: #fff;
}
.portal-share-btn--facebook:hover {
    background: #1877f2;
    color: #fff;
}
.portal-share-btn--linkedin:hover {
    background: #0a66c2;
    color: #fff;
}
.portal-share-btn--link:hover {
    background: var(--tp-primary, #007bfc);
    color: #fff;
}

/* 分享按钮图标（使用 SVG 内联或 Unicode） */
.portal-share-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 微信二维码弹窗 */
.portal-share-qrcode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.portal-share-qrcode.is-active {
    opacity: 1;
    visibility: visible;
}
.portal-share-qrcode__inner {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    max-width: 280px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}
.portal-share-qrcode.is-active .portal-share-qrcode__inner {
    transform: scale(1);
}
.portal-share-qrcode__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--tp-heading, #111827);
}
.portal-share-qrcode__canvas {
    margin: 0 auto 12px;
}
.portal-share-qrcode__tip {
    font-size: 13px;
    color: var(--tp-muted, #6b7280);
}
.portal-share-qrcode__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--tp-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.portal-share-qrcode__close:hover {
    background: #fff;
    color: var(--tp-heading, #111827);
}

/* 浮动分享栏（可选，固定在侧边） */
.portal-share-float {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.portal-share-float.is-visible {
    opacity: 1;
    visibility: visible;
}
.portal-share-float .portal-share-btn {
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #fff;
}

/* 复制成功提示 */
.portal-share-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--tp-dark, #0f172a);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.portal-share-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .portal-share-float {
        display: none;
    }
}
@media (max-width: 640px) {
    .portal-share {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .portal-share-btn {
        width: 40px;
        height: 40px;
    }
}

/* 减弱动效偏好 */
@media (prefers-reduced-motion: reduce) {
    .portal-share-btn,
    .portal-share-qrcode,
    .portal-share-qrcode__inner,
    .portal-share-float,
    .portal-share-toast {
        transition: none;
    }
    .portal-share-btn:hover {
        transform: none;
    }
}
