/* ========================================
   SOCIAL SIDEBAR - FIXED VERSION
   شريط التواصل الجانبي - نسخة محسّنة
   ======================================== */

/* ========================================
   SOCIAL SIDEBAR MAIN
   ======================================== */
.social-sidebar {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.social-sidebar-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    border: none;
    outline: none;
}

.social-sidebar-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Tooltip */
.social-sidebar-item::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.social-sidebar-item::after {
    content: '';
    position: absolute;
    right: calc(100% + 4px);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.social-sidebar-item:hover::before,
.social-sidebar-item:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Scroll to Top Button */
.social-sidebar-item.scroll-top {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s;
}

.social-sidebar-item.scroll-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.social-sidebar-item.scroll-top:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Email Button */
.social-sidebar-item.email {
    background: linear-gradient(135deg, #FF6B6B 0%, #C92A2A 100%);
}

.social-sidebar-item.email:hover {
    background: linear-gradient(135deg, #C92A2A 0%, #FF6B6B 100%);
}

/* WhatsApp Button */
.social-sidebar-item.whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.social-sidebar-item.whatsapp:hover {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

/* Skype Button */
.social-sidebar-item.skype {
    background: linear-gradient(135deg, #00AFF0 0%, #0078D7 100%);
}

.social-sidebar-item.skype:hover {
    background: linear-gradient(135deg, #0078D7 0%, #00AFF0 100%);
}

/* WeChat Button */
.social-sidebar-item.wechat {
    background: linear-gradient(135deg, #09B83E 0%, #07A038 100%);
}

.social-sidebar-item.wechat:hover {
    background: linear-gradient(135deg, #07A038 0%, #09B83E 100%);
}

/* ========================================
   WECHAT MODAL - FIXED VERSION
   ======================================== */
.wechat-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wechat-modal.active {
    display: flex;
    opacity: 1;
}

.wechat-modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.wechat-modal.active .wechat-modal-content {
    transform: scale(1);
}

.wechat-modal-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wechat-modal-content img {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin: 0 auto 1.5rem;
    border: 3px solid #09B83E;
    border-radius: 16px;
    padding: 1rem;
    background: white;
    display: block;
    box-shadow: 0 4px 12px rgba(9, 184, 62, 0.15);
}

.wechat-modal-content p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0.75rem 0;
}

.wechat-modal-content p:last-child {
    margin-top: 1.25rem;
    font-weight: 600;
    color: #09B83E;
    font-size: 1.125rem;
    padding: 1rem;
    background: rgba(9, 184, 62, 0.08);
    border-radius: 12px;
    border: 1px dashed #09B83E;
}

.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    transition: all 0.3s;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 300;
}

.close-modal:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #e74c3c;
    transform: rotate(90deg);
}

.close-modal:active {
    transform: rotate(90deg) scale(0.95);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .social-sidebar {
        right: 15px;
        bottom: 15px;
        gap: 10px;
    }

    .social-sidebar-item {
        width: 46px;
        height: 46px;
        font-size: 1.125rem;
    }

    /* إخفاء tooltips على الموبايل */
    .social-sidebar-item::before,
    .social-sidebar-item::after {
        display: none;
    }

    .wechat-modal-content {
        padding: 2rem;
        max-width: 95%;
        border-radius: 20px;
    }

    .wechat-modal-content h3 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .wechat-modal-content img {
        max-width: 240px;
        padding: 0.75rem;
    }

    .wechat-modal-content p {
        font-size: 0.9375rem;
    }

    .close-modal {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .social-sidebar {
        right: 10px;
        bottom: 10px;
        gap: 8px;
    }

    .social-sidebar-item {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .wechat-modal {
        padding: 15px;
    }

    .wechat-modal-content {
        padding: 1.5rem;
    }

    .wechat-modal-content h3 {
        font-size: 1.25rem;
    }

    .wechat-modal-content img {
        max-width: 200px;
    }

    .wechat-modal-content p:last-child {
        font-size: 1rem;
        padding: 0.875rem;
    }
}

/* ========================================
   TOUCH DEVICES OPTIMIZATION
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    .social-sidebar-item {
        min-width: 48px;
        min-height: 48px;
    }

    .social-sidebar-item:active {
        transform: scale(0.95);
    }

    .close-modal {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .social-sidebar,
    .wechat-modal {
        display: none !important;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wechat-modal.active {
    animation: fadeIn 0.3s ease;
}

.wechat-modal.active .wechat-modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.social-sidebar-item:focus {
    outline: 3px solid #0066FF;
    outline-offset: 3px;
}

.close-modal:focus {
    outline: 2px solid #0066FF;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .social-sidebar-item {
        border: 2px solid white;
    }

    .wechat-modal-content {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .social-sidebar-item,
    .wechat-modal,
    .wechat-modal-content,
    .close-modal {
        transition: none;
        animation: none;
    }
}