/* pop Messaging Custom Styles */

/* Styles spécifiques pour l'aspect "App Native" */
#pop-messaging-container {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

/* Masquer la barre de défilement tout en permettant le défilement */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animations de transition entre les vues */
.view-container {
    transition: transform 0.3s ease-in-out;
}

#view-chat {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 50;
    /* Ensure it's above everything */
}

#view-chat.active {
    transform: translateX(0) !important;
}

.slide-in-right {
    animation: slideInRight 0.3s forwards;
}

.slide-out-right {
    animation: slideOutRight 0.3s forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

/* Bulles de message */
.msg-bubble {
    /* REMOVED max-width: 75%; handled by JS wrapper */
    word-wrap: break-word;
    /* legacy support */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.msg-me {
    background-color: #2563EB;
    color: white;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
}

.msg-other {
    background-color: #F3F4F6;
    color: #1F2937;
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
}

/* Input area focus ring fix */
input:focus,
textarea:focus {
    outline: none;
}

/* Loading spinner */
.pop-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2563EB;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty state */
.pop-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9CA3AF;
}

.pop-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Fix pour éviter que l'input soit caché derrière la navbar */
#messages-container {
    padding-bottom: 140px !important;
    /* Espace pour le footer + navbar */
}

#view-chat footer {
    margin-bottom: 64px;
    /* Hauteur de la navbar (environ 64px) */
}

/* GIF Grid */
.giphy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.giphy-grid img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

/* Sur mobile, ajuster si nécessaire */
@media (max-width: 768px) {
    #messages-container {
        padding-bottom: 160px !important;
    }

    #view-chat footer {
        margin-bottom: 80px;
    }
}

/* Prevenir les images cassées dans le header */
#active-chat-avatar[src=""],
#active-chat-avatar:not([src]) {
    display: none !important;
}

#active-chat-avatar-container:empty {
    display: none;
}

/* === GROUP CHAT ENHANCEMENTS === */

/* Group Avatars Grid */
.group-avatar-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    background-color: #F3F4F6;
    border: 1px solid #E5E7EB;
    overflow: hidden;
}

.group-avatar-grid img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border: 0.5px solid white;
}

.group-avatar-remaining {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #D1D5DB;
    color: #4B5563;
    font-size: 10px;
    font-weight: bold;
}

/* Sender names in bubbles */
.msg-sender-name {
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 2px;
    margin-left: 4px;
}

/* Modal Animations */
#members-overlay {
    transition: opacity 0.3s ease;
}

#members-content {
    transition: transform 0.3s ease;
}