/* ================= VIDEO CALL SYSTEM STYLES ================= */
/* File: videoCall.css - IMPROVED VERSION */

/* Video Call Container */
.video-call-container {
    width: 100%;
    height: 100vh;
    background: #000;
    position: relative;
    overflow: hidden;
}

/* Top Bar */
.video-call-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    color: white;
}

.call-status {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.call-timer {
    font-size: 14px;
    font-weight: 600;
    color: white;
    font-family: monospace;
}

.close-call-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.close-call-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Remote Video Container */
.remote-video-container {
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Local Video Container */
.local-video-container {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 120px;
    height: 160px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transform: scaleX(-1); /* Mirror for self-view */
}

.local-video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 5px 10px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

/* Calling Overlay */
.calling-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 20;
    background: rgba(0,0,0,0.5);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.calling-avatar {
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #405DE6, #C13584);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 40px;
    border: 4px solid white;
}

.calling-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.calling-text {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
}

/* Video Call Controls */
.video-call-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 100;
}

.video-call-control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(38, 38, 38, 0.8);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.1);
}

.video-call-control-btn:hover {
    background: rgba(50, 50, 50, 0.9);
    transform: scale(1.05);
}

.video-call-control-btn.end-call {
    background: #FF0000;
    width: 70px;
    height: 70px;
    font-size: 28px;
}

.video-call-control-btn.end-call:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* Network Status */
.network-status {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 50;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Incoming Call Modal */
.video-call-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 120px;
}

.video-call-btn.accept-btn {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}

.video-call-btn.accept-btn:hover {
    background: linear-gradient(135deg, #1ea952, #0d6d62);
    transform: scale(1.05);
}

.video-call-btn.reject-btn {
    background: linear-gradient(135deg, #FF0000, #CC0000);
    color: white;
}

.video-call-btn.reject-btn:hover {
    background: linear-gradient(135deg, #cc0000, #990000);
    transform: scale(1.05);
}

/* Call History */
.call-history-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.3s ease;
}

.call-history-item:hover {
    background: rgba(255,255,255,0.05);
}

.call-history-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, #405DE6, #C13584);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    margin-right: 15px;
}

.call-history-info {
    flex: 1;
}

.call-history-name {
    font-weight: 600;
    color: white;
    font-size: 15px;
    margin-bottom: 3px;
}

.call-history-details {
    color: #8e8e8e;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.call-history-incoming {
    color: #25D366;
}

.call-history-outgoing {
    color: #0095f6;
}

.call-history-missed {
    color: #ed4956;
}

/* Loading Animation */
.video-call-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.video-call-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid #0095f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 500px) {
    .local-video-container {
        width: 100px;
        height: 133px;
        top: 70px;
        right: 15px;
    }
    
    .video-call-controls {
        bottom: 30px;
        gap: 15px;
    }
    
    .video-call-control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .video-call-control-btn.end-call {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .calling-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .calling-name {
        font-size: 20px;
    }
    
    .calling-text {
        font-size: 14px;
    }
}

/* Animation for incoming call */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.incoming-call-ring {
    position: relative;
}

.incoming-call-ring::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid #25D366;
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

/* Call Quality Indicator */
.call-quality-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
}

.quality-dot.active {
    background: #25D366;
}

/* Recording Indicator */
.recording-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,0,0,0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 100;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: recording-pulse 1s infinite;
}

@keyframes recording-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Connection Status */
.connection-excellent { color: #25D366 !important; }
.connection-good { color: #FFD700 !important; }
.connection-fair { color: #FFA500 !important; }
.connection-poor { color: #FF0000 !important; }

/* Video Effects */
.video-effect-blur {
    filter: blur(5px);
}

.video-effect-grayscale {
    filter: grayscale(100%);
}

.video-effect-sepia {
    filter: sepia(100%);
}

/* Error States */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 20px;
    border-radius: 10px;
    max-width: 300px;
}

.video-error-icon {
    font-size: 50px;
    margin-bottom: 15px;
    color: #ed4956;
}

/* Toast Notification */
.video-call-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Video Elements */
video {
    background: #000;
    object-fit: cover;
}

#remoteVideo {
    width: 100%;
    height: 100%;
}

#localVideo {
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* Mirror for self-view */
}

/* No video placeholder */
.no-video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #666;
    font-size: 16px;
}

/* Call buttons in chat */
.chat-video-btn {
    background: #E1306C;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.chat-video-btn:hover {
    background: #C13584;
    transform: scale(1.1);
}