/* ============================================================================
 * FaithPot Community — Share Button Styles
 * Self-contained, theme-proof. Heavy use of !important to survive theme CSS.
 * ============================================================================ */

/* Reset ----------------------------------------------------------------------*/
.fp-share-wrap,
.fp-share-wrap *,
.fp-share-wrap *::before,
.fp-share-wrap *::after {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

.fp-share-wrap button,
.fp-share-wrap a {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    text-decoration: none !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Wrapper --------------------------------------------------------------------*/
.fp-share-wrap {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: #222 !important;
    line-height: 1 !important;
}

.fp-share-standalone {
    margin: 24px 0 !important;
    text-align: center !important;
}

/* Pill button — matches reaction-btn shape exactly --------------------------*/
.fp-share-wrap .fp-share-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    border-radius: 50px !important;
    border: 1.5px solid #2a2a2a !important;
    background: #fff !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #222 !important;
    line-height: 1 !important;
    min-height: 44px !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    float: none !important;
}

.fp-share-wrap .fp-share-btn:hover {
    border-color: #111 !important;
    background: #f5f5f5 !important;
}

.fp-share-wrap .fp-share-btn:active {
    transform: scale(0.95) !important;
}

.fp-share-wrap .fp-share-btn:focus-visible {
    outline: 2px solid #534AB7 !important;
    outline-offset: 2px !important;
}

.fp-share-wrap .fp-share-ico {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #111 !important;
}

.fp-share-wrap .fp-share-ico svg {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
}

.fp-share-wrap .fp-share-word {
    display: inline-block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    color: inherit !important;
    white-space: nowrap !important;
}

/* Active state — when popover is open */
.fp-share-wrap.fp-open .fp-share-btn {
    border-color: #534AB7 !important;
    background: #F0EFFE !important;
    color: #3C3489 !important;
}
.fp-share-wrap.fp-open .fp-share-ico { color: #534AB7 !important; }

/* Popover --------------------------------------------------------------------
 * Positioning is JS-assisted via two CSS custom properties:
 *   --fp-pop-shift  → horizontal offset (px) added to centering, used to clamp
 *                     the popover inside the viewport on narrow screens.
 *   --fp-pop-arrow  → arrow horizontal offset (px) so it stays under the button
 *                     center even when the popover itself is shifted.
 * The wrap also gets .fp-pop-up (default, opens above) or .fp-pop-down (flips
 * below the button when there isn't room above).
 * --------------------------------------------------------------------------- */
.fp-share-wrap .fp-share-pop {
    position: absolute !important;
    bottom: calc(100% + 10px) !important;
    left: 50% !important;
    transform: translateX(calc(-50% + var(--fp-pop-shift, 0px))) translateY(6px) !important;
    min-width: 180px !important;
    max-width: calc(100vw - 20px) !important;
    padding: 6px !important;
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s !important;
    /* Just under the absolute max — beats virtually any theme header. */
    z-index: 2147483600 !important;
}

.fp-share-wrap.fp-open .fp-share-pop {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateX(calc(-50% + var(--fp-pop-shift, 0px))) translateY(0) !important;
}

/* Flip below the button when there isn't room above (sticky toolbars, very top of page) */
.fp-share-wrap.fp-pop-down .fp-share-pop {
    bottom: auto !important;
    top: calc(100% + 10px) !important;
    transform: translateX(calc(-50% + var(--fp-pop-shift, 0px))) translateY(-6px) !important;
}
.fp-share-wrap.fp-pop-down.fp-open .fp-share-pop {
    transform: translateX(calc(-50% + var(--fp-pop-shift, 0px))) translateY(0) !important;
}

/* Tiny arrow — centered on the button, not the popover, via --fp-pop-arrow */
.fp-share-wrap .fp-share-pop::after {
    content: '' !important;
    position: absolute !important;
    top: 100% !important;
    left: calc(50% + var(--fp-pop-arrow, 0px)) !important;
    transform: translateX(-50%) !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 7px solid transparent !important;
    border-right: 7px solid transparent !important;
    border-top: 7px solid #fff !important;
    filter: drop-shadow(0 1px 0 #e5e5e5) !important;
}

/* Arrow flips to the top edge when popover opens downward */
.fp-share-wrap.fp-pop-down .fp-share-pop::after {
    top: auto !important;
    bottom: 100% !important;
    border-top: none !important;
    border-bottom: 7px solid #fff !important;
    filter: drop-shadow(0 -1px 0 #e5e5e5) !important;
}

/* Popover items */
.fp-share-wrap .fp-share-opt {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: none !important;
    background: transparent !important;
    color: #222 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    text-align: left !important;
    white-space: nowrap !important;
    transition: background 0.12s, color 0.12s !important;
    width: 100% !important;
}

.fp-share-wrap .fp-share-opt:hover,
.fp-share-wrap .fp-share-opt:focus-visible {
    background: #f5f5f7 !important;
    outline: none !important;
}

.fp-share-wrap .fp-share-opt svg {
    flex-shrink: 0 !important;
    display: block !important;
}

.fp-share-wrap .fp-share-opt span {
    flex: 1 1 auto !important;
    line-height: 1 !important;
}

/* Brand colors on hover */
.fp-share-wrap .fp-share-fb     { color: #1877F2 !important; }
.fp-share-wrap .fp-share-tw     { color: #000000 !important; }
.fp-share-wrap .fp-share-pin    { color: #E60023 !important; }
.fp-share-wrap .fp-share-native { color: #534AB7 !important; }

.fp-share-wrap .fp-share-fb:hover     { background: #E7F0FE !important; }
.fp-share-wrap .fp-share-tw:hover     { background: #f0f0f0 !important; }
.fp-share-wrap .fp-share-pin:hover    { background: #FCE7EA !important; }
.fp-share-wrap .fp-share-native:hover { background: #F0EFFE !important; }

/* Hide the Native option entirely when navigator.share is unavailable.
 * The JS adds .fp-no-native to the wrap on first click if unsupported. */
.fp-share-wrap.fp-no-native .fp-share-native {
    display: none !important;
}

/* Inside the reactions strip the share button sits on the same row */
.fp-reactions-wrap .fp-share-wrap {
    margin-left: 0 !important;
}

/* Toast — confirmation when clipboard fallback fires --------------------------*/
.fp-share-toast {
    position: fixed !important;
    left: 50% !important;
    bottom: 32px !important;
    transform: translateX(-50%) translateY(20px) !important;
    background: #1a1a1a !important;
    color: #fff !important;
    padding: 12px 20px !important;
    border-radius: 999px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.2s, transform 0.2s !important;
    z-index: 2147483600 !important;
}
.fp-share-toast.fp-show {
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
}

/* Mobile tweaks --------------------------------------------------------------*/
@media (max-width: 480px) {
    .fp-share-wrap .fp-share-btn {
        padding: 10px 14px !important;
    }
    .fp-share-wrap .fp-share-pop {
        min-width: 200px !important;
    }
}

/* Reduced motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
    .fp-share-wrap .fp-share-btn,
    .fp-share-wrap .fp-share-pop,
    .fp-share-wrap .fp-share-opt,
    .fp-share-toast {
        transition: none !important;
    }
}
