/**
 * Modern Carousel Widget - Frontend Styles
 * 
 * @package BigBrandify Elementor Extension
 */

/* Base Carousel Styles */
.bbw-modern-carousel-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Prevent text selection while dragging */
.bbw-modern-carousel-wrapper.dragging-active {
    user-select: none;
    -webkit-user-select: none; /* For Safari */
}

/* Disable all links and pointer events during dragging */
.bbw-modern-carousel-wrapper.dragging-state-active .carousel-item,
.bbw-modern-carousel-wrapper.dragging-state-active .carousel-item * {
    pointer-events: none !important;
    cursor: grabbing !important;
}

/* Ensure links are completely disabled during dragging */
.bbw-modern-carousel-wrapper.dragging-state-active .carousel-item a,
.bbw-modern-carousel-wrapper.dragging-state-active .carousel-item a * {
    pointer-events: none !important;
    cursor: grabbing !important;
    text-decoration: none !important;
    color: inherit !important;
}

/* Custom Cursor */
.bbw-modern-carousel-wrapper .custom-cursor {
    position: fixed;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: rgba(25, 25, 25, 0.7); /* Reduced opacity from 0.9 to 0.7 */
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                opacity 0.3s ease, 
                background-color 0.3s ease;
    z-index: 10000;
    will-change: transform, opacity;
}

/* Hide custom cursor on touch devices */
@media (pointer: coarse) {
    .bbw-modern-carousel-wrapper .custom-cursor {
        display: none;
    }
    .bbw-modern-carousel-wrapper {
        cursor: auto;
    }
}

.bbw-modern-carousel-wrapper .custom-cursor.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.bbw-modern-carousel-wrapper .custom-cursor.dragging {
    transform: translate(-50%, -50%) scale(0.9);
    background-color: rgba(0, 0, 0, 1);
}

