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

/*#videoMediaContainer {
    z-index: 2;
    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;
}
#videoMediaContainer {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 0;
    padding: 0;

    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    grid-auto-rows: 1fr;

    align-items: stretch;
    justify-items: stretch;
}*/

/* ----------------------------------
   MOBILE (default)
-----------------------------------*/

#videoMediaContainer {
    display: flex;
    flex-direction: column;   /* stack vertically */
    width: 100%;
    height: 100dvh;           /* use dvh for mobile */
    overflow-y: auto;
    background: #000;
}

/* Each video fills half the screen when 2 users */
.pixselchat-tile,
.Camera {
    width: 100%;
    min-height: 50dvh;   /* 2 users = 50% each */
    flex-shrink: 0;      /* important for scroll */
    position: relative;
    overflow: hidden;
}

/* Video fills tile */
.pixselchat-tile video,
.Camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 769px) {

    #videoMediaContainer {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: 1fr;
        height: 100vh;
    }

    .pixselchat-tile,
    .Camera {
        height: 100%;
    }
}

.pixselchat-tile.active-speaker {
    outline: 5px solid #32e67f;
    box-shadow: 0 0 20px rgba(50,230,127,0.8);
}

#videoPinMediaContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000;
}

.screen-share-active #videoMediaContainer {
    position: absolute;
    right: 0;
    top: 0;
    width: 280px;
    height: 100%;
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
}

.Camera {
    position: relative;
    aspect-ratio: 16 / 9;

    width: 100%;
    height: 300px;      /* fixed height */
    min-height: 300px;
    max-height: 300px;

    border-radius: 0;   /* no rounded corners */
    overflow: hidden;
    background: #000;
}

.Camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .pixselchat-tile,
    .Camera {
        height: 220px;
        min-height: 220px;
        max-height: 220px;
    }
}

/*--------------------------------------------------------------
# Video nav Bar
--------------------------------------------------------------*/

.navbar {
    z-index: 8;
    position: absolute;
    top: 0;
    width: 100%;
    background:  var(--navbar-bg);
    text-align: right;
}

.navbar button {
    display: inline;
    padding: 10px;
    font-size: small;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    color: #fff;
}

.navbar div {
    display: inline;
}

.navbar button:hover {
    color: var(--hover-color);
    cursor: pointer;
}

/*--------------------------------------------------------------
# Expand buttons 
--------------------------------------------------------------*/

.expand-video-content {
    position: relative;
    display: none;
    float: right;
    width: auto;
}

.expand-video-content button {
    display: none;
}

.expand-video:hover .expand-video-content {
    display: inline;
}

.expand-video:hover .expand-video-content button {
    display: inline;
}

/*--------------------------------------------------------------
# Peer name 
--------------------------------------------------------------*/

.videoPeerName {
    z-index: 8;
    position: absolute;
    padding: 10px;
    margin: 5px;
    top: 1px;
    right: 0;
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    border-radius: 5px;
    background: rgba(28, 28, 28, 1.0);
}

/*--------------------------------------------------------------
# Video Avatar image
--------------------------------------------------------------*/

.videoAvatarImage {
    z-index: 7;
    position: absolute;
    display: none;
    width: var(--vmi-wh);
    height: var(--vmi-wh);
    border-radius: 50%;
    /*center*/
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: box-shadow 0.2s ease;
}

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

.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.2s ease;
}

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

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

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

video:fullscreen {
    object-fit: contain;
}

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

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

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

/*--------------------------------------------------------------
# Video Transcript Display
--------------------------------------------------------------*/

.video-transcript-display {
    position: absolute;
    bottom: 65px; /* Higher to avoid bottom buttons */
    left: 20%; /* Center with 60% width */
    right: 20%; /* Center with 60% width */
    width: 60%;
    font-size: 18px; /* Larger font for better readability */
    max-height: 150px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none; /* Hidden by default, shown when transcripts exist */
    color: #ffffff;
    z-index: 20;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none; /* Prevent scrolling when dragging on mobile */
    user-select: none; /* Prevent text selection while dragging */
    cursor: move; /* Show move cursor to indicate draggable */
}

