/**
 * Social Buttons — front widget
 * Theme-agnostic, scoped under .sb-widget. All visual values are driven by
 * CSS custom properties set inline from module configuration.
 */

.sb-widget,
.sb-widget *,
.sb-widget *::before,
.sb-widget *::after {
    box-sizing: border-box;
}

.sb-widget {
    --sb-size: 56px;
    --sb-gap: 14px;
    --sb-offset-x: 20px;
    --sb-offset-y: 20px;
    --sb-launcher: #2d7ff9;
    --sb-icon: #ffffff;
    --sb-radius: 50%;
    --sb-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    --sb-ease: cubic-bezier(0.22, 1, 0.36, 1);

    position: fixed;
    bottom: var(--sb-offset-y);
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 0;
    padding: 0;
    font-family: inherit;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
}

.sb-widget--right {
    right: var(--sb-offset-x);
    align-items: flex-end;
}

.sb-widget--left {
    left: var(--sb-offset-x);
    align-items: flex-start;
}

/* ---- Channel list ---------------------------------------------------- */

.sb-channels {
    list-style: none;
    margin: 0 0 var(--sb-gap) 0;
    padding: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sb-gap);
}

.sb-channel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.85);
    transition:
        opacity 0.25s var(--sb-ease),
        transform 0.25s var(--sb-ease),
        visibility 0s linear 0.25s;
}

.sb-widget--left .sb-channel {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.sb-widget--open .sb-channel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.3s var(--sb-ease),
        transform 0.3s var(--sb-ease),
        visibility 0s;
}

.sb-widget--open .sb-channel:nth-child(1) { transition-delay: 0.02s; }
.sb-widget--open .sb-channel:nth-child(2) { transition-delay: 0.06s; }
.sb-widget--open .sb-channel:nth-child(3) { transition-delay: 0.10s; }
.sb-widget--open .sb-channel:nth-child(4) { transition-delay: 0.14s; }

/* ---- Buttons --------------------------------------------------------- */

.sb-link,
.sb-launcher {
    --sb-btn-bg: var(--sb-color, var(--sb-launcher));
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--sb-size);
    height: var(--sb-size);
    padding: 0;
    border: 0;
    border-radius: var(--sb-radius);
    background: var(--sb-btn-bg);
    color: var(--sb-icon);
    box-shadow: var(--sb-shadow);
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
    transition: transform 0.2s var(--sb-ease), box-shadow 0.2s var(--sb-ease), filter 0.2s var(--sb-ease);
}

.sb-link:hover,
.sb-link:focus-visible,
.sb-launcher:hover,
.sb-launcher:focus-visible {
    transform: scale(1.08);
    filter: brightness(1.05);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.sb-link:focus-visible,
.sb-launcher:focus-visible {
    outline: 3px solid rgba(45, 127, 249, 0.45);
    outline-offset: 2px;
}

.sb-link:active,
.sb-launcher:active {
    transform: scale(0.96);
}

.sb-link svg,
.sb-launcher svg {
    width: 54%;
    height: 54%;
    display: block;
    fill: currentColor;
    pointer-events: none;
}

/* ---- Label pill ------------------------------------------------------ */

.sb-link__label {
    display: inline-block;
    max-width: 50vw;
    padding: 7px 12px;
    border-radius: 10px;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* ---- Launcher icon swap --------------------------------------------- */

.sb-launcher {
    position: relative;
}

.sb-launcher__icon {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s var(--sb-ease), transform 0.25s var(--sb-ease);
}

.sb-launcher__icon--close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

.sb-widget--open .sb-launcher__icon--open {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

.sb-widget--open .sb-launcher__icon--close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ---- Attention pulse ------------------------------------------------- */

.sb-widget--anim:not(.sb-widget--open) .sb-launcher::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--sb-radius);
    box-shadow: 0 0 0 0 var(--sb-btn-bg);
    opacity: 0.7;
    animation: sb-pulse 2.2s var(--sb-ease) infinite;
}

@keyframes sb-pulse {
    0%   { box-shadow: 0 0 0 0 var(--sb-btn-bg); opacity: 0.55; }
    70%  { box-shadow: 0 0 0 16px var(--sb-btn-bg); opacity: 0; }
    100% { box-shadow: 0 0 0 0 var(--sb-btn-bg); opacity: 0; }
}

/* ---- Responsive ------------------------------------------------------ */

@media (max-width: 575px) {
    .sb-widget {
        --sb-size: 52px;
        --sb-offset-x: 14px;
        --sb-offset-y: 14px;
    }

    .sb-widget.sb-hide-mobile {
        display: none;
    }

    .sb-link__label {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* ---- Reduced motion -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .sb-channel,
    .sb-link,
    .sb-launcher,
    .sb-launcher__icon {
        transition-duration: 0.01ms !important;
    }

    .sb-widget--anim .sb-launcher::after {
        animation: none !important;
    }
}
