/* Hero Carousel Responsive Behavior */

/* CRITICAL: Hide mobile-only elements by default on all screens */
.hero-product.mobile-only {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Desktop (769px and up) - Show all 5 desktop products, hide mobile images */
@media (min-width: 769px) {
    /* CRITICAL: Ensure hero carousel is above navbar */
    #heroCarousel {
        position: relative !important;
        z-index: 100 !important;
        overflow: hidden !important;
    }

    /* CRITICAL: Override carousel-item height - 500px */
    .carousel-item,
    #heroCarousel .carousel-item {
        height: 500px !important;
        min-height: 500px !important;
        max-height: 500px !important;
        overflow: hidden !important;
    }

    /* Hide mobile-only images on desktop */
    .carousel-item .carousel-scene .hero-product.mobile-only,
    .hero-product.mobile-only {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -10000px !important;
        top: -10000px !important;
        z-index: -1000 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* Show all desktop products with proper positions - HIGHEST SPECIFICITY */
    .carousel-item.active .carousel-scene #hero-carousel .hero-product-1.desktop-only,
    .carousel-item .carousel-scene .hero-product-1.desktop-only,
    .hero-product-1.desktop-only {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
        top: 25% !important;
        left: 15% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        z-index: 100 !important;
        width: auto !important;
        height: auto !important;
        overflow: hidden !important;
    }

    .carousel-item.active .carousel-scene #hero-carousel .hero-product-2.desktop-only,
    .carousel-item .carousel-scene .hero-product-2.desktop-only,
    .hero-product-2.desktop-only {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
        top: 25% !important;
        right: 15% !important;
        left: auto !important;
        bottom: auto !important;
        transform: translate(50%, -50%) !important;
        z-index: 100 !important;
        width: auto !important;
        height: auto !important;
        overflow: hidden !important;
    }

    .carousel-item.active .carousel-scene #hero-carousel .hero-product-3.desktop-only,
    .carousel-item .carousel-scene .hero-product-3.desktop-only,
    .hero-product-3.desktop-only {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        z-index: 110 !important;
        width: auto !important;
        height: auto !important;
        overflow: hidden !important;
    }

    .carousel-item.active .carousel-scene #hero-carousel .hero-product-4.desktop-only,
    .carousel-item .carousel-scene .hero-product-4.desktop-only,
    .hero-product-4.desktop-only {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
        bottom: 25% !important;
        left: 15% !important;
        right: auto !important;
        top: auto !important;
        transform: translate(-50%, 50%) !important;
        z-index: 100 !important;
        width: auto !important;
        height: auto !important;
        overflow: hidden !important;
    }

    .carousel-item.active .carousel-scene #hero-carousel .hero-product-5.desktop-only,
    .carousel-item .carousel-scene .hero-product-5.desktop-only,
    .hero-product-5.desktop-only {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
        bottom: 25% !important;
        right: 15% !important;
        left: auto !important;
        top: auto !important;
        transform: translate(50%, 50%) !important;
        z-index: 100 !important;
        width: auto !important;
        height: auto !important;
        overflow: hidden !important;
    }

    /* CRITICAL: Adjust image sizes on desktop - larger, product 3 bigger, no shadow */
    #heroCarousel .carousel-item.active .carousel-scene .hero-product-1.desktop-only .hero-img,
    #heroCarousel .carousel-item .carousel-scene .hero-product-1.desktop-only .hero-img,
    #heroCarousel .hero-product-1.desktop-only .hero-img {
        width: 280px !important;
        height: 280px !important;
        object-fit: contain !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        filter: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    #heroCarousel .carousel-item.active .carousel-scene .hero-product-2.desktop-only .hero-img,
    #heroCarousel .carousel-item .carousel-scene .hero-product-2.desktop-only .hero-img,
    #heroCarousel .hero-product-2.desktop-only .hero-img {
        width: 280px !important;
        height: 280px !important;
        object-fit: contain !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        filter: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    #heroCarousel .carousel-item.active .carousel-scene .hero-product-3.desktop-only .hero-img,
    #heroCarousel .carousel-item .carousel-scene .hero-product-3.desktop-only .hero-img,
    #heroCarousel .hero-product-3.desktop-only .hero-img {
        width: 400px !important;
        height: 400px !important;
        object-fit: contain !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        filter: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    #heroCarousel .carousel-item.active .carousel-scene .hero-product-4.desktop-only .hero-img,
    #heroCarousel .carousel-item .carousel-scene .hero-product-4.desktop-only .hero-img,
    #heroCarousel .hero-product-4.desktop-only .hero-img {
        width: 280px !important;
        height: 280px !important;
        object-fit: contain !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        filter: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    #heroCarousel .carousel-item.active .carousel-scene .hero-product-5.desktop-only .hero-img,
    #heroCarousel .carousel-item .carousel-scene .hero-product-5.desktop-only .hero-img,
    #heroCarousel .hero-product-5.desktop-only .hero-img {
        width: 280px !important;
        height: 280px !important;
        object-fit: contain !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        filter: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Carousel title styling for desktop */
    .carousel-main-title {
        font-size: 2rem !important;
        text-align: center !important;
        color: white !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5) !important;
        position: absolute !important;
        top: 15px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        padding: 0 20px !important;
    }
}

