/**
 * BPG BuddyBoss Media Carousel Styles
 * Version: 3.1.1 - COMPLETE STYLING
 * 
 * CHANGES IN v3.1.1:
 * ✨ NEW: Image hover effect support
 * ✨ NEW: CSS filter support
 * ✨ COMPLETE: All styling features from v1.2.0 restored
 * 
 * CHANGES IN v3.1.0:
 * - Elementor styling integration for navigation arrows
 * - Elementor styling integration for pagination dots
 * 
 * All styles now fully customizable through Elementor!
 */

/* ============================================
   CAROUSEL STYLES
   ============================================ */

/* Carousel Wrapper - Space for pagination dots below */
.bb-media-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 45px; /* Space for pagination dots BELOW carousel */
}

/* Hide ALL default Swiper navigation elements */
.bb-media-carousel-wrapper .swiper-button-prev:not(.bb-media-carousel .swiper-button-prev),
.bb-media-carousel-wrapper .swiper-button-next:not(.bb-media-carousel .swiper-button-next),
.swiper-button-prev.swiper-button-disabled,
.swiper-button-next.swiper-button-disabled {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Carousel Container - Must contain slides */
.bb-media-carousel {
    overflow: hidden; /* Keep hidden to contain slides properly */
    position: relative;
    width: 100%;
}

/* More aggressive hiding of default Swiper arrows */
.bb-media-carousel-wrapper [class*="swiper-button"]:not(.bb-media-carousel .swiper-button-prev):not(.bb-media-carousel .swiper-button-next) {
    display: none !important;
}

/* Swiper wrapper and slides - Ensure proper containment */
.bb-media-carousel .swiper-wrapper {
    width: 100%;
}

.bb-media-carousel .swiper-slide {
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
}

/* Carousel Items */
.bb-carousel-item {
    position: relative;
    overflow: hidden;
    background: transparent;
    display: block;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.bb-carousel-item a {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
}

.bb-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Default hover effect - can be overridden by Elementor */
.bb-carousel-item:hover img {
    transform: scale(1.05);
}

/* Aspect Ratios */
.bb-aspect-1-1 { aspect-ratio: 1 / 1; }
.bb-aspect-4-3 { aspect-ratio: 4 / 3; }
.bb-aspect-16-9 { aspect-ratio: 16 / 9; }
.bb-aspect-3-2 { aspect-ratio: 3 / 2; }
.bb-aspect-21-9 { aspect-ratio: 21 / 9; }
.bb-aspect-auto { aspect-ratio: auto; }

.bb-aspect-auto img {
    height: auto;
    object-fit: contain;
}

/* Overlay */
.bb-carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.bb-carousel-item:hover .bb-carousel-overlay {
    opacity: 1;
}

.bb-carousel-overlay-content {
    text-align: center;
    padding: 20px;
    width: 100%;
}

.bb-carousel-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bb-carousel-author {
    color: #dddddd;
    font-size: 13px;
    line-height: 1.4;
}

/* Navigation Arrows - Elementor-friendly defaults */
.bb-media-carousel-wrapper .swiper-button-prev,
.bb-media-carousel-wrapper .swiper-button-next,
.bb-media-carousel .swiper-button-prev,
.bb-media-carousel .swiper-button-next {
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    position: absolute;
    border: none;
}

.bb-media-carousel-wrapper .swiper-button-prev::after,
.bb-media-carousel-wrapper .swiper-button-next::after,
.bb-media-carousel .swiper-button-prev::after,
.bb-media-carousel .swiper-button-next::after {
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    display: block;
}

.bb-media-carousel-wrapper .swiper-button-prev:hover,
.bb-media-carousel-wrapper .swiper-button-next:hover,
.bb-media-carousel .swiper-button-prev:hover,
.bb-media-carousel .swiper-button-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.bb-media-carousel-wrapper .swiper-button-prev,
.bb-media-carousel .swiper-button-prev { 
    left: 10px;
    right: auto;
}

.bb-media-carousel-wrapper .swiper-button-next,
.bb-media-carousel .swiper-button-next { 
    right: 10px;
    left: auto;
}

/* CRITICAL: Hide all other Swiper navigation that isn't our custom styled ones */
.swiper-button-prev:not(.bb-media-carousel .swiper-button-prev),
.swiper-button-next:not(.bb-media-carousel .swiper-button-next) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Hide any Swiper navigation that appears outside our carousel */
body .swiper-button-prev:not(.bb-media-carousel *),
body .swiper-button-next:not(.bb-media-carousel *) {
    display: none !important;
}

/* Hide default Swiper arrows in Elementor editor */
.elementor-editor-active .swiper-button-prev:not(.bb-media-carousel .swiper-button-prev),
.elementor-editor-active .swiper-button-next:not(.bb-media-carousel .swiper-button-next) {
    display: none !important;
}

/* Pagination Dots - Elementor-friendly defaults */
.bb-media-carousel-wrapper .swiper-pagination {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 40px;
    text-align: center;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    padding: 0;
    margin: 0;
}

.bb-media-carousel .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 0 4px;
    border-radius: 50%;
    border: none;
}

.bb-media-carousel .swiper-pagination-bullet-active {
    background-color: #2271b1;
    width: 12px;
    height: 12px;
}

.bb-media-carousel .swiper-pagination-bullet:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

/* No Images Message */
.bb-carousel-no-images {
    text-align: center;
    padding: 40px 20px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
}

.bb-carousel-no-images p {
    margin: 0;
    color: #646970;
    font-size: 14px;
}

/* ============================================
   BUDDYBOSS LIGHTBOX STYLES
   ============================================ */

/* Main Lightbox Container */
.bb-media-model-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.95);
}

