#visio {
    display: block;
    position: fixed;
    bottom: 7rem;
    right: 2rem;
    width: 40rem;
    height: 25rem;
    background-color: #111;
    border-radius: 1rem;
    transition: opacity 0.3s ease-in-out,
        bottom 0.3s ease-in-out,
        right 0.3s ease-in-out,
        width 0.3s ease-in-out,
        height 0.3s ease-in-out,
        transform 0.3s ease-in-out;
    z-index: 3;
}

@media screen and (max-width: 800px) {
    #visio {
        right: 1rem;
        width: 34rem;
        height: 22rem;
    }
}

#dialog:not(:empty)~#visio,
#drawer:not(:empty)~#visio {
    transform: translateX(110%);
}

#chat_widget #visio {
    position: relative;
    bottom: 0;
    right: 0;
    border-radius: 0;
    max-height: 40%;
    height: 100%;
    z-index: 0;
}

body>#visio:not(:fullscreen) #main,
body>#visio:not(:fullscreen) #toggle_dtmf,

body>#visio:not(:fullscreen) .participant:before,
body>#visio:not(:fullscreen) .participant:after,

#chat_widget #visio #switch_chat,
#visio:not([data-type]),
#visio:not([data-type]) #toggle_audio,
#visio[data-type=video] #toggle_dtmf,
#visio[data-type=video] #dtmf,
#visio #dtmf:not(.hide)~#participants,
#visio:not([data-type=video]) #toggle_video,

body>#visio:not(:fullscreen) #toggle_mode,
#visio:not([data-muji=true]) #toggle_mode,
#visio:not([data-type=video]) #toggle_mode,

#visio:not([data-type=video]) #switch_camera,
#visio:not([data-type=video]) #screen_sharing,
#visio:not([data-type=video]) #local_video,
#visio:not([data-type=video]) #screen_sharing_video {
    display: none;
}

#visio #visio_source {
    display: none;
}

#visio #switch_camera:not(.enabled),
#visio #screen_sharing:not(.enabled) {
    display: none;
}

#visio #dtmf {
    top: calc(50% - 15rem);
    position: absolute;
    width: 100%;
    text-align: center;
}

#visio #dtmf p.dtmf {
    width: 16rem;
    margin: 0 auto;
    margin-top: 2rem;
    text-align: center;
    position: relative;
    mask-image: linear-gradient(to left, black calc(100% - 2rem), transparent);
    height: 2.5rem;
}

#visio #dtmf p.dtmf span {
    position: absolute;
    right: 0;
    height: 2rem;
    text-align: center;
    min-width: 100%;
}

#visio .infos {
    color: white;
    position: absolute;
    top: calc(50% - 12rem);
    width: 100%;
    z-index: -1;
    text-align: center;
    transition: opacity 0.5s ease-in-out;
}

#visio #dtmf:not(.hide)~.infos {
    opacity: 0;
}

#visio #main {
    outline: 0.5rem solid transparent;
    bottom: 2rem;
    /* Override global CSS */
}

#visio[data-muji=true] #main {
    display: none;
}

#visio .infos #remote_level {
    overflow: hidden;
    border-radius: 100%;
    width: 15rem;
    height: 15rem;
    margin: 0 auto;
    margin-bottom: 2rem;
    font-size: 6rem;
    line-height: 15rem;
    border: 0.5rem solid transparent;
}

#visio .infos #remote_level div.avatar img {
    width: 100%;
}

#visio .infos p.state {
    margin: 0;
    font-size: 1.8rem;
}

#visio video#local_video,
#visio video#screen_sharing_video.sharing {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    width: 20rem;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--elevation-4);

    background-image: url('../theme/img/movim_cloud.svg');
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgb(var(--movim-accent));
    background-size: 25%;
}


body>#visio:not(:fullscreen) video#local_video,
body>#visio:not(:fullscreen) video#screen_sharing_video.sharing {
    width: 10rem;
    right: 0;
    bottom: 0;
}

body>#visio:not(:fullscreen) #visio_contact,
body>#visio:not(:fullscreen) .participant img.avatar {
    transform: scale(0.7);
}

@media screen and (max-width: 800px) {

    #chat_widget #visio:not(:fullscreen) #visio_contact,
    body>#visio:not(:fullscreen) .participant img.avatar {
        transform: scale(0.7);
    }
}

#visio video#screen_sharing_video:not(.sharing),
#visio video#screen_sharing_video.sharing+video#local_video {
    display: none;
}

@media screen and (max-width: 800px) {

    #visio video#local_video,
    #visio video#screen_sharing_video.sharing {
        width: 15rem;
    }
}

#visio header {
    position: absolute;
    width: 100%;
    z-index: 1;
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
}

#visio header ul.list li {
    justify-content: space-between;
    padding-right: 0;
}

#visio header ul.list li span#switch_chat {
    flex: 0 0 5rem;
}

#visio header i {
    text-shadow: 0 0 3rem #333, 0 0 0.5rem #777;
}

