/* ---------- TEACHER PLAYER STYLING ---------- */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

/* iOS control visibility handling */
video.show-controls::-webkit-media-controls {
    display: block;
}
video.hide-controls::-webkit-media-controls {
    display: none;
}

/* ---------- VIDEO CONTAINER ---------- */
.video-container {
    position: relative;
    width: 80%;
    max-width: 900px;
    margin: 20px auto;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
}

.video-js {
    width: 100%;
    height: auto;
    display: block;
}

#autoMicToggle {
    position: absolute;
    top: 10px;
    left: calc(42% - 130px);
    transform: translateX(-50%);
    padding: 8px 14px;
    background-color: #A8E1FF;
    color: #93278f;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    z-index: 20;
}

#voiceToggle {
    position: absolute;
    top: 10px;
    left: calc(57% + 130px);
    transform: translateX(-50%);
    padding: 8px 14px;
    background-color: #A8E1FF;
    color: #93278f;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    z-index: 20;
}

/* ---------- FULLSCREEN BUTTON ---------- */
#button {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background-color: #A8E1FF;
    color: #93278f;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    z-index: 20;
}
#button:hover {
    background-color: #7ECFFF;
}

/* ---------- OVERLAY CONTROLS ---------- */
.overlay-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}
.overlay-controls:hover {
    opacity: 1;
}
.overlay-controls button {
    padding: 8px 12px;
    background-color: rgba(168, 225, 255, 0.9);
    color: #93278f;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

/* ---------- NATIVE FULLSCREEN (DESKTOP / iPad) ---------- */
.video-container:fullscreen,
.video-container:-webkit-full-screen,
.video-container:-moz-full-screen,
.video-container:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    background-color: #000;
    border-radius: 0;
}
.video-container:fullscreen video,
.video-container:-webkit-full-screen video,
.video-container:-moz-full-screen video,
.video-container:-ms-fullscreen video {
    max-width: 100vw;
    max-height: 100vh;
}

/* ---------- MOS CHAT PANEL ---------- */
.mos-chat {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 320px;
    height: 200px;
    min-width: 220px;
    min-height: 140px;
    max-width: 90vw;
    max-height: 85vh;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
    overflow: auto;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    resize: both;
    user-select: none;
    touch-action: none;
}

.mos-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: linear-gradient(180deg,#f7f9fb,#e9f3ff);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    cursor: grab;
}
.mos-chat-header:active {
    cursor: grabbing;
}
.mos-chat-body {
    flex: 1 1 auto;
    padding: 6px;
    min-height: 0;
}

.mos-jitsi-placeholder,
.mos-jitsi-placeholder iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

#mos-reset,
#mos-toggle-size,
#mos-hide {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}

.mos-chat[data-mos-hidden="1"] {
    display: none !important;
}

/* ---------- MOS SHOW BUTTON ---------- */
.mos-show {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 28px;
    background: rgba(168, 225, 255, 0.98);
    color: #93278f;
    font-size: 22px;
    line-height: 48px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    z-index: 2147483647 !important; 
}
.video-container .mos-show {
    position: absolute;
}

.mos-show:focus,
#mos-hide:focus,
#mos-toggle-size:focus,
#mos-reset:focus {
    outline: 2px solid rgba(147,39,159,0.6);
    outline-offset: 2px;
}
body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ---------- PSEUDO FULLSCREEN (iOS + Android) ---------- */
#videoContainer.mos-pseudo-fullscreen {
    position: fixed !important;
		inset: 0 !important; /* replaces top/left/width/height */
		min-width: 100vw;
		min-height: 100dvh;
    width: 100vw !important;  
		height: 100dvh !important;  
    padding: 0;
		margin: 0 !important;
    background: black !important;
    display: block !important;
		z-index: 2147483646 !important;	
}

/* VIDEO ITSELF */
#videoContainer.mos-pseudo-fullscreen video,
#videoContainer.mos-pseudo-fullscreen .video-js,
#videoContainer.mos-pseudo-fullscreen .vjs-tech {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: 100% !important;
    height: 100% !important;
		
    object-fit: contain !important;
    transform: translate(-50%, -50%) !important;
}
/* ALWAYS allow Show button in pseudo fullscreen */
#videoContainer.mos-pseudo-fullscreen .mos-show {
    position: absolute;
    top: 10px;
    right: 10px;
		z-index: 2147483647 !important;
}


/* ---------- OVERLAY CONTROLS: RESPONSIVE ---------- */
#videoContainer.mos-pseudo-fullscreen .overlay-controls {
    position: absolute;
    bottom: 10.75%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;          /* default: allow wrapping (portrait / narrow) */
    gap: 4px;
    justify-content: center;
    z-index: 2147483647;
}

/* Landscape / wider screens → single row */
@media (min-width: 768px), (orientation: landscape) {
    #videoContainer.mos-pseudo-fullscreen .overlay-controls {
        flex-wrap: nowrap;    /* keep in one row */
        overflow-x: auto;     /* horizontal scroll if buttons overflow */
        white-space: nowrap;
    }

    /* Optional: hide scrollbar for clean look */
    #videoContainer.mos-pseudo-fullscreen .overlay-controls::-webkit-scrollbar {
        display: none;
    }
}

/* ---------- BUTTON STYLE ---------- */
#videoContainer.mos-pseudo-fullscreen .overlay-controls button {
    padding: 8px 12px;
    background-color: rgba(168, 225, 255, 0.9);
    color: #93278f;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0; /* prevent buttons from shrinking too much */
}


#videoContainer.mos-pseudo-fullscreen .mos-chat {
    z-index: 2147483646 !important;
}

/* ---------- CURSOR CONTROL ---------- */
.video-js.hide-controls,
#videoContainer.mos-pseudo-fullscreen .video-js.hide-controls {
    cursor: none;
}

#videoContainer:not(.mos-pseudo-fullscreen) #button {
    display: block !important;
		z-index: 2147483647 !important;
}

/* Native fullscreen support */
.video-container:fullscreen .mos-show,
.video-container:-webkit-full-screen .mos-show {
    position: absolute !important;
    z-index: 2147483647 !important;
}
#syncStatus {
    display: block; /* always visible in normal mode */
    margin: 12px auto;
    padding: 6px 10px;
    font-size: 14px;
    color: #fff;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    width: fit-content;
    text-align: center;
}