/**
 * BPG BuddyBoss Media Carousel Styles
 * Version: 3.8.0 - CSS ARROW FIX
 *
 * CHANGES IN v3.8.0:
 * ✅ FIXED: Double arrow in Elementor editor — Swiper's built-in icon now suppressed
 *           cleanly via font-size:0 on the default ::after, then re-set on ours
 * ✅ FIXED: Dangerous global :not() rules removed — were risking hiding BuddyBoss
 *           and other plugin Swiper arrows anywhere on the page
 * ✅ All arrow/navigation rules now scoped inside .bb-media-carousel-wrapper only
 *
 * CHANGES IN v3.1.1:
 * ✨ Image hover effect support, CSS filter support
 *
 * CHANGES IN v3.1.0:
 * - Elementor styling integration for navigation arrows and pagination dots
 */

/* ============================================
   CAROUSEL WRAPPER
   ============================================ */

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

/* ============================================
   CAROUSEL CONTAINER
   ============================================ */

.bb-media-carousel {
    overflow: hidden;
    position: relative;
    width: 100%;
}

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

/* ============================================
   HOVER 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
   v3.9.0: Icons now rendered via inline SVG background-image.

   Root cause of the double chevron: both Swiper (via font-family:
   swiper-icons on ::after) AND Elementor Pro (which injects its own
   ::after on .swiper-button-prev/next in the editor) were each
   rendering a chevron on top of ours. No font-size trick reliably
   suppresses both simultaneously.

   Fix: suppress ALL ::before and ::after content with
   content:none !important, then draw the single white chevron
   using a URL-encoded SVG as background-image on the button itself.
   No icon font involved — nothing for Swiper or Elementor to clash with.
   ============================================ */

/* Button shape */
.bb-media-carousel-wrapper .swiper-button-prev,
.bb-media-carousel-wrapper .swiper-button-next {
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.3s ease;
    z-index: 10;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    position: absolute;
    border: none;
    top: 50%;
    transform: translateY(-50%);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 14px 14px;
    /* Silence Swiper's CSS variable so its ::after renders at 0 size too */
    --swiper-navigation-size: 0px;
}

/* Left arrow — white left-pointing chevron */
.bb-media-carousel-wrapper .swiper-button-prev {
    left: 10px;
    right: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18'%3E%3Cpath d='M9 1L1 9l8 8' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* Right arrow — white right-pointing chevron */
.bb-media-carousel-wrapper .swiper-button-next {
    right: 10px;
    left: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18'%3E%3Cpath d='M1 1l8 8-8 8' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* Kill ALL pseudo-element content — Swiper, Elementor, anything else */
.bb-media-carousel-wrapper .swiper-button-prev::before,
.bb-media-carousel-wrapper .swiper-button-next::before,
.bb-media-carousel-wrapper .swiper-button-prev::after,
.bb-media-carousel-wrapper .swiper-button-next::after {
    content: none !important;
    display: none !important;
    font-size: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

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

/* Disabled */
.bb-media-carousel-wrapper .swiper-button-prev.swiper-button-disabled,
.bb-media-carousel-wrapper .swiper-button-next.swiper-button-disabled {
    opacity: 0;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .bb-media-carousel-wrapper .swiper-button-prev,
    .bb-media-carousel-wrapper .swiper-button-next {
        width: 36px;
        height: 36px;
        background-size: 11px 11px;
    }
}

@media (max-width: 480px) {
    .bb-media-carousel-wrapper .swiper-button-prev,
    .bb-media-carousel-wrapper .swiper-button-next {
        width: 32px;
        height: 32px;
        background-size: 10px 10px;
    }

    .bb-media-carousel-wrapper .swiper-button-prev { left: 5px; }
    .bb-media-carousel-wrapper .swiper-button-next { right: 5px; }
}

/* ============================================
   PAGINATION DOTS
   ============================================ */

.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-wrapper .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-wrapper .swiper-pagination-bullet-active {
    background-color: #2271b1;
    width: 12px;
    height: 12px;
}

.bb-media-carousel-wrapper .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
   ============================================ */

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

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

/* Lightbox prev/next arrows */
.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 */
.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
   ============================================ */

@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-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-section   { padding: 10px; }
    .bb-media-info-section { padding: 15px; }
    .bb-media-info-title   { font-size: 16px; }
}

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

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

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

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

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