/* ================================================
   WEBRTC CALLING UI STYLES - GLASSMORPHISM DESIGN
   ================================================ */

/* Incoming Call Modal */
.incoming-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.incoming-call-modal.show {
    opacity: 1;
}

.incoming-call-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.incoming-call-container {
    position: relative;
    background: rgba(30, 30, 35, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 380px;
    width: 90%;
    margin: 50% auto 0;
    transform: translateY(-50%);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUpBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-ripple-container {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
}

.avatar-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid rgba(52, 199, 89, 0.6);
    animation: ripple 2s ease-out infinite;
}

.avatar-ripple:nth-child(1) {
    animation-delay: 0s;
}

.avatar-ripple:nth-child(2) {
    animation-delay: 0.6s;
}

.avatar-ripple:nth-child(3) {
    animation-delay: 1.2s;
}

@keyframes ripple {
    0% {
        width: 120px;
        height: 120px;
        opacity: 0.6;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

.incoming-call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
}

.incoming-call-name {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.incoming-call-type {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.incoming-call-actions {
    display: flex;
    gap: 48px;
    justify-content: center;
    margin-top: 16px;
}

.call-action-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.call-action-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.call-action-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.call-action-btn svg {
    position: relative;
    z-index: 1;
}

.call-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.call-action-btn:active::before {
    transform: translate(-50%, -50%) scale(1);
}

.call-action-btn.accept {
    background: linear-gradient(135deg, #34C759, #30D158);
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.4);
    animation: pulseAccept 2s ease-in-out infinite;
}

.call-action-btn.accept:hover {
    transform: scale(1.15);
    box-shadow: 0 12px 32px rgba(52, 199, 89, 0.6);
}

.call-action-btn.reject {
    background: linear-gradient(135deg, #FF3B30, #FF453A);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
}

.call-action-btn.reject:hover {
    transform: scale(1.15) rotate(-15deg);
    box-shadow: 0 12px 32px rgba(255, 59, 48, 0.6);
}

@keyframes pulseAccept {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(52, 199, 89, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(52, 199, 89, 0.6), 0 0 0 8px rgba(52, 199, 89, 0.2);
    }
}

/* Active Call Overlay */
.active-call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(20, 20, 25, 0.98) 0%, rgba(10, 10, 15, 0.98) 100%);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease-out;
}

.active-call-overlay.video-call {
    background: #000;
}

.active-call-overlay.audio-call {
    justify-content: flex-start;
    padding: 32px 20px 120px;
    gap: 32px;
}

.audio-call-content {
    text-align: center;
    padding: 40px 20px;
}

.call-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 48px auto 24px;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.2);
    animation: pulseAvatar 2s ease-in-out infinite;
}

.call-participant-name {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
}

.call-info {
    text-align: center;
    padding: 24px 20px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.active-call-overlay.audio-call .call-info {
    position: static;
    transform: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.call-status {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.call-duration {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    margin-bottom: 12px;
}

.call-encryption {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(52, 199, 89, 0.15);
    border-radius: 16px;
    color: #34C759;
    font-size: 13px;
}

.active-call-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.active-call-status {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.call-timer {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.active-call-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.active-call-participant {
    text-align: center;
    margin-bottom: 40px;
}

.active-call-participant-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 24px;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.2);
}

.active-call-participant-name {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.active-call-encrypted {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(52, 199, 89, 0.15);
    border-radius: 20px;
    color: #34C759;
    font-size: 14px;
    margin-top: 12px;
}

/* Video Containers */
.call-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    transition: opacity 0.3s ease;
}

.call-audio-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    gap: 24px;
}

.remote-video {
    width: 100%;
    max-width: 450px;
    aspect-ratio: 9/16;
    object-fit: cover;
    background: #000;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.local-video {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 10;
    cursor: grab;
    touch-action: none;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.local-video.visible {
    opacity: 1;
}

.local-video.horizontal {
    width: 160px;
    aspect-ratio: 16/9 !important;
}

.local-video.vertical {
    width: 120px;
    aspect-ratio: 9/16 !important;
}

.local-video.animating-orientation {
    transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
                aspect-ratio 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.local-video.dragging {
    cursor: grabbing;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.local-video:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
}

@media (orientation: landscape) {
    .remote-video {
        max-width: none;
        max-height: 100%;
        aspect-ratio: 16/9;
    }
    
    .local-video {
        width: 120px;
        aspect-ratio: 9/16;
    }
}

/* Audio Visualization */
.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 80px;
    margin: 24px 0 60px 0;
}

.audio-bar {
    width: 6px;
    background: linear-gradient(180deg, #34C759, #30D158);
    border-radius: 3px;
    animation: audioWave 0.8s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0s; }
.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.4s; }
.audio-bar:nth-child(6) { animation-delay: 0.3s; }
.audio-bar:nth-child(7) { animation-delay: 0.2s; }
.audio-bar:nth-child(8) { animation-delay: 0.1s; }

/* Call Controls */
.call-controls {
    display: flex;
    gap: clamp(12px, 3vw, 20px);
    justify-content: center;
    align-items: center;
    padding: clamp(20px, 5vw, 32px) clamp(16px, 4vw, 24px);
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
}

.active-call-overlay.audio-call .call-controls {
    position: static;
    margin-top: auto;
}

.call-control-btn {
    width: clamp(48px, 12vw, 64px);
    height: clamp(48px, 12vw, 64px);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #ffffff;
    position: relative;
}

.call-control-btn svg {
    width: clamp(20px, 5vw, 24px);
    height: clamp(20px, 5vw, 24px);
    transition: transform 0.3s ease;
}

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

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

.call-control-btn:active {
    transform: scale(0.95);
}

.call-control-btn.active {
    background: linear-gradient(135deg, #FF3B30, #FF453A);
}

.call-control-btn.mute.active {
    background: linear-gradient(135deg, #FF3B30, #FF453A);
}

.call-control-btn.mute.active svg path:last-child {
    display: none;
}

.call-control-btn.camera.active {
    background: linear-gradient(135deg, #FF3B30, #FF453A);
}

.call-control-btn.speaker {
    background: rgba(255, 255, 255, 0.15);
}

.call-control-btn.speaker.active {
    background: linear-gradient(135deg, #007AFF, #0051D5);
}

.call-control-btn.end {
    background: linear-gradient(135deg, #FF3B30, #FF453A);
    width: clamp(56px, 14vw, 72px);
    height: clamp(56px, 14vw, 72px);
}

.call-control-btn.end:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 12px 32px rgba(255, 59, 48, 0.6);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUpBounce {
    0% {
        transform: translateY(-50%) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) scale(1.05);
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes pulseAvatar {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(52, 199, 89, 0);
    }
}

@keyframes audioWave {
    0%, 100% {
        height: 20px;
        opacity: 0.5;
    }
    50% {
        height: 60px;
        opacity: 1;
    }
}

/* Fade out animation */
.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .incoming-call-container {
        padding: 32px 24px;
    }
    
    .incoming-call-avatar {
        width: 100px;
        height: 100px;
    }
    
    .incoming-call-name {
        font-size: 24px;
    }
    
    .call-action-btn {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    
    .active-call-participant-avatar {
        width: 120px;
        height: 120px;
    }
    
    .active-call-participant-name {
        font-size: 24px;
    }
    
    .local-video.vertical {
        width: clamp(100px, 25vw, 140px);
    }
    
    .local-video.horizontal {
        width: clamp(140px, 35vw, 180px);
    }
    
    .call-control-btn {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
    
    .call-control-btn.end-call {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
}

/* Loading Spinner */
.call-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Call History Bubbles */
.call-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 8px 0;
    max-width: 320px;
}

.call-bubble-icon {
    font-size: 24px;
    line-height: 1;
}

.call-bubble-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-bubble-status {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
}

.call-bubble-duration {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.call-bubble-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: auto;
}

.call-bubble.call-missed {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.3);
}

.call-bubble.call-rejected {
    background: rgba(255, 149, 0, 0.15);
    border-color: rgba(255, 149, 0, 0.3);
}

.call-bubble.call-ended {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.3);
}

/* Screen Share Modal */
.screenshare-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.screenshare-container {
    background: rgba(30, 30, 35, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 420px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.screenshare-title {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 24px;
    text-align: center;
}

.screenshare-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.screenshare-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screenshare-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.screenshare-option-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007AFF, #0040DD);
    border-radius: 12px;
    flex-shrink: 0;
}

.screenshare-option-info {
    flex: 1;
}

.screenshare-option-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.screenshare-option-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.screenshare-close {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.screenshare-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Preview Zoom Button */
.preview-zoom-btn {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                top 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.2s ease,
                border-color 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.preview-zoom-btn:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.7);
}

.preview-zoom-btn.dragging {
    cursor: grabbing;
    transform: scale(1.3);
    border-color: rgba(255, 255, 255, 0.9);
}

