/*--------------------------------------------------------------
# Video grid
--------------------------------------------------------------*/

#videoMediaContainer {
    z-index: 1;
    position: absolute;
    display: flex;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    opacity: 1;
    align-content: center;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    overflow: hidden;
    transition: opacity 500ms;
    /* border: 3px solid blue; */
}

#videoPinMediaContainer {
    z-index: 1;
    position: absolute;
    display: none;
    top: 0;
    left: 0;
    width: 75%;
    height: 100%;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    /* animation: show 0.4s ease; */
    /* border: 3px solid lime; */
}

.Camera {
    position: relative;
    vertical-align: middle;
    align-self: center;
    overflow: hidden;
    display: inline-block;
    background: transparent;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    animation: show 0.4s ease;
    container-type: inline-size;
    container-name: camera;
}

/* .Camera:hover {
    border: 3px solid rgb(113, 157, 239);
} */

.Camera .fa-hand-paper {
    margin: 10px !important;
    font-size: 1.5rem !important;
}

#videoMediaContainer i {
    position: absolute;
    display: none;
    top: 0;
    color: rgb(0, 255, 71);
    font-size: 14px;
    align-items: center;
    padding: 5px;
    margin: 5px;
    width: auto;
    height: 25px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.4);
}

.videoAvatarImage {
    z-index: 1;
    position: absolute;
    display: none;
    width: var(--vmi-wh);
    height: var(--vmi-wh);
    border-radius: 50%;
    transition: box-shadow 0.3s ease;
}

.audio {
    position: absolute;
    right: 0;
    color: #fff;
    margin: 5px;
    width: auto;
    height: 25px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.1);
}

.username {
    z-index: 1;
    position: absolute;
    right: 0;
    bottom: 0;
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 10px;
    width: auto;
    height: 25px;
    border-radius: 5px;
    background: var(--body-bg);
}

.fscreen {
    position: absolute;
    right: 0;
    bottom: 0px;
    color: #fff;
    margin: 5px;
    width: auto;
    height: 25px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.1);
}

