/*--------------------------------------------------------------
 * Social FAB – Front-end Styles
 * Version: 1.4.0
 *------------------------------------------------------------*/

/* ============================================================
   1. Wrapper & Positioning
   ============================================================ */

.sfab-wrapper {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sfab-pos-bottom-left,
.sfab-pos-top-left {
    align-items: flex-start;
}

.sfab-pos-bottom-right { bottom: 28px; right: 28px; }
.sfab-pos-bottom-left  { bottom: 28px; left: 28px; }
.sfab-pos-top-right    { top: 28px; right: 28px; }
.sfab-pos-top-left     { top: 28px; left: 28px; }

/* ============================================================
   2. Toggle Row (CTA text + FAB button)
   ============================================================ */

.sfab-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    order: 2;
}

.sfab-labels-right .sfab-toggle-row {
    flex-direction: row-reverse;
}

/* ============================================================
   3. CTA Text Bubble
   ============================================================ */

.sfab-cta {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #FFD700;
    padding: 8px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 220px;
    overflow: hidden;
    border: 1.5px solid rgba(255, 215, 0, 0.3);
}

.sfab-cta::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
}

.sfab-labels-left .sfab-cta::after {
    right: -12px;
    border-left-color: #1a1a2e;
}

.sfab-labels-right .sfab-cta::after {
    left: -12px;
    border-right-color: #1a1a2e;
}

.sfab-wrapper.sfab-open .sfab-cta {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Typewriter */
.sfab-cta-typewriter .sfab-cta-inner {
    display: inline;
    overflow: hidden;
}

.sfab-cta-typewriter .sfab-cta-cursor {
    display: inline;
    animation: sfab-cursor-blink 0.7s step-end infinite;
    color: #FFD700;
    font-weight: 400;
    margin-left: 1px;
}

@keyframes sfab-cursor-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

/* Blink */
.sfab-cta-blink .sfab-cta-inner {
    animation: sfab-text-blink 2s ease-in-out infinite;
}
.sfab-cta-blink .sfab-cta-cursor { display: none; }

@keyframes sfab-text-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

/* Static */
.sfab-cta-static .sfab-cta-cursor { display: none; }

/* Glow pulse */
@keyframes sfab-cta-glow {
    0%, 100% { box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3), 0 0 8px rgba(255, 215, 0, 0.15); }
    50%      { box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.4); }
}

.sfab-cta {
    animation: sfab-cta-glow 3s ease-in-out infinite;
}

/* ============================================================
   4. Main Toggle Button
   ============================================================ */

.sfab-toggle {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
    flex-shrink: 0;
}

.sfab-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
}

.sfab-toggle .sfab-icon-close { display: none; }
.sfab-wrapper.sfab-open .sfab-toggle .sfab-icon-open  { display: none; }
.sfab-wrapper.sfab-open .sfab-toggle .sfab-icon-close { display: inline-block; }

@keyframes sfab-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.5); }
    70%  { box-shadow: 0 0 0 14px rgba(0, 115, 170, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0); }
}

.sfab-toggle:not(:hover) {
    animation: sfab-pulse 2.5s infinite;
}
.sfab-wrapper.sfab-open .sfab-toggle {
    animation: none;
}

/* ============================================================
   5. Actions Container
   ============================================================ */

.sfab-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.85);
    transition: opacity 0.3s ease, transform 0.3s ease;
    order: 1;
    margin-bottom: 16px;
}

.sfab-pos-bottom-left .sfab-actions,
.sfab-pos-top-left .sfab-actions {
    align-items: flex-start;
}

.sfab-wrapper[data-expand="down"] .sfab-actions {
    order: 3;
    margin-bottom: 0;
    margin-top: 16px;
    transform: translateY(-20px) scale(0.85);
}
.sfab-wrapper[data-expand="down"] .sfab-toggle-row {
    order: 1;
}

.sfab-wrapper.sfab-open .sfab-actions {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ============================================================
   6. Action Buttons (Pill: Label + Icon)
   ============================================================ */

.sfab-action {
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    background: #fff;
    height: 48px;
}

.sfab-action:hover {
    transform: translateX(-4px) scale(1.03);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.28);
    text-decoration: none;
}

.sfab-pos-bottom-left .sfab-action:hover,
.sfab-pos-top-left .sfab-action:hover {
    transform: translateX(4px) scale(1.03);
}

