/**
 * Video Call Styles
 * Styling for LiveKit video call component
 */

/* Main Wrapper */
.video-call-wrapper {
    position: fixed;
    z-index: 9999;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.video-call-wrapper:not(.minimized):not(.fullscreen) {
    width: 900px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.video-call-wrapper.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    border-radius: 0;
}

.video-call-wrapper.minimized {
    width: 320px;
    height: 80px;
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
    transform: none;
    cursor: pointer;
}

/* Minimized View */
.video-call-minimized {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.minimized-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.minimized-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.minimized-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.minimized-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.minimized-duration {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.minimized-status {
    color: #fff;
    font-size: 20px;
}

/* Full Container */
.video-call-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1a1a2e;
}

/* Header */
.video-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.call-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.caller-name {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.call-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.call-duration {
    color: #4ade80;
    font-size: 14px;
    font-weight: 500;
}

.call-duration .blink {
    animation: blink 1.5s infinite;
    font-size: 8px;
    margin-right: 6px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Video Area */
.video-area {
    flex: 1;
    position: relative;
    background: #0f0f1a;
    overflow: hidden;
}

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

.remote-video {
    width: 100%;
    height: 100%;
}

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

/* Video Placeholder */
.video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.placeholder-content {
    text-align: center;
    color: #fff;
}

.placeholder-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 20px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.placeholder-content h4 {
    font-size: 24px;
    margin-bottom: 8px;
}

.placeholder-content p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Local Video (PiP) */
.local-video-container {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 180px;
    height: 135px;
    border-radius: 12px;
    overflow: hidden;
    background: #2a2a3e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: move;
}

.local-video-container:hover {
    border-color: rgba(102, 126, 234, 0.5);
    transform: scale(1.02);
}

.local-video-container.video-off {
    background: #1a1a2e;
}

.local-video {
    width: 100%;
    height: 100%;
}

.local-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror local video */
}

.local-video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
}

.local-video-placeholder i {
    margin-bottom: 8px;
}

.local-video-placeholder span {
    font-size: 11px;
}

.local-video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Screen Share Indicator */
.screen-share-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    z-index: 10;
}

.screen-share-indicator .btn {
    margin-left: 10px;
}

/* Connection Quality */
.connection-quality {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 6px;
    color: #fff;
}

/* Call Controls */
.video-call-controls {
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    transition: all 0.2s ease;
    padding: 10px;
}

.control-btn i {
    font-size: 20px;
    margin-bottom: 4px;
}

.control-label {
    font-size: 10px;
    opacity: 0.8;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.05);
}

.control-btn.active {
    background: rgba(239, 68, 68, 0.8);
}

.control-btn.active:hover {
    background: rgba(239, 68, 68, 1);
}

.btn-end-call {
    background: #ef4444 !important;
    width: 80px;
    height: 80px;
}

.btn-end-call i {
    transform: rotate(135deg);
    font-size: 24px;
}

.btn-end-call:hover {
    background: #dc2626 !important;
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    bottom: 110px;
    right: 20px;
    width: 300px;
    background: #2a2a3e;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 20;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h5 {
    color: #fff;
    margin: 0;
    font-size: 14px;
}

.settings-body {
    padding: 15px 20px;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-bottom: 6px;
}

.setting-item .form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
}

.setting-item .form-control:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: #667eea;
    box-shadow: none;
}

/* Error Message */
.call-error {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
}

.error-content i {
    font-size: 16px;
}

/* Incoming Call Overlay */
.incoming-call-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.incoming-call-content {
    text-align: center;
    color: #fff;
}

.pulse-animation {
    animation: pulse-avatar 2s infinite;
}

@keyframes pulse-avatar {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.incoming-call-content .caller-avatar {
    width: 150px;
    height: 150px;
    margin: 0 auto 25px;
}

.incoming-call-content .caller-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.incoming-call-content h3 {
    font-size: 28px;
    margin-bottom: 8px;
}

.incoming-call-content p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    margin-bottom: 30px;
}

.incoming-call-actions {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.incoming-call-actions .btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    gap: 6px;
}

.incoming-call-actions .btn i {
    font-size: 24px;
}

.incoming-call-actions .btn-success {
    background: #22c55e;
    border-color: #22c55e;
    animation: ring-pulse 1.5s infinite;
}

@keyframes ring-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .video-call-wrapper:not(.minimized):not(.fullscreen) {
        width: 95vw;
        height: 80vh;
    }
    
    .local-video-container {
        width: 140px;
        height: 105px;
    }
    
    .control-btn {
        width: 60px;
        height: 60px;
    }
    
    .control-btn i {
        font-size: 18px;
    }
    
    .btn-end-call {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 576px) {
    .video-call-wrapper:not(.minimized):not(.fullscreen) {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .local-video-container {
        width: 100px;
        height: 75px;
        bottom: 120px;
        right: 10px;
    }
    
    .controls-wrapper {
        gap: 8px;
    }
    
    .control-btn {
        width: 55px;
        height: 55px;
    }
    
    .control-label {
        display: none;
    }
    
    .btn-end-call {
        width: 65px;
        height: 65px;
    }
    
    .settings-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}
