/* Prevent horizontal scroll globally to support viewport-width breakout elements without overflows */
html, body, #page-container {
    overflow-x: hidden !important;
}

/* Fullscreen and Fullwidth Slider Container */
.mg-fullscreen-slider-container {
    width: 100%;
    max-width: 100%;
    position: relative;
    height: 65vh;
    min-height: 480px;
    max-height: 750px;
    overflow: hidden;
    background-color: #000;
    z-index: 1;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure Divi wrappers don't block full-width */
.et_pb_section_0_tb_body,
.et_pb_row_0_tb_body,
.et_pb_column_0_tb_body {
    overflow: visible !important;
}

/* Viewport */
.mg-slider-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mg-slider-track {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Slide Items - Fade Transition Layout */
.mg-slide-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.8s;
    z-index: 1;
}

.mg-slide-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Link wrapper */
.mg-slide-link-wrapper {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
}

/* Media containers for Desktop vs Mobile */
.mg-slide-media-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.mg-media-desktop {
    display: block;
    width: 100%;
    height: 100%;
}

.mg-media-mobile {
    display: none;
    width: 100%;
    height: 100%;
}

.mg-slide-media-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mg-slide-media-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bottom Controls Overlay (Floating centered glassmorphism container) */
.mg-slider-controls-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: auto;
    max-width: 90%;
    pointer-events: none; /* Let clicks pass outside the control bar */
}

.mg-slider-controls-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 50px;
    padding: 10px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: auto; /* Re-enable pointer events inside control bar */
}

/* Nav Buttons inside controls */
.mg-slider-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 0;
}

.mg-slider-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.mg-slider-nav-btn:hover {
    background: #ffffff;
    color: #000000;
    transform: scale(1.06);
}

/* Thumbnails Strip */
.mg-slider-thumbs-strip {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mg-slider-thumb-item {
    width: 72px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.45;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.mg-slider-thumb-item:hover {
    opacity: 0.8;
}

.mg-slider-thumb-item.active {
    opacity: 1;
    border-color: #ffffff;
    transform: translateY(-2px);
}

.mg-slide-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mg-slide-thumb-placeholder {
    width: 100%;
    height: 100%;
    background-color: #222;
}

/* Responsive adjustment for slider container height & mobile media switching */
@media (max-width: 768px) {
    .mg-fullscreen-slider-container {
        height: 60vh;
        min-height: 380px;
    }
    
    .mg-slide-item.has-mobile-media .mg-media-desktop {
        display: none !important;
    }

    .mg-slide-item.has-mobile-media .mg-media-mobile {
        display: block !important;
        width: 100%;
        height: 100%;
    }

    .mg-slider-thumb-item {
        width: 52px;
        height: 32px;
    }
    
    .mg-slider-controls-overlay {
        bottom: 15px;
    }
    
    .mg-slider-controls-container {
        gap: 8px;
        padding: 8px 12px;
    }
    
    .mg-slider-nav-btn {
        width: 32px;
        height: 32px;
    }
}
