/**
 * استایل فرانت‌اند منوی شناور شبکه‌های اجتماعی
 */

/* کانتینر اصلی - سمت راست */
#wafm-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    direction: rtl;
}

#wafm-toggle {
    touch-action: pan-y !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* لیست آیتم‌ها */
#wafm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* وقتی منو باز است */
#wafm-wrap.wafm-open #wafm-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* هر آیتم */
#wafm-list li {
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* انیمیشن ظاهر شدن آیتم‌ها با تاخیر */
#wafm-wrap.wafm-open #wafm-list li:nth-child(1) {
    transform: scale(1);
    transition-delay: 0.05s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(2) {
    transform: scale(1);
    transition-delay: 0.1s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(3) {
    transform: scale(1);
    transition-delay: 0.15s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(4) {
    transform: scale(1);
    transition-delay: 0.2s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(5) {
    transform: scale(1);
    transition-delay: 0.25s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(6) {
    transform: scale(1);
    transition-delay: 0.3s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(7) {
    transform: scale(1);
    transition-delay: 0.35s;
}

#wafm-wrap.wafm-open #wafm-list li:nth-child(8) {
    transform: scale(1);
    transition-delay: 0.4s;
}

/* لینک آیتم */
.wafm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.wafm-row:hover {
    transform: translateX(5px);
}

/* دکمه آیکون */
.wafm-item-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.wafm-item-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.wafm-item-btn svg {
    width: 24px;
    height: 24px;
}

/* لیبل */
.wafm-label {
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.wafm-row:hover .wafm-label {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

/* دکمه تاگل اصلی */
#wafm-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

#wafm-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#wafm-toggle:hover::before {
    opacity: 1;
}

#wafm-toggle:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

#wafm-toggle:active {
    transform: scale(0.95);
}

#wafm-toggle svg {
    width: 28px;
    height: 28px;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* چرخش آیکون وقتی منو باز است */
#wafm-wrap.wafm-open #wafm-toggle svg {
    transform: rotate(180deg);
}

/* رسپانسیو برای موبایل */
@media (max-width: 768px) {
    #wafm-wrap {
        bottom: 15px;
        right: 15px;
    }
    
    .wafm-item-btn {
        width: 45px;
        height: 45px;
    }
    
    .wafm-item-btn svg {
        width: 22px;
        height: 22px;
    }
    
    #wafm-toggle {
        width: 60px;
        height: 60px;
    }
    
    #wafm-toggle svg {
        width: 28px;
        height: 28px;
    }
    
    .wafm-label {
        font-size: 11px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    #wafm-wrap {
        bottom: 10px;
        right: 10px;
    }
    
    .wafm-item-btn {
        width: 40px;
        height: 40px;
    }
    
    .wafm-item-btn svg {
        width: 20px;
        height: 20px;
    }
    
    #wafm-toggle {
        width: 64px;
        height: 64px;
    }
    
    #wafm-toggle svg {
        width: 28px;
        height: 28px;
    }
    
    .wafm-label {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    #wafm-list {
        gap: 8px;
    }
}

/* انیمیشن‌های اضافی */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

#wafm-toggle:focus {
    outline: none;
    animation: pulse 1s ease-in-out;
}

/* برای راست به چپ */
[dir="ltr"] #wafm-wrap {
    left: auto;
    right: 20px;
}

[dir="ltr"] .wafm-row:hover {
    transform: translateX(5px);
}

[dir="ltr"] .wafm-label {
    transform: translateX(-10px);
}

[dir="ltr"] .wafm-row:hover .wafm-label {
    transform: translateX(0);
}

@media (max-width: 768px) {
    [dir="ltr"] #wafm-wrap {
        right: 15px;
    }
}

@media (max-width: 480px) {
    [dir="ltr"] #wafm-wrap {
        right: 10px;
    }
}

/* دسترسی‌پذیری */
.wafm-item-btn:focus,
#wafm-toggle:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* حالت تاریک */
@media (prefers-color-scheme: dark) {
    .wafm-label {
        background: #2d3748;
        color: #f7fafc;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* افکت‌های اضافی برای دکمه تاگل */
#wafm-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
    opacity: 0;
    transform: scale(1);
    animation: ripple 2s ease-out infinite;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* حالت بارگذاری */
.wafm-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ترانزیشن نرم برای تغییرات */
* {
    -webkit-tap-highlight-color: transparent;
}

/* دکمه toggle ساده */
#wafm-toggle {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    cursor: pointer;
}
