:root{
    --chat-background-color: #f9f9f9;
    --chat-border-color: var(--theme-border-color);
    --chat-background-color-from-message: #CEE8FF; 
}

/* ----------------
MENU CHAT APERTE
----------------------------- */
.container-chat .ui-menuitem-link{ border-radius: 8px !important; padding: 5px 10px !important; }
.container-chat .ui-menu{ width: 100%; border: none; }

.container-chat .sipal-chat-containerPreview .sipal-chat-containerPreview-content{
    width: calc(100% - 30px);
}

.container-chat .sipal-chat-containerPreview .sipal-chat-containerPreview-icon{
    background: var(--chat-background-color);
    border: 1px solid var(--chat-border-color);
    height: 30px;
    width: 30px;
    border-radius: 6px;
}

.layout-menu-dark .container-chat .sipal-chat-containerPreview .sipal-chat-containerPreview-icon{
    background: var(--surface-100);
}

.container-chat .sipal-chat-containerPreview .ui-badge{ top: auto !important; bottom: 0; right: 0 !important; transform: translate(20%, 20%) !important; }

.container-chat .sipal-chat-containerPreview .sipal-chat-containerPreview-content .sipal-chat-containerPreview-content-messageContainer{
    width: calc(100% - 30px);
    overflow: hidden;
}

.container-chat .sipal-chat-containerPreview .sipal-chat-containerPreview-content .sipal-chat-containerPreview-content-messageContainer .sipal-chat-containerPreview-content-message *[class*='mgg-icons']{
    font-size: 15px;
}

.sipal-chat-containerPreview-content-message-text{ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.container-rooms{
    height: 50%;
}

.container-rooms .container-rooms-list{
    flex-grow: 1; overflow: auto;
}



/* ----------------
CHAT
----------------------------- */
.sipal-widget-header-chat{
    padding: 15px;
    flex-basis: 40px;
}

.sipal-widget-header-chat .ui-overlay-badge{
    display: flex;
    align-items: center;
    gap: 10px;
}

.sipal-widget-header-chat .ui-overlay-badge .ui-badge{
    position: relative !important;
    transform: none !important;
}

.sipal-widget-chat{
    padding: 10px 20px;
    flex-grow: 1;
    overflow: auto;
}

.sipal-widget-footer-chat{
    position: relative;
    padding: 15px;
}

.sipal-chat-container-day-messages{
    text-align: center;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    position: sticky;
    top: 0;
    margin: 0 auto 20px;
    width: 60%;
    z-index: 3;
}

.sipal-chat-container-day-messages .sipal-chat-container-day-messages-text{
    padding: 0.55rem 2rem;
    background: var(--chat-background-color);
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    font-size: 12px;
    border-radius: 100vmax;
    display: inline-block;
}

.layout-menu-dark .sipal-chat-container-day-messages .sipal-chat-container-day-messages-text{
    background: var(--surface-100);
}

body .topbarChatBadgeContainer .ui-badge{
    width: 0.75rem;
    height: 0.75rem;
    top: 7px;
    right: 7px;
}

/* ----------------
MESSAGGI
----------------------------- */
.sipal-message-container{
    width: 100%;
    display: flex;
    align-items: start;
}

.sipal-message-container .sipal-message-content{ width: 100%; gap: 10px; }

.sipal-message-container .sipal-message{
    max-width: 500px;
    padding: 8px 10px;
    border-radius: 15px;
    position: relative;
    overflow-wrap: break-word;
    z-index: 1;
}

.sipal-message-container .sipal-message .sipal-message-read{ line-height: 0; }

.sipal-message-container.sipal-message-own .sipal-message{ background: var(--chat-background-color-from-message); }
.layout-menu-dark .sipal-message-container.sipal-message-own .sipal-message{ background: var(--primary-color); }

.sipal-message-container.sipal-message-from .sipal-message{ background: var(--chat-background-color); }
.layout-menu-dark .sipal-message-container.sipal-message-from .sipal-message{ background: var(--surface-100); }

.sipal-message-own .sipal-message-content{ justify-content: end; }
.sipal-message-from .sipal-message-content{ justify-content: start; }

.sipal-message-container.sipal-message-from{
    justify-content: start;
    padding: 10px 20px 0 0;
}

.sipal-message-container.sipal-message-from .sipal-message{
    border-top-left-radius: 0;
}

.sipal-message-container.sipal-message-own{
    padding: 10px 0 0 20px;
}
.sipal-message-container.sipal-message-own .sipal-message{
    border-bottom-right-radius: 0;
}

.sipal-message-container.sipal-message-from .sipal-message::before{
    border-top-left-radius: 0;
}

.sipal-message-container.sipal-message-own .sipal-message::before{
    border-bottom-right-radius: 0;
}

.sipal-message-container .sipal-message-date{
    font-size: 12px;
    display: block;
    color: var(--surface-500);
}

.sipal-message-container.sipal-message-own .sipal-message-date{
    text-align: right;
    color: var(--surface-700);
}

.sipal-message-read{
    font-size: 20px;
    opacity: .4;
}

.sipal-message-readed .sipal-message-read{
    opacity: 1;
    color: var(--primary-color);
}

.layout-menu-dark .sipal-message-readed .sipal-message .sipal-message-read{
    color: var(--primary-800);
}

.sipal-message-container.sipal-message-own .sipal-message-footer{
    justify-content: end;
}
.sipal-message-container.sipal-message-from .sipal-message-footer{
    flex-direction: row-reverse;
    justify-content: start;
}

.sipal-message-content{
    transition: .2s ease-in-out !important;
}

@media(max-width: 767px){
    .sipal-message-container .sipal-message{
        max-width: 100%;
    }
}



/* ----------
CONTAINER PARENT MESSAGE
-------------------------------------- */
.sipal-parent-message{
    background: var(--surface-100);
    border-radius: 10px;
    min-width: 150px;
}

.layout-menu-dark .sipal-parent-message{
    background: var(--surface-50);
}

.sipal-message .sipal-parent-message{ width: calc(100% + 10px); background: var(--surface-200);}

.sipal-parent-message-title{ color: var(--primary-color); font-weight: bold; display: block; }

.sipal-parent-message-text{ color: var(--surface-600); }
.layout-menu-dark .sipal-message-own .sipal-parent-message-text{ color: var(--surface-200); }

.sipal-parent-message-text.sipal-parent-message-text-deleted{ font-style: italic; color: rgba(0, 0, 0, .45) !important; }


.sipal-message-own .sipal-parent-message{ background: rgba(255, 255, 255, .5); transform: translateX(-5px); }

.sipal-message-from .sipal-parent-message{ transform: translateX(-5px); }


/* ----------
CONTAINER ALLEGATO MESSAGGIO
-------------------------------------- */
.sipal-chat-attachment{
    position: relative;
    width: 200px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--chat-border-color);
}