/* Small screens (max-width: 768px) - Show only mobile-only images, hide all desktop */
@media (max-width: 768px) {
    /* CRITICAL: Blue gradient background using site color palette */
    #heroCarousel {
        background: linear-gradient(135deg, #0d2b5f 0%, #1946AB 30%, #3366CC 70%, #1a4a8c 100%) !important;
        background-color: #1946AB !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    /* Subtle light rays effect */
    #heroCarousel::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        right: -50%;
        bottom: -50%;
        background: radial-gradient(ellipse at center, rgba(255,255,255,0.08) 0%, transparent 60%);
        animation: rotate 30s linear infinite;
        pointer-events: none;
        z-index: 1;
    }
    
    @keyframes rotate {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
    
    /* CRITICAL: Override carousel-item height for mobile */
    .carousel-item,
    #heroCarousel .carousel-item {
        height: 60vh !important;
        min-height: 60vh !important;
        max-height: 60vh !important;
        background: transparent !important;
        background-color: transparent !important;
    }

    /* HIDE ALL DESKTOP ELEMENTS - Most specific rules */
    /* IMPORTANT: Exclude .mobile-only elements even if they have hero-product-N classes */
    .carousel-item .carousel-scene .hero-product-1:not(.mobile-only),
    .carousel-item .carousel-scene .hero-product-2:not(.mobile-only),
    .carousel-item .carousel-scene .hero-product-3:not(.mobile-only),
    .carousel-item .carousel-scene .hero-product-4:not(.mobile-only),
    .carousel-item .carousel-scene .hero-product-5:not(.mobile-only),
    .carousel-item .carousel-scene .hero-product.desktop-only,
    .carousel-item .carousel-scene .desktop-only,
    .hero-product.desktop-only,
    .hero-product-1:not(.mobile-only),
    .hero-product-2:not(.mobile-only),
    .hero-product-3:not(.mobile-only),
    .hero-product-4:not(.mobile-only),
    .hero-product-5:not(.mobile-only) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -10000px !important;
        top: -10000px !important;
        z-index: -1000 !important;
        transform: none !important;
        animation: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* SHOW ONLY MOBILE-ONLY - CLEAN DESIGN NO BORDES */
    .carousel-item .carousel-scene .hero-product.mobile-only,
    .hero-product.mobile-only {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        text-align: center !important;
        margin: 0 !important;
        max-width: 100vw !important;
        max-height: 50vh !important;
        width: 100% !important;
        height: auto !important;
        z-index: 100 !important;
        animation: none !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        flex-direction: column !important;
        gap: 0 !important;
        row-gap: 0 !important;
        column-gap: 0 !important;
    }

    /* CLEAN: Mobile images - SIN BORDES, ANCHO AUMENTADO */
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-img {
        width: 260px !important;
        height: 260px !important;
        max-width: 260px !important;
        max-height: 260px !important;
        object-fit: contain !important;
        filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25)) !important;
        transition: all 0.4s ease !important;
        display: block !important;
        margin: 0 auto !important;
        padding: 0 !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        float: none !important;
        text-align: center !important;
    }

    .carousel-item .carousel-scene .hero-product.mobile-only:hover .hero-img {
        transform: scale(1.03) !important;
    }

    /* CLEAN: Caption - POSICIONADO DEBAJO DE LA IMAGEN SIN MARGEN */
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-caption {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        background: linear-gradient(135deg, rgba(25, 70, 171, 0.95) 0%, rgba(51, 102, 204, 0.95) 100%) !important;
        border: none !important;
        border-radius: 20px !important;
        padding: 8px 20px !important;
        margin: 0 auto !important;
        margin-top: -20px !important;
        color: white !important;
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
        white-space: nowrap !important;
        width: auto !important;
        text-align: center !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
        z-index: 100 !important;
    }

    /* CLEAN: Title styling - SIN BORDES */
    .carousel-main-title {
        font-size: 0.8rem !important;
        text-align: center !important;
        color: white !important;
        font-weight: 600 !important;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4) !important;
        position: absolute !important;
        top: 12px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        padding: 6px 16px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(8px) !important;
        border-radius: 20px !important;
        border: none !important;
        white-space: nowrap !important;
    }
    
    /* Carousel indicators enhancement */
    #heroCarousel .carousel-indicators {
        bottom: 15px !important;
        z-index: 1001 !important;
    }
    
    #heroCarousel .carousel-indicators button {
        width: 10px !important;
        height: 10px !important;
        border-radius: 50% !important;
        background-color: rgba(255, 255, 255, 0.4) !important;
        border: 2px solid rgba(255, 255, 255, 0.6) !important;
        margin: 0 5px !important;
        transition: all 0.3s ease !important;
    }
    
    #heroCarousel .carousel-indicators button.active {
        background-color: #FFD700 !important;
        border-color: #FFD700 !important;
        transform: scale(1.2) !important;
    }
}

