/**
 * Social Float - Frontend Styles
 * Modern, responsive floating social media buttons
 * @package Social_Float
 * @since 1.0.0
 */

/* ========================================
   Base Styles
   ======================================== */
.social-float {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.social-float * {
    box-sizing: border-box;
}

/* ========================================
   Main Button
   ======================================== */
.sf-main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Dynamic size - controlled by inline CSS */
    border-radius: 50%;
    border: none;
    background: #25d366;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

.sf-main-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.sf-main-btn:active {
    transform: scale(0.95);
}

.sf-main-btn svg {
    /* Dynamic size - controlled by inline CSS */
    fill: currentColor;
    flex-shrink: 0;
}

.sf-main-btn img {
    /* Dynamic size - controlled by inline CSS */
    border-radius: 0;
    flex-shrink: 0;
}

/* Active state */
.social-float.active .sf-main-btn {
    transform: rotate(45deg) scale(0.9);
}

/* ========================================
   Sub Buttons Container
   ======================================== */
.sf-sub-buttons {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    min-width: fit-content;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-float.active .sf-sub-buttons {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Position based on settings */
.sf-pos-bottom-left .sf-sub-buttons,
.sf-pos-bottom-right .sf-sub-buttons {
    bottom: calc(100% + 12px);
    flex-direction: column-reverse;
}

.sf-pos-top-left .sf-sub-buttons,
.sf-pos-top-right .sf-sub-buttons {
    top: calc(100% + 12px);
    flex-direction: column;
}

/* LEFT positioned: center align sub-buttons */
.sf-pos-bottom-left .sf-sub-buttons,
.sf-pos-top-left .sf-sub-buttons {
    left: 0;
    align-items: flex-start;
}

/* RIGHT positioned: center align sub-buttons */
.sf-pos-bottom-right .sf-sub-buttons,
.sf-pos-top-right .sf-sub-buttons {
    right: 0;
    align-items: flex-end;
}

/* ========================================
   Sub Buttons
   ======================================== */
.sf-sub-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px);
    opacity: 0;
}

.social-float.active .sf-sub-btn {
    transform: translateY(0);
    opacity: 1;
}

/* Stagger animation */
.social-float.active .sf-sub-btn:nth-child(1) {
    transition-delay: 0.05s;
}

.social-float.active .sf-sub-btn:nth-child(2) {
    transition-delay: 0.1s;
}

.social-float.active .sf-sub-btn:nth-child(3) {
    transition-delay: 0.15s;
}

.social-float.active .sf-sub-btn:nth-child(4) {
    transition-delay: 0.2s;
}

.social-float.active .sf-sub-btn:nth-child(5) {
    transition-delay: 0.25s;
}

.sf-sub-btn:hover {
    transform: scale(1.05);
}

/* Left positioned buttons hover */
.sf-pos-bottom-left .sf-sub-btn:hover,
.sf-pos-top-left .sf-sub-btn:hover {
    transform: translateX(-3px) scale(1.02);
}

/* Right positioned buttons hover */
.sf-pos-bottom-right .sf-sub-btn:hover,
.sf-pos-top-right .sf-sub-btn:hover {
    transform: translateX(3px) scale(1.02);
}

/* Remove old conflicting hover rule */
/* .sf-pos-bottom-right .sf-sub-btn:hover,
.sf-pos-top-right .sf-sub-btn:hover {
    transform: translateX(5px);
} */

/* Button Icon */
.sf-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Dynamic size - controlled by inline CSS */
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.sf-sub-btn:hover .sf-btn-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.sf-btn-icon svg {
    /* Dynamic size - controlled by inline CSS */
    fill: currentColor;
    flex-shrink: 0;
    display: block;
    margin: auto;
}

.sf-btn-icon img {
    /* Dynamic size - controlled by inline CSS */
    border-radius: 0;
    display: block;
    margin: auto;
    flex-shrink: 0;
}

/* Button Label */
.sf-btn-label {
    background: #333333;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* 🔧 FIX: Sub-button flex direction based on position */
.sf-sub-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px);
    opacity: 0;
}

/* LEFT positioned: Icon first, then label (label appears on right) */
.sf-pos-bottom-left .sf-sub-btn,
.sf-pos-top-left .sf-sub-btn {
    flex-direction: row; /* Icon | Label */
}

.sf-pos-bottom-left .sf-btn-label,
.sf-pos-top-left .sf-btn-label {
    transform: translateX(10px);
}

