/* WP Simple Guest Chat - modals.css */

/* --- General Modal & Image Popup Styles --- */
.wsgc-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99990; display: none; align-items: center; justify-content: center; overflow-y: auto; }
.wsgc-modal .wsgc-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); cursor: pointer; }
.wsgc-modal .wsgc-modal-content-wrapper { position: relative; padding: 20px; display: flex; align-items: center; justify-content: center; min-height: 100%; width: 100%; }
.wsgc-modal .wsgc-modal-content { position: relative; background-color: #f9f9f9; padding: 25px 30px; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); width: 90%; max-width: 480px; z-index: 99991; box-sizing: border-box; }
.wsgc-modal .wsgc-modal-content h3 { margin-top: 0; margin-bottom: 20px; font-size: 1.3em; color: #333; text-align: center; }
.wsgc-modal .wsgc-modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 28px; font-weight: bold; line-height: 1; color: #888; cursor: pointer; padding: 0; }
.wsgc-modal .wsgc-modal-close:hover { color: #333; }
body.wsgc-modal-open { overflow: hidden; }

.wsgc-image-modal{ z-index: 1000001 !important; }
.wsgc-image-modal .wsgc-image-modal-container { position: relative; }

/* --- MODIFICATION START: Replaced and Improved WebRTC Video Call Window Styles --- */
.wsgc-video-call-window {
    position: fixed; 
    top: 20px;
    right: 20px;
    width: 320px;
    min-width: 200px;
    height: auto;
    z-index: 1000000 !important; 
    background-color: #000;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    display: none;
    overflow: hidden; 
    transition: all 0.3s ease;
    cursor: move; 
}

.wsgc-video-call-container { 
    position: relative; 
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.wsgc-remote-videos-container { 
    flex-grow: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    overflow: hidden;
    min-height: 150px;
}

.wsgc-remote-videos-container .wsgc-remote-video,
.wsgc-local-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures video covers the area without distortion */
}

.wsgc-local-video-container { 
    position: absolute; 
    bottom: 10px; 
    right: 10px; 
    width: 25%; 
    max-width: 120px; 
    aspect-ratio: 4 / 3; 
    border-radius: 5px; 
    border: 1px solid rgba(255,255,255,0.2); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
    overflow: hidden; 
    transition: all 0.2s ease; 
    z-index: 10; 
    cursor: default; 
}
.wsgc-local-video-container video { 
    background-color: #111; 
}
.wsgc-local-video-container:hover { 
    transform: scale(1.5); 
}

.wsgc-video-call-controls { 
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 35px; 
    background-image: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    gap: 15px; 
    flex-wrap: wrap; 
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: default; 
}

/* Make controls persistently visible during a call on desktop, and on hover/tap at other times. */
.wsgc-video-call-window.wsgc-in-call .wsgc-video-call-controls,
.wsgc-video-call-window:hover .wsgc-video-call-controls,
.wsgc-video-call-window.wsgc-maximized .wsgc-video-call-controls {
    opacity: 1;
    pointer-events: auto;
}

.wsgc-video-call-controls button { background: rgba(74, 106, 138, 0.8); color: white; border: 1px solid rgba(255,255,255,0.2); width: 44px; height: 44px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.wsgc-video-call-controls button:hover { background: #5b7e9f; }
.wsgc-video-call-controls button.wsgc-btn-danger { background-color: rgba(231, 76, 60, 0.8); }
.wsgc-video-call-controls button.wsgc-btn-danger:hover { background-color: #c0392b; }
.wsgc-video-call-controls button.wsgc-btn-danger span { font-size: 0.7em; font-weight: bold; }

.wsgc-video-call-window.wsgc-maximized { 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important; 
    border-radius: 0 !important; 
    cursor: default; 
}

/* --- Mobile-Specific Video Call UI --- */
@media (max-width: 767px) {
    .wsgc-video-call-window {
        position: absolute; 
        width: 110px;
        height: 147px;
        top: 10px;        
        left: 10px;
        border-radius: 10px;
        cursor: pointer;
        z-index: 10; 
        pointer-events: none;
    }
    .wsgc-video-call-window .wsgc-video-call-container {
        pointer-events: auto;
    }
    .wsgc-video-call-window .wsgc-video-call-controls {
        display: none;
    }

    .wsgc-video-call-window .wsgc-remote-videos-container {
        display: flex;
    }
    .wsgc-video-call-window .wsgc-local-video-container {
        display: block; 
        position: absolute;
        width: 40%; 
        bottom: 5px;
        right: 5px;
    }
    
    .wsgc-video-call-window.wsgc-maximized {
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        
        /* Added robust fallbacks for viewport height */
        height: 100vh !important;
        height: -webkit-fill-available;
        height: 100dvh !important;
        
        cursor: default;
        pointer-events: auto;
    }

    .wsgc-video-call-window.wsgc-maximized .wsgc-video-call-controls {
        display: flex;
    }

    .wsgc-video-call-window.wsgc-maximized .wsgc-local-video-container {
        width: 25%;
        max-width: 120px;
    }
}
/* --- MODIFICATION END --- */