.layout-menu-dark .sipal-message .sipal-chat-attachment{ border-color: transparent; }

.sipal-message-content .sipal-chat-attachment{ background: rgba(0, 0, 0, .04); }
.sipal-message-own .sipal-message-content .sipal-chat-attachment{ background: rgba(255, 255, 255, .4); }

.sipal-chat-attachment .sipal-chat-attachment-name{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sipal-chat-attachment .sipal-chat-attachment-close{position: absolute;right: 5px;}
.sipal-chat-attachment:has(img) .sipal-chat-attachment-close{top: 5px;}


/* ----------
CONTAINER INVIO MESSAGGIO
-------------------------------------- */
.sipal-chat-message-area{ position: relative; transition: .2s ease-in-out !important; border: 1px solid var(--chat-border-color); border-radius: 4px; }

.sipal-chat-message-area.ui-state-drag { background: var(--chat-background-color); } /* giallo */
.sipal-chat-message-area-input{ width: 100% !important; border: none !important; box-shadow: none !important; background: transparent !important; }

.sipal-chat-message-area .sipal-chat-attachment{
    width: 250px;
}

.sipal-chat-message-information{ gap: 5px; }
.sipal-chat-message-information *{ font-style: italic; color: rgba(0, 0, 0, .6); font-size: 12px !important; }



/* ----------
CONTAINER ANIMAZIONE DIGITAZIONE
-------------------------------------- */
.sipal-chat-typing-user{ display: none; }
.sipal-widget-footer-chat .sipal-chat-typing-user{ position: absolute; top: 0; left: 25px; transform: translateY(50%); }

.sipal-chat-typing-user .sipal-chat-typing-user-icon{ font-size: 5px !important; }

.sipal-chat-typing-user .sipal-chat-typing-user-icon:nth-child(1){
    z-index:1;
    -moz-animation: bounce 1s infinite ease-in-out;
    -webkit-animation: bounce 1s infinite ease-in-out;
}
.sipal-chat-typing-user .sipal-chat-typing-user-icon:nth-child(2){
    -moz-animation: bounce 1s infinite ease-in-out;
    -webkit-animation: bounce 1s infinite ease-in-out;
    -webkit-animation-delay: 0.1s;
    animation-delay: 0.1s;
}
.sipal-chat-typing-user .sipal-chat-typing-user-icon:nth-child(3){
    -moz-animation: bounce 1s infinite ease-in-out;
    -webkit-animation: bounce 1s infinite ease-in-out;
    -webkit-animation-delay: 0.2s;
    animation-delay: 0.2s;
}

@-moz-keyframes bounce {
    0%,15% {-moz-transform: translate(0,0);}
    50% {-moz-transform: translate(0,-3px);}
    85%, 100% {-moz-transform: translate(0,0);}
}

@-webkit-keyframes bounce {
    0%,20% {-webkit-transform: translate(0,0);}
    50% {-webkit-transform: translate(0,-3px);}
    80%, 100% {-webkit-transform: translate(0,0);}
}