.bb-media-model-wrapper.media-theatre {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close Button */
.bb-media-model-wrapper .bb-close-media-theatre {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    background: transparent !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    cursor: pointer;
    transition: opacity 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.bb-media-model-wrapper .bb-close-media-theatre::before,
.bb-media-model-wrapper .bb-close-media-theatre::after {
    display: none !important;
}

.bb-media-model-wrapper .bb-close-media-theatre:hover {
    opacity: 0.7;
    background: transparent !important;
}

.bb-media-model-wrapper .bb-close-media-theatre svg {
    width: 14px;
    height: 14px;
}

/* Media Container */
.bb-media-model-container {
    position: relative;
    width: 90vw;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
}

.bb-media-model-inner {
    display: flex;
    height: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

/* Image Section */
.bb-media-section {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 40px;
}

.bb-media-section figure {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    z-index: 1;
}

.bb-media-section figure img {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.3s ease;
}

/* Navigation Arrows in Lightbox */
.bb-media-model-wrapper .bb-media-section a.theater-command {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    background: transparent !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    z-index: 100 !important;
    transition: opacity 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.bb-media-model-wrapper .bb-media-section a.theater-command::before,
.bb-media-model-wrapper .bb-media-section a.theater-command::after {
    display: none !important;
}

.bb-media-model-wrapper .bb-media-section a.theater-command:hover {
    opacity: 0.7;
    background: transparent !important;
}

.bb-media-model-wrapper .bb-media-section a.theater-command svg {
    width: 16px;
    height: 30px;
}

.bb-media-model-wrapper .bb-media-section a.theater-command.bb-prev-media {
    left: 20px !important;
}

.bb-media-model-wrapper .bb-media-section a.theater-command.bb-next-media {
    right: 20px !important;
}

/* Info Sidebar */
.bb-media-info-section {
    width: 360px;
    background: #1a1a1a;
    padding: 30px;
    overflow-y: auto;
    border-left: 1px solid #333;
}

.bb-media-info-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
}

.bb-media-info-author {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Watermark in Lightbox */
.bb-carousel-watermark {
    position: absolute;
    pointer-events: none;
    z-index: 100;
}

.bb-carousel-watermark.top-left { top: 20px; left: 20px; }
.bb-carousel-watermark.top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.bb-carousel-watermark.top-right { top: 20px; right: 20px; }
.bb-carousel-watermark.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.bb-carousel-watermark.bottom-left { bottom: 20px; left: 20px; }
.bb-carousel-watermark.bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.bb-carousel-watermark.bottom-right { bottom: 20px; right: 20px; }

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1024px) {
    .bb-media-model-inner {
        flex-direction: column;
    }
    
    .bb-media-section {
        flex: 1;
        padding: 20px;
    }
    
    .bb-media-info-section {
        width: 100%;
        max-height: 30vh;
        border-left: none;
        border-top: 1px solid #333;
    }
}

@media (max-width: 768px) {
    .bb-carousel-title { font-size: 14px; }
    .bb-carousel-author { font-size: 12px; }
    .bb-carousel-overlay-content { padding: 15px; }
    
    .bb-media-carousel .swiper-button-prev,
    .bb-media-carousel .swiper-button-next {
        width: 36px;
        height: 36px;
    }
    
    .bb-media-carousel .swiper-button-prev::after,
    .bb-media-carousel .swiper-button-next::after {
        font-size: 16px;
    }
    
    .bb-media-model-container {
        width: 95vw;
        height: 95vh;
    }
    
    .bb-media-info-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .bb-carousel-title { font-size: 13px; }
    .bb-carousel-author { font-size: 11px; }
    
    .bb-media-carousel .swiper-button-prev,
    .bb-media-carousel .swiper-button-next {
        width: 32px;
        height: 32px;
    }
    
    .bb-media-carousel .swiper-button-prev::after,
    .bb-media-carousel .swiper-button-next::after {
        font-size: 14px;
    }
    
    .bb-media-carousel .swiper-button-prev { left: 5px; }
    .bb-media-carousel .swiper-button-next { right: 5px; }
    
    .bb-media-section { padding: 10px; }
    .bb-media-info-section { padding: 15px; }
    .bb-media-info-title { font-size: 16px; }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.bb-carousel-item a:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.bb-carousel-item a:focus img {
    opacity: 0.8;
}

.bb-close-media-theatre:focus,
.theater-command:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ============================================
   ELEMENTOR EDITOR
   ============================================ */

/* Keep overflow hidden even in editor to prevent slide spillage */
.elementor-editor-active .bb-media-carousel {
    overflow: hidden;
}

/* Hide default Swiper navigation elements that may appear */
.elementor-editor-active .swiper-button-prev:not(.bb-media-carousel .swiper-button-prev),
.elementor-editor-active .swiper-button-next:not(.bb-media-carousel .swiper-button-next) {
    display: none !important;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .bb-carousel-overlay,
    .swiper-button-prev,
    .swiper-button-next,
    .swiper-pagination,
    .bb-media-model-wrapper {
        display: none !important;
    }
}
