/* Video Call Modern UI */
:root {
    --call-bg: #0b0b0b;
    --call-overlay: rgba(0, 0, 0, 0.4);
    --call-glass: rgba(255, 255, 255, 0.1);
    --call-glass-border: rgba(255, 255, 255, 0.2);
    --call-red: #ff3b30;
    --call-green: #34c759;
    --call-white: #ffffff;
    --call-text-muted: rgba(255, 255, 255, 0.7);
}

/* Main Container - Overlaying the viewport */
.video-call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--call-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    color: var(--call-white);
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Minimized State */
.video-call-overlay.minimized {
    width: 240px;
    height: 320px;
    top: auto;
    left: auto;
    right: 20px;
    bottom: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* Call Header */
.call-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    z-index: 10;
}

.call-user-info {
    display: flex;
    flex-direction: column;
}

.call-user-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.call-status {
    font-size: 0.85rem;
    color: var(--call-text-muted);
}

.call-window-controls {
    display: flex;
    gap: 10px;
}

.call-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--call-glass);
    border: 1px solid var(--call-glass-border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(10px);
}

.call-btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

/* Call Body - Video Area */
.call-body {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-call-stream-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.video-call-stream {
    width: 100%;
    height: 100%;
    background: #000;
}

.video-call-stream video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Remote stream video elements */
.video-call-stream video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* On mobile, ensure the main video is vertical */
@media (max-width: 768px) {
    .video-call-stream video {
        height: 100% !important;
        width: 100% !important;
        object-fit: cover !important;
    }
}

/* Local Video - Floating Overlay (PiP) */
.video-call-stream-local {
    position: absolute;
    top: 30px;
    right: 20px;
    width: 110px;
    height: 160px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 2000;
    border: 1px solid rgba(255,255,255,0.3);
    cursor: move;
    touch-action: none;
}

.video-call-stream-local video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Control Bar Over Video */
.call-footer {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    z-index: 1100;
}

.call-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 25px;
    background: var(--call-glass);
    backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid var(--call-glass-border);
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    color: white;
    background: rgba(255,255,255,0.1);
}

.control-btn:hover {
    transform: scale(1.1);
}

.control-btn.active {
    background: white;
    color: #333;
}

.control-btn.btn-end {
    background: var(--call-red);
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.control-btn.btn-end:hover {
    background: #ff453a;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
}

/* Mobile Specific Adjustments */
@media (max-width: 768px) {
    .call-controls {
        gap: 15px;
        padding: 10px 20px;
    }
    
    .video-call-stream-local {
        width: 100px;
        height: 150px;
        top: 70px;
        right: 15px;
    }

    .call-btn-icon {
        width: 36px;
        height: 36px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
    }
    
    .control-btn.btn-end {
        width: 55px;
        height: 55px;
    }
}

/* Animations */
@keyframes callFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.video-call-overlay {
    animation: callFadeIn 0.4s ease-out;
}

/* Modal Overrides for Full Screen Call */
body.video-call-active .modal {
    padding: 0 !important;
}
body.video-call-active .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
}
body.video-call-active .modal-content {
    height: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}
body.video-call-active .modal-backdrop {
    display: none !important;
}