/* Video Menu Bar */
.videoMenuBar {
    z-index: 2;
    position: absolute; /* inside video feed by default */
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: row-reverse; /* invert buttons order visually */
    justify-content: flex-start; /* with row-reverse, this packs to the right */
    flex-wrap: nowrap;
    gap: clamp(2px, 1vw, 8px);
    padding: clamp(4px, 1.2vw, 8px);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background: var(--body-bg);
    /* box-shadow: var(--box-shadow); */
    cursor: default;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

/* Mobile floating menubar when appended to body */
.videoMenuBar.mobile-floating {
    z-index: 2;
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    width: 100vw;
    border-radius: 0 0 10px 10px;
}

.videoAvatarMenuBar,
.videoMenuBarShare {
    z-index: 2;
    position: absolute;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 1px;
    top: 0;
    left: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    font-size: small;
    font-weight: bold;
    text-align: center;
    width: 100%;
    cursor: default;
    overflow: hidden;
}

.videoMenuBar input,
.videoMenuBar button,
.videoAvatarMenuBar button,
.videoMenuBarShare button {
    font-size: clamp(0.9rem, 1vw, 1.05rem);
    min-width: 36px;
    min-height: 36px;
    color: #fff;
    background: var(--body-bg);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    cursor: pointer;
}

.videoMenuBar button:hover,
.videoAvatarMenuBar button:hover,
.videoMenuBarShare button:hover {
    color: #fff;
    background: var(--btns-bg-color);
}

/* Touch-friendly sizing for buttons within menu bar */
.videoMenuBar button {
    min-width: 32px;
    min-height: 32px;
    flex: 0 0 auto;
}

.fa-bars {
    color: #66beff !important;
}

.expand-video .dropdown-button {
    cursor: pointer;
    position: relative;
}

.expand-video-content {
    z-index: 5;
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 14px;
    border-radius: 5px;
    background: var(--body-bg);
    box-shadow: var(--box-shadow);
    overflow: auto;
}

.expand-video-content.show {
    z-index: 5;
    display: grid !important;
    grid-gap: 5px 5px;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        'header header'
        'controls controls';
    align-content: start;
    justify-items: start;
    overflow: auto;
}

.peer-name-container {
    display: row;
    width: 100%;
    height: 100%;
    padding: 10px;
    margin: 10px;
}

.expand-video-content .peer-name-header {
    grid-area: header;
    width: 100%;
    padding: 10px;
    height: 100px;
    background: var(--btns-bg-color);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expand-video-content .peer-name {
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    background: var(--body-bg);
    border-radius: 10px;
    padding: 5px;
    width: 100%;
}

.expand-video-content input[type='range'] {
    display: inline !important;
    width: 100%;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
}

/* Button Group Container */
.expand-video-content .button-group {
    display: flex !important;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
}

/* Individual Buttons */
.expand-video-content .button-group button {
    text-align: center;
    padding: 0 10px;
    font-size: 15px;
    color: #fff;
    background: var(--body-bg);
    min-width: 42px;
    min-height: 42px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    justify-content: center;
    align-items: center;
    display: inline-flex; /* center icon + label */
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.1s ease;
}

/* Icon alignment inside buttons */
.expand-video-content .button-group button i {
    line-height: 1;
    pointer-events: none; /* avoid accidental icon-only clicks interference */
}

/* Hover & Active Effects */
.expand-video-content .button-group button:hover {
    background: var(--btns-bg-color);
    transform: scale(1.05);
}

.expand-video-content .button-group button:active {
    transform: scale(0.95);
}

.expand-video-content button:hover {
    color: white;
    background: var(--body-bg);
}

#videoMediaContainer video {
    position: absolute;
    margin-left: auto;
    margin-right: auto;
}

/* Keep peer name header on the left, controls on the right */
.videoMenuBar .peer-name-header {
    order: 9999; /* with row-reverse, last = leftmost */
    padding: 0;
    background: transparent;
    height: auto;
}
.videoMenuBar .peer-name-header .peer-name-container {
    margin: 0;
    padding: 0;
}
.videoMenuBar .peer-name-header .peer-name {
    background: transparent;
    padding: 0;
    font-size: 0.95rem;
}

.videoCircle {
    position: absolute;
    width: var(--vmi-wh);
    height: var(--vmi-wh);
    border-radius: 50%;
    /* center */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    transition: box-shadow 0.3s ease;
}

.videoDefault {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: '10px';
    transition: box-shadow 0.3s ease;
}

video {
    width: 100%;
    height: 100%;
    object-fit: var(--videoObjFit);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

#canvasAIElement {
    width: 100%;
    height: 100%;
    object-fit: var(--videoObjFit);
    border-radius: 10px;
    cursor: pointer;
}

video:hover {
    filter: contrast(105%);
}

video:fullscreen {
    object-fit: contain;
}

.mirror {
    -webkit-transform: rotateY(180deg);
    -moz-transform: rotateY(180deg);
    transform: rotateY(180deg);
}

.blur {
    -webkit-filter: blur(5px);
    -moz-filter: blur(5px);
    -o-filter: blur(5px);
    -ms-filter: blur(5px);
    filter: blur(5px);
}

input[type='range'] {
    /* display: none; */
    color: #fff;
    width: 50px;
    cursor: pointer;
}

@keyframes show {
    0% {
        opacity: 0;
        transform: scale(0.4) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@container camera (max-width: 260px) {
    .videoMenuBar {
        gap: 0px;
        padding: 4px;
    }
    .videoMenuBar button,
    .videoAvatarMenuBar button,
    .videoMenuBarShare button {
        font-size: 0.7rem;
        min-width: 24px;
        min-height: 24px;
    }
    .videoMenuBar input[type='range'] {
        width: clamp(20px, 20%, 40px);
    }
    .expand-video-content {
        padding: 10px;
    }
    .expand-video-content .button-group button {
        font-size: 10px;
        min-width: 28px;
        min-height: 28px;
        gap: 1px;
    }
}

@container camera (min-width: 261px) and (max-width: 400px) {
    .videoMenuBar {
        gap: 2px;
        padding: 3px;
    }
    .videoMenuBar button,
    .videoAvatarMenuBar button,
    .videoMenuBarShare button {
        font-size: 0.8rem;
        min-width: 28px;
        min-height: 28px;
    }
    .videoMenuBar input[type='range'] {
        width: clamp(30px, 25%, 60px);
    }
    .expand-video-content .button-group button {
        font-size: 15px;
        min-width: 36px;
        min-height: 36px;
        gap: 3px;
    }
}

@container camera (min-width: 401px) and (max-width: 640px) {
    .videoMenuBar {
        gap: 6px;
        padding: 8px;
    }
    .videoMenuBar button,
    .videoAvatarMenuBar button,
    .videoMenuBarShare button {
        font-size: 0.9rem;
        min-width: 32px;
        min-height: 32px;
    }
    .videoMenuBar input[type='range'] {
        width: clamp(40px, 20%, 80px);
    }
    .expand-video-content .button-group button {
        font-size: 15px;
        min-width: 42px;
        min-height: 42px;
        gap: 6px;
    }
}

@container camera (min-width: 641px) {
    .videoMenuBar {
        gap: 8px;
        padding: 10px;
    }
    .videoMenuBar button,
    .videoAvatarMenuBar button,
    .videoMenuBarShare button {
        font-size: 1rem;
        min-width: 36px;
        min-height: 36px;
    }
    .videoMenuBar input[type='range'] {
        width: clamp(50px, 20%, 100px);
    }
    .expand-video-content .button-group button {
        font-size: 15px;
        min-width: 42px;
        min-height: 42px;
        gap: 6px;
    }
}