/* Extra small screens (max-width: 480px) */
@media (max-width: 480px) {
    .carousel-item,
    #heroCarousel .carousel-item {
        height: 55vh !important;
        min-height: 55vh !important;
        max-height: 55vh !important;
    }
    
    .carousel-item .carousel-scene .hero-product.mobile-only {
        padding: 0 !important;
        max-width: 100vw !important;
    }
    
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-img {
        width: 220px !important;
        height: 220px !important;
        max-width: 220px !important;
        max-height: 220px !important;
    }
    
    .carousel-main-title {
        font-size: 0.7rem !important;
        padding: 5px 12px !important;
    }
    
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-caption {
        font-size: 0.8rem !important;
        padding: 6px 16px !important;
        margin-top: -20px !important;
        background: linear-gradient(135deg, rgba(25, 70, 171, 0.95) 0%, rgba(51, 102, 204, 0.95) 100%) !important;
    }
}

/* Very small screens (max-width: 360px) */
@media (max-width: 360px) {
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-img {
        width: 180px !important;
        height: 180px !important;
        max-width: 180px !important;
        max-height: 180px !important;
    }
    
    .carousel-item .carousel-scene .hero-product.mobile-only .hero-caption {
        font-size: 0.75rem !important;
        padding: 5px 14px !important;
        margin-top: -20px !important;
        background: linear-gradient(135deg, rgba(25, 70, 171, 0.95) 0%, rgba(51, 102, 204, 0.95) 100%) !important;
    }
}