/* Incoming Call Notification */
.incoming-call-notification {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: -1 !important; /* Start behind everything */
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.incoming-call-notification.show {
    display: flex !important;
    visibility: visible !important;
    z-index: 100000 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

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

.incoming-call-content {
    background: white;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

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

.caller-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.caller-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #1a73e8;
}

.ringing-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border: 3px solid #1a73e8;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

.caller-info h3 {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
}

.caller-info p {
    font-size: 16px;
    color: #5f6368;
    margin-bottom: 32px;
}

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

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

.decline-btn {
    background: #ea4335;
    color: white;
}

.decline-btn:hover {
    background: #c5221f;
}

.accept-btn {
    background: #34a853;
    color: white;
}

.accept-btn:hover {
    background: #2d8e47;
}

/* Floating call shell (non-chat pages) — hidden while mini popup is shown */
#global-call-shell {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(420px, calc(100vw - 40px));
    height: min(640px, calc(100vh - 40px));
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    z-index: 99999;
    overflow: hidden;
}

/* Video / webinar on landing pages: near-fullscreen so Meet layout
   (tiles + control bar) is not forced into the ≤768px mobile stack. */
#global-call-shell.global-call-shell--expanded {
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 14px;
}

@media (max-width: 768px) {
    #global-call-shell,
    #global-call-shell.global-call-shell--expanded {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: auto;
        border-radius: 0;
    }
}

body.mc-call-shell-open {
    overflow: hidden;
}

#global-call-shell iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

#global-call-shell .global-call-shell-minimize {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(32, 33, 36, 0.72);
    color: #fff;
    font-size: 16px;
    line-height: 36px;
    cursor: pointer;
    padding: 0;
}

#global-call-shell.global-call-shell--expanded .global-call-shell-minimize {
    top: 14px;
    right: 14px;
}

/* Feedback (callEnd) owns dismiss — hide shell minimize so it does not overlap × */
#global-call-shell.global-call-shell--feedback .global-call-shell-minimize {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Video/webinar: OS Document PiP only — never show the in-browser mini bar */
body.mc-use-os-call-pip #call-mini-popup {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Voice Call Mini Popup - White Card Design (voice-only fallback) */
#call-mini-popup {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100000;
    width: 400px;
    height: 400px;
    min-width: 260px;
    min-height: 120px;
    max-width: min(400px, calc(100vw - 24px));
    max-height: min(400px, calc(100vh - 24px));
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15),
                0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

#call-mini-popup:not(.call-mini-custom-layout) {
    width: 400px;
    height: 400px;
    max-width: min(400px, calc(100vw - 24px));
    max-height: min(400px, calc(100vh - 24px));
}

#call-mini-popup.call-mini-custom-layout {
    right: auto !important;
    bottom: auto !important;
}

#call-mini-popup.call-mini-dragging .call-mini-header {
    cursor: grabbing;
}

.call-mini-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    touch-action: none;
    z-index: 2;
    background: linear-gradient(
        135deg,
        transparent 0 50%,
        rgba(32, 33, 36, 0.18) 50% 100%
    );
    border-bottom-right-radius: 16px;
}

#call-mini-popup.call-mini-resizing .call-mini-resize-handle {
    background: linear-gradient(
        135deg,
        transparent 0 50%,
        rgba(26, 115, 232, 0.35) 50% 100%
    );
}

#call-mini-popup.call-mini-custom-layout .call-mini-participants {
    flex: 1;
    min-height: 0;
    max-height: none;
}

#call-mini-popup .call-mini-controls,
#call-mini-popup .call-mini-controls button,
#call-mini-popup button {
    cursor: pointer;
}

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

#call-mini-popup.show {
    display: flex !important;
}

.call-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    cursor: grab;
    touch-action: none;
    flex-shrink: 0;
}

.call-mini-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.call-mini-group-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.call-mini-header-info {
    flex: 1;
}

.call-mini-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
}

.call-mini-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.call-mini-status-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.call-mini-fullscreen-btn,
.call-mini-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.call-mini-fullscreen-btn:hover,
.call-mini-close-btn:hover {
    background: #f0f0f0;
}

.call-mini-fullscreen-btn img,
.call-mini-close-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.call-mini-participants {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 14px 18px;
    background: #ffffff;
}

.call-mini-participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #f5f5f5;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.call-mini-participant-item:hover {
    background: #f5f5f5;
}

.call-mini-participant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e3f2fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #1a73e8;
    flex-shrink: 0;
    overflow: hidden;
}

.call-mini-participant-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.call-mini-participant-info {
    flex: 1;
    min-width: 0;
}

.call-mini-participant-name {
    font-size: 15px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 2px;
}

.call-mini-participant-status {
    font-size: 12px;
    color: #5f6368;
}

.call-mini-participant-time {
    font-size: 12px;
    color: #9aa0a6;
    margin-left: auto;
    flex-shrink: 0;
}

.call-mini-participant-cam {
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #137333;
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
}

.call-mini-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px 22px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.call-mini-control-btn {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    border: none;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.call-mini-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.call-mini-control-btn.mic {
    background: #34a853;
}

.call-mini-control-btn.mic img {
    filter: brightness(0) invert(1);
}

.call-mini-control-btn.mic.off {
    background: #ffffff;
}

.call-mini-control-btn.mic.off img {
    filter: none;
}

.call-mini-control-btn.video {
    background: #ffffff;
    position: relative;
}

.call-mini-control-btn.video.off::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ea4335;
    transform: rotate(45deg);
}

.call-mini-control-btn.screen-share {
    background: #ffffff;
}

.call-mini-control-btn.more {
    background: #ffffff;
}

.call-mini-control-btn.end {
    background: #ea4335;
    color: #ffffff;
    width: auto;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.call-mini-control-btn.end img {
    filter: brightness(0) invert(1);
    width: 18px;
    height: 18px;
}

.call-mini-control-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

@media (max-width: 768px) {
    #call-mini-popup:not(.call-mini-custom-layout) {
        right: 12px !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        left: auto !important;
        width: min(400px, calc(100vw - 24px)) !important;
        height: min(400px, calc(100vh - 24px)) !important;
        max-width: min(400px, calc(100vw - 24px)) !important;
        max-height: min(400px, calc(100vh - 24px)) !important;
        z-index: 100001 !important;
    }
}

@media (min-width: 1200px) {
    #call-mini-popup:not(.call-mini-custom-layout) {
        width: 400px !important;
        height: 400px !important;
        border-radius: 18px !important;
        right: 28px !important;
        bottom: 28px !important;
    }

    .call-mini-header {
        padding: 14px 18px;
    }

    .call-mini-title {
        font-size: 18px;
    }

    .call-mini-participants {
        max-height: 380px;
        padding: 14px 18px;
    }

    .call-mini-participant-item {
        padding: 12px 14px;
        margin-bottom: 10px;
    }

    .call-mini-participant-avatar {
        width: 48px;
        height: 48px;
    }

    .call-mini-participant-name {
        font-size: 15px;
    }

    .call-mini-participant-status,
    .call-mini-participant-time {
        font-size: 12px;
    }

    .call-mini-controls {
        gap: 14px;
        padding: 18px 22px;
    }

    .call-mini-control-btn {
        width: 54px;
        height: 54px;
    }
}