.video-transcript-display::-webkit-scrollbar {
    width: 4px;
}

.video-transcript-display::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.video-transcript-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.video-transcript-display::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.transcript-message {
    margin: 4px 0;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
    line-height: 1.3;
    word-wrap: break-word;
    animation: fadeInTranscript 0.3s ease-in;
}

.transcript-message:last-child {
    border-left-color: #2196F3;
    background: rgba(33, 150, 243, 0.2);
}

.transcript-message.translated {
    border-left-color: #FF9800;
}

.transcript-text {
    display: block;
    margin: 2px 0;
}

@media (max-width: 768px) {
    .video-transcript-display {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px); /* Full width minus padding */
        /* Account for larger bottom buttons on mobile */
        bottom: 50px; /* Higher to avoid larger bottom buttons */
        max-height: 120px; /* Slightly smaller to fit screen */
    }
}

@media (max-width: 500px) {
    .video-transcript-display {
        /* Account for potentially wrapped buttons */
        bottom: 50px; /* Higher to avoid larger bottom buttons */
        max-height: 100px; /* Smaller max height */
        font-size: 14px; /* Slightly smaller font for mobile */
    }
}

@media (max-width: 350px) {
    .video-transcript-display {
        /* Account for multiple rows of buttons */
        bottom: 120px; /* Higher for very small screens */
        max-height: 80px; /* Smaller to leave room */
        font-size: 12px; /* Smaller font for very small screens */
        padding: 6px; /* Less padding */
    }
}

/* PIXSELCHAT 2x2 GRID */
.pixselchat-grid {
    display: grid;
    gap: 16px;
    padding: 16px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: 1fr;
}

/* Video Tile */
/*.pixselchat-tile {
    position: relative;
    background: #9b215d;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(0,0,0,0.4);
}*/
/* 1:1.3 ratio like WhatsApp layout */
.pixselchat-tile {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: 300px;              /* FIXED HEIGHT */
    min-height: 300px;
    max-height: 300px;

    border-radius: 0;           /* no rounded corner */
    overflow: hidden;
    background: #000;
}

/* Active speaker border */
.pixselchat-tile.active {
    outline: 4px solid #32e67f;
    box-shadow: 0 0 20px rgba(50,230,127,0.8);
}
/* Active speaker outline */
/*.pixselchat-tile.active {
    outline: 4px solid #34eb77 !important;
}*/

/* Video element styling */
.pixselchat-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
}

/* Avatar centered */
.pixselchat-avatar {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1A2A44;
    color: #fff;
    font-size: 38px;
    font-weight: bold;
}

/* Name bottom-left */
.pixselchat-name {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 14px;
}

.tile-info-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 8px 12px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
}

.tile-info-name {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.tile-info-lang {
    font-size: 13px;
    opacity: 0.85;
}

.tile-info-icons {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 16px;
    display: flex;
    gap: 8px;
}

.video-info-bar {
    position: absolute;
    bottom: 0;
    left: 0;

    width: 100%;
    background: rgba(0,0,0,0.65);
    color: #fff;

    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;

    box-sizing: border-box;
    z-index: 10;
}

.video-info-name {
    font-size: 15px;
    font-weight: 600;
}

.video-info-lang {
    font-size: 12px;
    opacity: 0.85;
}

.video-info-icon {
    position: absolute;
    right: 12px;
    bottom: 10px;
    font-size: 18px;
}

.active-speaker {
    outline: 4px solid #32e67f;
    box-shadow: 0 0 20px rgba(50,230,127,0.8);
}

.tile-info-icons,
.video-info-icon {
    display: none !important;
}

.mic-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 6px 12px;
    border-radius: 20px;

    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 13px;
}

.mic-badge i {
    font-size: 14px;
}

.mic-badge .fa-microphone {
    color: #32e67f;
}

.mic-badge .fa-microphone-slash {
    color: #ff4d4d;
}