.sfab-action:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.sfab-label {
    padding: 0 16px 0 18px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    line-height: 48px;
    letter-spacing: 0.2px;
}

.sfab-labels-right .sfab-action {
    flex-direction: row-reverse;
}
.sfab-labels-right .sfab-label {
    padding: 0 18px 0 16px;
}

.sfab-icon-circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background-color: var(--sfab-action-color, #0073aa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

/* Stagger */
.sfab-wrapper.sfab-open .sfab-action:nth-child(1) { transition-delay: 0.04s; }
.sfab-wrapper.sfab-open .sfab-action:nth-child(2) { transition-delay: 0.08s; }
.sfab-wrapper.sfab-open .sfab-action:nth-child(3) { transition-delay: 0.12s; }
.sfab-wrapper.sfab-open .sfab-action:nth-child(4) { transition-delay: 0.16s; }
.sfab-wrapper.sfab-open .sfab-action:nth-child(5) { transition-delay: 0.20s; }
.sfab-wrapper.sfab-open .sfab-action:nth-child(6) { transition-delay: 0.24s; }

/* ============================================================
   7. ⭐ Paid Service – Premium Styling
   ============================================================ */

.sfab-action-premium {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFF3CD 100%);
    border: 2px solid #D4A017;
}

.sfab-action-premium .sfab-label {
    color: #8B6914;
    font-weight: 700;
    font-size: 13.5px;
}

.sfab-action-premium .sfab-icon-circle {
    background: linear-gradient(135deg, #F1C40F 0%, #D4A017 50%, #B8860B 100%);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.5);
    font-size: 20px;
}

@keyframes sfab-shimmer {
    0%   { box-shadow: 0 0 6px rgba(241, 196, 15, 0.4); }
    50%  { box-shadow: 0 0 18px rgba(241, 196, 15, 0.9); }
    100% { box-shadow: 0 0 6px rgba(241, 196, 15, 0.4); }
}

.sfab-wrapper.sfab-open .sfab-action-premium .sfab-icon-circle {
    animation: sfab-shimmer 2s ease-in-out infinite;
}

.sfab-action-premium:hover {
    border-color: #B8860B;
    background: linear-gradient(135deg, #FFF3CD 0%, #FFE082 100%);
}

/* Random badge on Paid Service */
.sfab-random-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #25D366;
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    line-height: 1.3;
    z-index: 2;
}

/* ============================================================
   8. Device Visibility
   ============================================================ */

.sfab-device-desktop { display: flex; }
@media (max-width: 782px) {
    .sfab-device-desktop { display: none !important; }
}
.sfab-device-mobile { display: none; }
@media (max-width: 782px) {
    .sfab-device-mobile { display: flex !important; }
}
.sfab-device-both { display: flex; }

/* ============================================================
   9. Mobile Responsive
   ============================================================ */

@media (max-width: 782px) {
    .sfab-pos-bottom-right,
    .sfab-pos-bottom-left { bottom: 22px; }
    .sfab-pos-top-right,
    .sfab-pos-top-left { top: 22px; }
    .sfab-pos-bottom-right { right: 14px; }
    .sfab-pos-bottom-left  { left: 14px; }
    .sfab-pos-top-right    { right: 14px; }
    .sfab-pos-top-left     { left: 14px; }

    .sfab-toggle {
        width: 54px;
        height: 54px;
        font-size: 22px;
    }

    .sfab-cta {
        padding: 6px 14px;
        font-size: 12px;
        max-width: 160px;
    }

    .sfab-action { height: 44px; }

    .sfab-icon-circle {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 18px;
    }

    .sfab-label {
        font-size: 12px;
        padding: 0 12px 0 14px;
        line-height: 44px;
    }

    .sfab-labels-right .sfab-label {
        padding: 0 14px 0 12px;
    }

    .sfab-actions { gap: 10px; }
}

@media (max-width: 380px) {
    .sfab-label {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sfab-cta {
        max-width: 130px;
        font-size: 11px;
    }
}

/* ============================================================
   10. Overlay
   ============================================================ */

.sfab-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sfab-overlay.sfab-overlay-active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   11. Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .sfab-toggle,
    .sfab-actions,
    .sfab-action,
    .sfab-overlay,
    .sfab-icon-circle,
    .sfab-cta,
    .sfab-cta-inner,
    .sfab-cta-cursor {
        transition: none !important;
        animation: none !important;
    }
}