/**
 * Carrusel de Imágenes WP - Estilos
 * Plugin ligero sin dependencias externas
 */

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */
.ciwp-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.ciwp-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.ciwp-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
}

/* ==========================================================================
   SLIDES
   ========================================================================== */
.ciwp-slide {
    flex: 0 0 auto;
    box-sizing: border-box;
}

.ciwp-slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ciwp-slide-inner.ciwp-stretch {
    display: block;
}

.ciwp-slide-image {
    width: 100%;
    height: 100%;
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ciwp-stretch .ciwp-slide-image {
    width: 100%;
    height: auto;
}

/* Lazy loading placeholder */
.ciwp-slide-image.ciwp-lazy {
    opacity: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ciwp-shimmer 1.5s infinite;
}

.ciwp-slide-image.ciwp-lazy.ciwp-loaded {
    opacity: 1;
    animation: none;
    background: none;
}

@keyframes ciwp-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Hover effects */
.ciwp-slide-inner a {
    display: block;
    width: 100%;
    height: 100%;
}

.ciwp-slide-inner a:hover .ciwp-slide-image {
    transform: scale(1.05);
}

.ciwp-slide-inner a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ==========================================================================
   VIDEOS
   ========================================================================== */
.ciwp-slide-video .ciwp-slide-inner {
    background-color: #000;
}

.ciwp-video-iframe,
.ciwp-video-native {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.ciwp-video-native {
    object-fit: contain;
    background-color: #000;
}

/* ==========================================================================
   NAVEGACIÓN - FLECHAS
   ========================================================================== */
.ciwp-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    border-radius: 50%;
}

.ciwp-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.ciwp-arrow:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ciwp-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ciwp-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ciwp-arrow-prev {
    left: 10px;
}

.ciwp-arrow-next {
    right: 10px;
}

/* Ocultar flechas en móvil si hay poco espacio */
@media (max-width: 480px) {
    .ciwp-arrow {
        width: 36px;
        height: 36px;
    }
    
    .ciwp-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .ciwp-arrow-prev {
        left: 5px;
    }
    
    .ciwp-arrow-next {
        right: 5px;
    }
}

/* ==========================================================================
   NAVEGACIÓN - PUNTOS
   ========================================================================== */
.ciwp-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    gap: 8px;
    flex-wrap: wrap;
}

.ciwp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.ciwp-dot:hover {
    background-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.2);
}

.ciwp-dot.active {
    background-color: #000;
    transform: scale(1.2);
}

.ciwp-dot:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ==========================================================================
   LEYENDA / CAPTION
   ========================================================================== */
.ciwp-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

.ciwp-slide-inner:hover .ciwp-caption {
    opacity: 1;
}

/* ==========================================================================
   LIGHTBOX NATIVO
   ========================================================================== */
.ciwp-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ciwp-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ciwp-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.ciwp-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    object-fit: contain;
}

.ciwp-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: background-color 0.3s ease;
    z-index: 100000;
}

.ciwp-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ciwp-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.ciwp-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ciwp-lightbox-prev {
    left: 20px;
}

.ciwp-lightbox-next {
    right: 20px;
}

.ciwp-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
}

/* ==========================================================================
   MENSAJE SIN CONTENIDO
   ========================================================================== */
.ciwp-no-content {
    text-align: center;
    padding: 40px 20px;
    background-color: #f5f5f5;
    color: #666;
    border-radius: 4px;
}

/* ==========================================================================
   DRAG / TOUCH CURSOR
   ========================================================================== */
.ciwp-carousel-wrapper.ciwp-dragging {
    cursor: grabbing;
}

.ciwp-carousel-wrapper:not(.ciwp-dragging) .ciwp-track {
    cursor: grab;
}

/* Deshabilitar selección de texto durante arrastre */
.ciwp-carousel-wrapper.ciwp-dragging * {
    user-select: none;
    -webkit-user-select: none;
}

/* ==========================================================================
   ACCESIBILIDAD
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ciwp-track {
        transition: none;
    }
    
    .ciwp-slide-image,
    .ciwp-arrow,
    .ciwp-dot,
    .ciwp-caption {
        transition: none;
    }
    
    .ciwp-slide-image.ciwp-lazy {
        animation: none;
    }
}

/* Focus visible para navegación con teclado */
.ciwp-arrow:focus-visible,
.ciwp-dot:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 3px;
}
