﻿/* ═══════════════════════════════════════════════════
   Support Chat (FAB + Popup)
   ═══════════════════════════════════════════════════ */

/* FAB */
.msg-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: #fff;
    border: none;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
}

    .msg-fab:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 12px 32px rgba(79, 70, 229, 0.5);
    }

    .msg-fab:active {
        transform: translateY(-1px) scale(0.98);
    }

.msg-fab-icon {
    font-size: 20px;
}

.msg-fab-label {
    white-space: nowrap;
}

.msg-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #EF4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .msg-fab {
        bottom: 16px;
        left: 16px;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .msg-fab-label {
        display: none;
    }

    .msg-fab-icon {
        font-size: 24px;
    }
}

/* Popup */
.msg-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.25s;
    backdrop-filter: blur(0px);
}

    .msg-popup-overlay.visible {
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(4px);
    }

.support-chat-panel {
    width: 90vw;
    max-width: 520px;
    height: 80vh;
    max-height: 700px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg-popup-overlay.visible .support-chat-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.msg-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: #fff;
}

.msg-popup-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 15px;
}

.msg-popup-header-icon {
    font-size: 26px;
}

.msg-popup-sub {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

.msg-popup-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
}

    .msg-popup-close:hover {
        background: rgba(255, 255, 255, 0.35);
    }

/* Messages */
.messaging-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: radial-gradient(circle at 10% 20%, rgba(99,102,241,0.04), transparent 40%), radial-gradient(circle at 90% 80%, rgba(139,92,246,0.04), transparent 40%), #F9FAFB;
}

.messaging-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 13.5px;
    gap: 10px;
}

.messaging-empty-icon {
    font-size: 48px;
    opacity: 0.4;
}

.msg-bubble-row {
    display: flex;
}

    .msg-bubble-row.out {
        justify-content: flex-start;
    }

    .msg-bubble-row.in {
        justify-content: flex-end;
    }

.msg-bubble {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    font-size: 13px;
    line-height: 1.65;
    word-wrap: break-word;
}

    .msg-bubble.in {
        background: #fff;
        border: 1px solid #E5E7EB;
        border-bottom-left-radius: 4px;
    }

    .msg-bubble.out {
        background: linear-gradient(135deg, #4F46E5, #6366F1);
        color: #fff;
        border-bottom-right-radius: 4px;
    }

.msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    direction: ltr;
    text-align: left;
}

.msg-bubble.out .msg-time {
    color: rgba(255,255,255,0.85);
}

.msg-bubble.in .msg-time {
    color: #9ca3af;
}

/* Send box */
.messaging-send-box {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

    .messaging-send-box textarea {
        flex: 1;
        resize: none;
        border: 1.5px solid #E5E7EB;
        border-radius: 10px;
        padding: 9px 12px;
        font-family: inherit;
        font-size: 13px;
        line-height: 1.6;
        max-height: 120px;
        outline: none;
        transition: border-color 0.15s;
        background: #F9FAFB;
    }

        .messaging-send-box textarea:focus {
            border-color: #6366F1;
            background: #fff;
        }

    .messaging-send-box .btn {
        min-width: 88px;
        height: 40px;
        padding: 0 18px;
    }

@media (max-width: 768px) {
    .msg-popup-overlay {
        padding: 0;
    }

    .support-chat-panel {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}
