/* ============================================
   Communication Floating Button - Orange Moon
   ============================================ */

.communication-floating-btn {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    left: calc(30px + env(safe-area-inset-left, 0px));
    z-index: 999;
    direction: rtl;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* iOS Safari rendering stability for fixed elements */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

/* Hide communication button when gallery is open */
body.gallery-open .communication-floating-btn {
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.communication-floating-btn .comm-main-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

.communication-floating-btn .comm-main-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FF8C42 0%, #FFB84D 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.communication-floating-btn .comm-main-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.45);
}

.communication-floating-btn .comm-main-btn:hover::before {
    opacity: 1;
}

.communication-floating-btn .comm-main-btn:active {
    transform: scale(0.95);
}

.communication-floating-btn .comm-icon {
    position: relative;
    z-index: 2;
    filter: brightness(0) invert(1); /* Convert black SVG to white */
    transition: all 0.3s ease;
    object-fit: contain;
}

.communication-floating-btn .comm-icon-close {
    position: relative;
    z-index: 2;
    color: #ffffff;
    transition: all 0.3s ease;
}

.communication-floating-btn .comm-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.communication-floating-btn.active .comm-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.communication-floating-btn.active .comm-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Options Box */
.communication-floating-btn .comm-options-box {
    position: absolute;
    bottom: 75px;
    left: 0;
    background: #ffffff;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 260px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 107, 53, 0.1);
}

.communication-floating-btn.active .comm-options-box {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Communication Option Item */
.communication-floating-btn .comm-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.communication-floating-btn .comm-option:last-child {
    margin-bottom: 0;
}

.communication-floating-btn .comm-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05) 0%, rgba(255, 140, 66, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.communication-floating-btn .comm-option:hover::before {
    opacity: 1;
}

.communication-floating-btn .comm-option:hover {
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Phone Option */
.communication-floating-btn .phone-option {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.communication-floating-btn .phone-option:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(37, 99, 235, 0.12) 100%);
    border-color: rgba(59, 130, 246, 0.25);
}

/* WhatsApp Option */
.communication-floating-btn .whatsapp-option {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border: 1px solid rgba(37, 211, 102, 0.15);
}

.communication-floating-btn .whatsapp-option:hover {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.12) 0%, rgba(16, 185, 129, 0.12) 100%);
    border-color: rgba(37, 211, 102, 0.25);
}

/* Option Icon */
.communication-floating-btn .comm-option-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.communication-floating-btn .phone-option .comm-option-icon {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #ffffff;
}

.communication-floating-btn .phone-option .comm-option-icon img {
    filter: brightness(0) invert(1); /* Convert black SVG to white */
    object-fit: contain;
}

.communication-floating-btn .whatsapp-option .comm-option-icon {
    background: linear-gradient(135deg, #25D366 0%, #10B981 100%);
    color: #ffffff;
}

.communication-floating-btn .whatsapp-option .comm-option-icon img {
    filter: brightness(0) invert(1); /* Convert black SVG to white */
    object-fit: contain;
}

.communication-floating-btn .comm-option:hover .comm-option-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Option Text */
.communication-floating-btn .comm-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.communication-floating-btn .comm-option-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.communication-floating-btn .comm-option-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.4;
    direction: ltr;
    text-align: right;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

/* Responsive Design */
@media (max-width: 768px) {
    .communication-floating-btn {
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
        left: calc(20px + env(safe-area-inset-left, 0px));
    }

    .communication-floating-btn .comm-main-btn {
        width: 56px;
        height: 56px;
    }

    .communication-floating-btn .comm-options-box {
        min-width: 240px;
        bottom: 70px;
    }

    .communication-floating-btn .comm-option {
        padding: 12px 14px;
    }

    .communication-floating-btn .comm-option-icon {
        width: 38px;
        height: 38px;
    }

    .communication-floating-btn .comm-option-title {
        font-size: 14px;
    }

    .communication-floating-btn .comm-option-subtitle {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .communication-floating-btn {
        bottom: calc(85px + env(safe-area-inset-bottom, 0px));
        left: calc(15px + env(safe-area-inset-left, 0px));
    }

    .communication-floating-btn .comm-main-btn {
        width: 52px;
        height: 52px;
    }

    .communication-floating-btn .comm-options-box {
        min-width: 220px;
        padding: 10px;
    }
}

/* Animation Delays for Options */
.communication-floating-btn.active .comm-option:nth-child(1) {
    animation: slideInUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.1s both;
}

.communication-floating-btn.active .comm-option:nth-child(2) {
    animation: slideInUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s both;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Animation on Load */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
    }
    50% {
        box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35), 0 0 0 10px rgba(255, 107, 53, 0.1), 0 0 0 20px rgba(255, 107, 53, 0.05);
    }
    100% {
        box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
    }
}

.communication-floating-btn .comm-main-btn {
    animation: pulse 2s ease-in-out 3;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .communication-floating-btn .comm-options-box {
        background: #1f2937;
        border-color: rgba(255, 107, 53, 0.2);
    }

    .communication-floating-btn .comm-option-title {
        color: #f9fafb;
    }

    .communication-floating-btn .comm-option-subtitle {
        color: #9ca3af;
    }
}
