/**
 * Mega Boost - Video Bubble Widget Styles
 * 
 * @package MegaBoost\Elementor
 * @since 1.1.0
 */

/* Wrapper */
.mbe-vb-wrapper {
    display: flex;
    width: 100%;
}

/* Bubble */
.mbe-vb-bubble {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
}

.mbe-vb-bubble.is-expanded {
    width: 640px;
    height: 360px;
    border-radius: 16px;
    z-index: 100;
}

/* Thumbnail */
.mbe-vb-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.mbe-vb-bubble:hover .mbe-vb-thumbnail {
    transform: scale(1.05);
}

.mbe-vb-bubble.is-expanded .mbe-vb-thumbnail {
    opacity: 0;
    pointer-events: none;
}

/* Preview Video */
.mbe-vb-preview-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.mbe-vb-bubble.has-preview .mbe-vb-thumbnail {
    opacity: 0;
}

.mbe-vb-bubble.is-expanded .mbe-vb-preview-video {
    opacity: 0;
    pointer-events: none;
}

/* Overlay */
.mbe-vb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, opacity 0.3s ease;
    z-index: 2;
}

.mbe-vb-bubble:hover .mbe-vb-overlay {
    background-color: rgba(0, 0, 0, 0.1);
}

.mbe-vb-bubble.is-expanded .mbe-vb-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Play Icon */
.mbe-vb-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    color: #ffffff;
    z-index: 3;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

.mbe-vb-play-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    margin-left: 2px;
}

.mbe-vb-bubble:hover .mbe-vb-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: rgba(0, 0, 0, 0.7);
}

.mbe-vb-bubble.is-expanded .mbe-vb-play-icon {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

/* Video Container */
.mbe-vb-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.mbe-vb-bubble.is-expanded .mbe-vb-video-container {
    opacity: 1;
    pointer-events: auto;
}

.mbe-vb-iframe,
.mbe-vb-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Close Button (added by JS when expanded) */
.mbe-vb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.mbe-vb-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.mbe-vb-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.mbe-vb-bubble.is-expanded .mbe-vb-close {
    opacity: 1;
    transform: scale(1);
}

/* Mobile Popup Overlay */
.mbe-vb-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.mbe-vb-popup-overlay.is-active {
    display: flex;
}

.mbe-vb-popup-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.mbe-vb-popup-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
}

.mbe-vb-popup-video-wrapper iframe,
.mbe-vb-popup-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.mbe-vb-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.mbe-vb-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.mbe-vb-popup-close svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.mbe-vb-popup-close svg path {
    fill: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
    .mbe-vb-bubble.is-expanded:not(.mbe-vb-use-popup) {
        width: 100% !important;
        height: 56.25vw !important;
        max-height: 80vh;
    }
    
    /* Hide normal expand on mobile when popup is enabled */
    .mbe-vb-bubble.mbe-vb-use-popup.is-expanded {
        width: inherit !important;
        height: inherit !important;
    }
    
    .mbe-vb-bubble.mbe-vb-use-popup.is-expanded .mbe-vb-video-container {
        display: none;
    }
    
    .mbe-vb-bubble.mbe-vb-use-popup.is-expanded .mbe-vb-close {
        display: none;
    }
}
