/*
 * 20260813：手機版右側浮動社群按鈕
 *
 * 桌機版維持原本 Footer 的社群按鈕。
 * 畫面寬度 768px 以下時，Footer 中的 LINE、Facebook、WhatsApp 會隱藏，
 * 並改為右側固定的大型圓形按鈕。
 */

/* 預設（桌機與平板橫向）不顯示手機浮動按鈕。 */
.mobile-social-float {
    display: none;
}

/* WeChat QR Code 彈出視窗預設隱藏。 */
.wechat-qr-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.wechat-qr-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.wechat-qr-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.wechat-qr-modal__dialog {
    position: relative;
    z-index: 1;

    width: min(92vw, 420px);
    max-height: calc(100vh - 40px);
    padding: 28px 22px 22px;
    overflow-y: auto;

    color: #222;
    text-align: center;
    background: #fff;
    border-radius: 18px;
    box-sizing: border-box;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.wechat-qr-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;

    width: 42px;
    height: 42px;
    padding: 0;

    color: #333;
    font-size: 22px;
    background: #f1f1f1;
    border: 0;
    border-radius: 50%;
}

.wechat-qr-modal__title {
    margin: 0 45px 4px;
    color: #111;
    font-size: 25px;
    line-height: 1.3;
}

.wechat-qr-modal__account {
    margin: 0 0 15px;
    color: #555;
    font-size: 17px;
    font-weight: 600;
}

.wechat-qr-modal__image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 58vh;
    margin: 0 auto;
    object-fit: contain;
}

.wechat-qr-modal__hint {
    margin: 15px 0 0;
    color: #555;
    font-size: 16px;
    line-height: 1.6;
}

body.wechat-modal-open {
    overflow: hidden !important;
}

@media screen and (max-width: 768px) {
    /* Footer 不再重複顯示這三個社群按鈕。 */
    .footer-social-mobile-hidden {
        display: none !important;
    }

    /* 固定在手機畫面右側中央。 */
    .mobile-social-float {
        position: fixed;
        top: 50%;
        right: max(12px, env(safe-area-inset-right));
        z-index: 9999;

        display: flex;
        flex-direction: column;
        gap: 12px;

        transform: translateY(-50%);
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    /* 共用按鈕外觀。 */
    .mobile-social-float__button {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 58px;
        height: 58px;
        padding: 0;

        color: #fff !important;
        font-size: 31px;
        line-height: 1;
        text-decoration: none !important;

        border: 2px solid rgba(255, 255, 255, 0.92);
        border-radius: 50%;
        box-sizing: border-box;
        box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);

        -webkit-tap-highlight-color: transparent;
        transition: transform 0.18s ease, box-shadow 0.18s ease;
        cursor: pointer;
    }

    .mobile-social-float__button:hover,
    .mobile-social-float__button:focus-visible {
        color: #fff !important;
        transform: scale(1.08);
        box-shadow: 0 7px 20px rgba(0, 0, 0, 0.35);
    }

    .mobile-social-float__button:active {
        transform: scale(0.92);
    }

    /* 各社群官方識別色。 */
    .mobile-social-float__button--line {
        background-color: #06c755;
    }

    .mobile-social-float__button--facebook {
        background-color: #1877f2;
    }

    .mobile-social-float__button--whatsapp {
        background-color: #25d366;
    }

    .mobile-social-float__button--wechat {
        background-color: #07c160;
    }

    /* 原頁面開啟手機選單時 body 會加上 active，避免浮動按鈕遮住選單。 */
    body.active .mobile-social-float {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
}

/* 窄螢幕略微縮小，保留內容可視空間。 */
@media screen and (max-width: 375px) {
    .mobile-social-float {
        right: max(9px, env(safe-area-inset-right));
        gap: 10px;
    }

    .mobile-social-float__button {
        width: 52px;
        height: 52px;
        font-size: 28px;
    }
}

/* 尊重使用者的減少動態效果設定。 */
@media (prefers-reduced-motion: reduce) {
    .mobile-social-float,
    .mobile-social-float__button,
    .wechat-qr-modal {
        transition: none;
    }
}