#visio header #no_mic_sound.disabled {
    display: none;
}

#visio header #no_mic_sound {
    animation: fadein 0.3s;
    font-size: 1.5rem;
    line-height: 2.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: white;
    opacity: 0.6;
}

#visio .button.action {
    right: calc(50% - 3.5rem);
    position: absolute;
}

#visio .ring {
    -webkit-animation: Rotate 2000ms infinite;
    animation: Rotate 2000ms infinite;
}

#visio #participants {
    display: flex;
    flex-wrap: wrap;
    height: 100%;
    justify-content: center;
}

#visio #local_video,
#visio .participant video {
    transition: opacity 0.5s ease-in-out;
}

#visio .participant {
    position: relative;
    padding: 0.5rem;
    box-sizing: border-box;
    max-height: 100%;
    display: flex;
    align-items: center;

    flex: 1 auto;
}

#visio .participant video {
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
    display: block;
    border-radius: 0.5rem;
    object-fit: cover;
}

/** Active speaker view **/

#visio #participants.active .participant:not(.active),
body>#visio:not(:fullscreen) #participants.active .participant:not(.active) {
    display: none;
}

/** Grid view **/

#visio #participants:not(.active) .participant.active:not(.audio_off)::after {
    color: var(--p-green);
    opacity: calc(1 - var(--level));
    transform: scale(1.5) translateX(0.25rem) translateY(-0.25rem);
    transition: opacity 0.5s ease-in-out, transform .3s cubic-bezier(.4,0,.2,1);
}

#visio #participants:not(.active):has(.participant:nth-child(2)) .participant {
    flex: 1 0 calc(50% - 0.5rem);
    max-width: 50%;
}

#visio #participants:not(.active):has(.participant:nth-child(2)) .participant video {
    max-height: 50vw;
}

#visio #participants:not(.active):has(.participant:nth-child(3)) .participant {
    height: 50%;
}

#visio #participants:not(.active):has(.participant:nth-child(5)) .participant {
    flex: 1 0 calc(33.33% - 0.5rem);
}

#visio #participants:not(.active):has(.participant:nth-child(7)) .participant {
    height: 33.33%;
}

body>#visio #participants:not(.active):has(.participant:nth-child(3)) .participant,
body>#visio #participants:not(.active):has(.participant:nth-child(5)) .participant,
body>#visio #participants:not(.active):has(.participant:nth-child(7)) .participant {
    height: 100%;
}

/** Active speaker mode */
body>#visio #participants:not(.active):has(.participant:nth-child(2)) .participant {
    flex: 1 auto;
    max-width: 100%;
}


#visio .participant::after,
#visio .participant::before {
    position: absolute;
    bottom: 5.5rem;
    left: 2rem;
    line-height: 1.5rem;
    display: inline-block;
    color: white;
    text-shadow: 0 0 1rem rgba(0, 0, 0, 0.85);
    font-size: 2rem;
    transition: opacity 0.5s ease-in-out, transform .3s cubic-bezier(.4,0,.2,1);
}

#visio .participant::after {
    font-family: 'Material Symbols';
    font-variation-settings: 'FILL' 1;
    content: '\e029';
    letter-spacing: 1.5rem;
    opacity: 0.5;
}

#visio .participant img.avatar {
    position: absolute;
    width: 15rem;
    height: 15rem;
    left: calc(50% - 7.5rem);
    top: calc(50% - 7.5rem);
    border-radius: 50%;
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
    display: none;
}

#visio .participant.video_off img.avatar {
    opacity: 1;
    display: initial;
}

#visio .participant[data-name]::before {
    bottom: 2rem;
    content: attr(data-name);
}

#visio .participant:not([data-name])::after {
    bottom: 2rem;
}

#visio .participant.audio_off::after {
    content: '\e02b';
}

#visio .participant.audio_off.video_off::after {
    content: '\e02b \f83b';
}

#visio[data-muji='true'] #participants:not(:empty)~.infos,
#visio #local_video.video_off,
#visio .participant.video_off video {
    opacity: 0;
}

@-webkit-keyframes Rotate {
    0% {
        -webkit-transform: rotate(0deg);
    }

    4% {
        -webkit-transform: rotate(-22.5deg);
    }

    8% {
        -webkit-transform: rotate(0deg);
    }

    12% {
        -webkit-transform: rotate(22.5deg);
    }

    16% {
        -webkit-transform: rotate(0deg);
    }

    20% {
        -webkit-transform: rotate(-22.5deg);
    }

    24% {
        -webkit-transform: rotate(0deg);
    }

    100% {
        -webkit-transform: rotate(0deg);
    }
}

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

    4% {
        transform: rotate(-22.5deg);
    }

    8% {
        transform: rotate(0deg);
    }

    12% {
        transform: rotate(-22.5deg);
    }

    16% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-22.5deg);
    }

    24% {
        transform: rotate(0deg);
    }

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

#visio #toggle_audio i {
    transition: color 0.2s ease-out;
}

#visio .infos img {
    transition: border-color 0.2s ease-out;
}