/* RIGHT positioned: Label first, then icon (label appears on left of icon) */
.sf-pos-bottom-right .sf-sub-btn,
.sf-pos-top-right .sf-sub-btn {
    flex-direction: row-reverse; /* Label | Icon */
}

.sf-pos-bottom-right .sf-btn-label,
.sf-pos-top-right .sf-btn-label {
    transform: translateX(-10px);
}

.sf-pos-bottom-left .sf-sub-btn:hover .sf-btn-label,
.sf-pos-top-left .sf-sub-btn:hover .sf-btn-label {
    opacity: 1;
    transform: translateX(0);
}

.sf-pos-bottom-right .sf-sub-btn:hover .sf-btn-label,
.sf-pos-top-right .sf-sub-btn:hover .sf-btn-label {
    opacity: 1;
    transform: translateX(0);
}

/* Remove old conflicting hover rule */
.sf-sub-btn:hover .sf-btn-label {
    opacity: 1;
    transform: translateX(0) !important;
}

/* ========================================
   Overlay
   ======================================== */
.sf-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.social-float.active .sf-overlay {
    display: block;
    opacity: 1;
}

/* ========================================
   Animation Variants
   ======================================== */

/* Fade Animation */
.sf-animation-fade.active .sf-sub-btn {
    animation: fadeInUp 0.3s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Animation */
.sf-animation-slide.active .sf-sub-btn {
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sf-pos-bottom-right.sf-animation-slide.active .sf-sub-btn,
.sf-pos-top-right.sf-animation-slide.active .sf-sub-btn {
    animation: slideInRight 0.3s forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animation */
.sf-animation-scale.active .sf-sub-btn {
    animation: scaleIn 0.3s forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Platform Specific Colors
   ======================================== */
.sf-btn-whatsapp .sf-btn-icon {
    background: #25d366;
}

.sf-btn-telegram .sf-btn-icon {
    background: #0088cc;
}

.sf-btn-facebook .sf-btn-icon {
    background: #1877f2;
}

.sf-btn-instagram .sf-btn-icon {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.sf-btn-twitter .sf-btn-icon {
    background: #1da1f2;
}

.sf-btn-linkedin .sf-btn-icon {
    background: #0077b5;
}

.sf-btn-youtube .sf-btn-icon {
    background: #ff0000;
}

.sf-btn-tiktok .sf-btn-icon {
    background: #000000;
}

.sf-btn-viber .sf-btn-icon {
    background: #665cac;
}

.sf-btn-email .sf-btn-icon {
    background: #ea4335;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .sf-btn-label {
        display: none;
    }
    
    .sf-sub-buttons {
        gap: 10px;
    }
    
    .sf-pos-bottom-left .sf-sub-buttons,
    .sf-pos-bottom-right .sf-sub-buttons {
        bottom: 70px;
    }
    
    .sf-pos-top-left .sf-sub-buttons,
    .sf-pos-top-right .sf-sub-buttons {
        top: 70px;
    }
}

@media (max-width: 480px) {
    .sf-btn-label {
        display: none;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.sf-main-btn:focus,
.sf-sub-btn:focus {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

.sf-main-btn:focus:not(:focus-visible),
.sf-sub-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .social-float,
    .sf-main-btn,
    .sf-sub-btn,
    .sf-btn-icon,
    .sf-btn-label,
    .sf-overlay {
        animation: none !important;
        transition: none !important;
    }
}

/* ========================================
   Single Button Mode
   ======================================== */
.social-float-single {
    position: fixed;
    z-index: 99999;
    text-decoration: none;
}

.sf-single-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Dynamic size - controlled by inline CSS */
    border-radius: 50%;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sf-single-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.sf-single-btn:active {
    transform: scale(0.95);
}

.sf-single-btn svg {
    /* Dynamic size - controlled by inline CSS */
    fill: currentColor;
    flex-shrink: 0;
}

.sf-single-btn img {
    /* Dynamic size - controlled by inline CSS */
    border-radius: 0;
    flex-shrink: 0;
}

/* Responsive for single mode */
@media (max-width: 768px) {
    /* Sizes controlled by inline CSS from admin settings */
}

@media (max-width: 480px) {
    /* Sizes controlled by inline CSS from admin settings */
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .social-float,
    .social-float-single {
        display: none !important;
    }
}