/* Learn More state - distinct from dragging */
.bbw-modern-carousel-wrapper .custom-cursor.learn-more-active {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: rgba(255, 255, 255, 0.95);
    color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

/* Click feedback state */
.bbw-modern-carousel-wrapper .custom-cursor.clicking {
    transform: translate(-50%, -50%) scale(0.85);
    background-color: rgba(0, 0, 0, 1);
    opacity: 1;
}

/* Carousel Structure */
.bbw-modern-carousel-wrapper .carousel-container {
    width: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin: 0;
    padding: 0;
    line-height: 0; /* Eliminate any text spacing */
}

/* Conditional cursor hiding - only when custom cursor is enabled */
.bbw-modern-carousel-wrapper.custom-cursor-enabled .carousel-container {
    cursor: none;
}

.bbw-modern-carousel-wrapper.custom-cursor-enabled .item-info {
    cursor: none;
}

.bbw-modern-carousel-wrapper .carousel-track {
    display: flex;
    position: relative;
    will-change: transform;
    margin: 0;
    padding: 0;
}

.bbw-modern-carousel-wrapper:not(.disable-smooth-scroll) .carousel-track {
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Carousel Item & Image Styling */
.bbw-modern-carousel-wrapper .carousel-item {
    flex-shrink: 0;
    width: 35vw;
    max-width: 480px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.bbw-modern-carousel-wrapper .image-wrapper {
    position: relative;
    overflow: hidden;
    background-color: transparent;
    height: 55vh;
    margin: 0;
    padding: 0;
}

.bbw-modern-carousel-wrapper .carousel-item img {
    position: absolute;
    width: 180%;
    max-width: 180vw !important;
    height: 120%;
    top: -10%;
    left: -40%;
    object-fit: cover;
    will-change: transform;
    transition: scale 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translate3d(0, 0, 0);
}

/* Conditional hover effects - only when hover animation is enabled */
.bbw-modern-carousel-wrapper.hover-animation-enabled .carousel-item:hover img {
    scale: 1.05;
    transition: scale 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.bbw-modern-carousel-wrapper.hover-animation-enabled .carousel-item.hover-effect .image-wrapper {
    transform: scale(1.05);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Ensure hover-effect takes priority over regular hover when enabled */
.bbw-modern-carousel-wrapper.hover-animation-enabled .carousel-item.hover-effect img {
    scale: 1.05;
    transition: scale 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Item info text below the image */
.bbw-modern-carousel-wrapper .item-info {
    padding-top: 20px;
    cursor: pointer;
}

.bbw-modern-carousel-wrapper .item-info .title {
    font-weight: 600;
    font-size: 1.2rem;
    margin: 0;
    color: #333;
}

.bbw-modern-carousel-wrapper .item-info .category {
    font-weight: 400;
    font-size: 1rem;
    color: #666;
    margin-top: 5px;
}

/* Mobile "Learn More" Button */
.bbw-modern-carousel-wrapper .mobile-learn-more {
    display: none;
    margin-top: 15px;
    padding: 8px 0;
    color: #333;
    text-decoration: underline;
    font-weight: 500;
    font-size: 1rem;
    text-align: left;
    transition: color 0.3s;
}

.bbw-modern-carousel-wrapper .mobile-learn-more:hover {
    color: #000;
}

/* Navigation Container */
.bbw-modern-carousel-wrapper .carousel-navigation,
.bbw-modern-carousel-wrapper .navigation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 5px;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none; /* Allow clicks to pass through container */
}

/* Ensure carousel content doesn't overlap with navigation */
.bbw-modern-carousel-wrapper.has-navigation-top {
    padding-top: 70px !important; /* Default padding for top navigation */
}

.bbw-modern-carousel-wrapper.has-navigation-bottom {
    padding-bottom: 70px !important; /* Default padding for bottom navigation */
}

.bbw-modern-carousel-wrapper .carousel-navigation .nav-arrow,
.bbw-modern-carousel-wrapper .navigation-container .nav-arrow {
    pointer-events: auto; /* Re-enable clicks on actual buttons */
}

/* Navigation Horizontal Positioning */
.bbw-modern-carousel-wrapper .carousel-navigation.nav-align-left,
.bbw-modern-carousel-wrapper .navigation-container.nav-align-left {
    justify-content: flex-start;
    left: 20px;
    right: auto;
    transform: none;
}

.bbw-modern-carousel-wrapper .carousel-navigation.nav-align-center,
.bbw-modern-carousel-wrapper .navigation-container.nav-align-center {
    justify-content: center;
    left: 0;
    right: 0;
    transform: none;
}

.bbw-modern-carousel-wrapper .carousel-navigation.nav-align-right,
.bbw-modern-carousel-wrapper .navigation-container.nav-align-right {
    justify-content: flex-end;
    right: 20px;
    left: auto;
    transform: none;
}

/* Navigation Vertical Positioning */
.bbw-modern-carousel-wrapper .carousel-navigation.nav-position-top,
.bbw-modern-carousel-wrapper .navigation-container.nav-position-top {
    top: 0;
    bottom: auto;
    z-index: 20;
}

.bbw-modern-carousel-wrapper .carousel-navigation.nav-position-bottom,
.bbw-modern-carousel-wrapper .navigation-container.nav-position-bottom {
    bottom: 0;
    top: auto;
    z-index: 20;
}

/* Fix for top-right positioning - remove extra spacing */
.bbw-modern-carousel-wrapper .carousel-navigation.nav-position-top.nav-align-right,
.bbw-modern-carousel-wrapper .navigation-container.nav-position-top.nav-align-right {
    top: 0;
    right: 20px;
    left: auto;
    margin: 0;
    padding: 5px;
}

/* Responsive navigation positioning */
@media (max-width: 768px) {
    .bbw-modern-carousel-wrapper .carousel-navigation.nav-align-left,
    .bbw-modern-carousel-wrapper .navigation-container.nav-align-left {
        left: 15px;
        right: auto;
    }
    
    .bbw-modern-carousel-wrapper .carousel-navigation.nav-align-right,
    .bbw-modern-carousel-wrapper .navigation-container.nav-align-right {
        right: 15px;
        left: auto;
    }
    
    .bbw-modern-carousel-wrapper .carousel-navigation.nav-position-top,
    .bbw-modern-carousel-wrapper .navigation-container.nav-position-top {
        top: 0;
    }
    
    .bbw-modern-carousel-wrapper .carousel-navigation.nav-position-top.nav-align-right,
    .bbw-modern-carousel-wrapper .navigation-container.nav-position-top.nav-align-right {
        top: 0;
        right: 15px;
        left: auto;
    }
}

/* Mobile Navigation Arrows */
.bbw-modern-carousel-wrapper .nav-arrow {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.bbw-modern-carousel-wrapper .nav-arrow:hover {
    background-color: #fff;
    transform: scale(1.1);
}

.bbw-modern-carousel-wrapper .nav-arrow:active {
    transform: scale(1);
}

.bbw-modern-carousel-wrapper .nav-arrow svg {
    color: #333;
    width: 20px;
    height: 20px;
}

/* Pagination Styles */
.bbw-modern-carousel-wrapper .carousel-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 15px 0;
    z-index: 5;
}

.bbw-modern-carousel-wrapper .pagination-item {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.bbw-modern-carousel-wrapper .pagination-item:hover {
    transform: scale(1.1);
}

.bbw-modern-carousel-wrapper .pagination-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Dot pagination */
.bbw-modern-carousel-wrapper .pagination-dot {
    display: block;
    width: 8px;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.bbw-modern-carousel-wrapper .pagination-item.active .pagination-dot {
    background-color: #000;
    transform: scale(1.2);
}

/* Number pagination */
.bbw-modern-carousel-wrapper .pagination-number {
    display: inline-block;
    min-width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.bbw-modern-carousel-wrapper .pagination-item.active .pagination-number {
    background-color: #000;
    color: #fff;
    transform: scale(1.1);
}

/* Progress bar pagination */
.bbw-modern-carousel-wrapper .pagination-progress {
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.bbw-modern-carousel-wrapper .pagination-progress-bar {
    height: 100%;
    background-color: #000;
    transition: width 0.3s ease;
}

/* Show on touch devices/small screens */
@media (pointer: coarse), (max-width: 1024px) {
    .bbw-modern-carousel-wrapper .mobile-learn-more {
        display: inline-block;
    }
    .bbw-modern-carousel-wrapper .carousel-container {
        cursor: auto;
    }
}

/* Tablet View: 2.5 items visible */
@media (min-width: 768px) and (max-width: 1024px) {
    .bbw-modern-carousel-wrapper .carousel-item {
        width: 40vw;
    }
}

/* Mobile View: 1 item visible */
@media (max-width: 767px) {
    .bbw-modern-carousel-wrapper .carousel-item {
        width: 100vw;
    }
    .bbw-modern-carousel-wrapper.disable-smooth-scroll .carousel-track {
        transition: none;
    }
}

/* Elementor Editor Compatibility */
.elementor-editor-active .bbw-modern-carousel-wrapper .custom-cursor {
    display: none;
}

.elementor-editor-active .bbw-modern-carousel-wrapper .carousel-container {
    cursor: auto;
}

/* Performance optimizations */
.bbw-modern-carousel-wrapper .carousel-track {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
}

.bbw-modern-carousel-wrapper .carousel-item img {
    backface-visibility: hidden;
}

.bbw-modern-carousel-wrapper .custom-cursor {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Accessibility improvements */
.bbw-modern-carousel-wrapper .nav-arrow:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.bbw-modern-carousel-wrapper .carousel-item:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Loading state */
.bbw-modern-carousel-wrapper .carousel-item img[src=""],
.bbw-modern-carousel-wrapper .carousel-item img:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bbw-modern-carousel-wrapper .custom-cursor {
        background-color: #000;
        border: 2px solid #fff;
    }
    
    .bbw-modern-carousel-wrapper .nav-arrow {
        background-color: #fff;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bbw-modern-carousel-wrapper .carousel-item img {
        transition: none;
    }
    
    .bbw-modern-carousel-wrapper .custom-cursor {
        transition: none;
    }
    
    .bbw-modern-carousel-wrapper .nav-arrow {
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .bbw-modern-carousel-wrapper .image-wrapper {
        background-color: #2a2a2a;
    }
    
    .bbw-modern-carousel-wrapper .item-info .title {
        color: #fff;
    }
    
    .bbw-modern-carousel-wrapper .item-info .category {
        color: #ccc;
    }
    
    .bbw-modern-carousel-wrapper .mobile-learn-more {
        color: #ccc;
    }
    
    .bbw-modern-carousel-wrapper .mobile-learn-more:hover {
        color: #fff;
    }
    
    .bbw-modern-carousel-wrapper .nav-arrow {
        background-color: rgba(40, 40, 40, 0.9);
        border-color: #555;
    }
    
    .bbw-modern-carousel-wrapper .nav-arrow svg {
        color: #fff;
    }
}