/**
 * BPG BuddyBoss Media Carousel Styles
 * Version: 1.2.0 CLEAN - All working features consolidated
 */

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

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

/* Carousel Container - Allow pagination to show below */
.bb-media-carousel {
    overflow: hidden;
    position: relative;
}

/* Carousel Items */
.bb-carousel-item {
    position: relative;
    overflow: hidden;
    background: transparent;
    display: block;
    border-radius: 8px;
}

.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;
    user-select: none;
    -webkit-user-drag: none;
}

.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 */
.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;
}

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

.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 .swiper-button-prev { left: 10px; }
.bb-media-carousel .swiper-button-next { right: 10px; }

/* Pagination Dots - Simplified positioning */
.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;
}

.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;
}

/* 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
   ============================================ */

.elementor-editor-active .bb-media-carousel {
    overflow: visible;
}

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

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