/**
 * Custom styles for UI plugins integration
 * Swiper, PhotoSwipe, and AOS customizations for La Palabra Final
 */

/* ========================================
   SWIPER CUSTOMIZATIONS
   ======================================== */

/* Swiper container */
.post-carousel.swiper {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Swiper slide */
.swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--ig-secondary-background, #fafafa);
}

.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Swiper navigation buttons */
.swiper-button-prev,
.swiper-button-next {
    width: 40px !important;
    height: 40px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1);
}

.swiper-button-prev:after,
.swiper-button-next:after {
    font-size: 16px !important;
    font-weight: bold !important;
    color: var(--ig-primary-text, #262626) !important;
}

.swiper-button-prev {
    left: 10px !important;
}

.swiper-button-next {
    right: 10px !important;
}

.swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

/* Swiper pagination */
.swiper-pagination {
    bottom: 12px !important;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.swiper-pagination-bullet {
    width: 8px !important;
    height: 8px !important;
    background: rgba(255, 255, 255, 0.6) !important;
    opacity: 1 !important;
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease !important;
}

.swiper-pagination-bullet-active {
    background: white !important;
    width: 24px !important;
    border-radius: 4px !important;
    border-color: rgba(0, 0, 0, 0.4);
}

/* Dark theme adjustments for Swiper */
:root.darkTheme .swiper-button-prev,
:root.darkTheme .swiper-button-next {
    background: rgba(0, 0, 0, 0.7) !important;
}

:root.darkTheme .swiper-button-prev:hover,
:root.darkTheme .swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.9) !important;
}

:root.darkTheme .swiper-button-prev:after,
:root.darkTheme .swiper-button-next:after {
    color: white !important;
}

:root.darkTheme .swiper-pagination-bullet {
    background: rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.2);
}

:root.darkTheme .swiper-pagination-bullet-active {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.4);
}


/* ========================================
   PHOTOSWIPE CUSTOMIZATIONS
   ======================================== */

/* Custom caption styling - enhanced */
.pswp__custom-caption {
    animation: slideUpFade 0.3s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* PhotoSwipe UI button customizations */
.pswp__button {
    transition: all 0.2s ease !important;
}

.pswp__button:hover {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Share button hover effect */
.pswp__button--share-button:hover svg {
    transform: scale(1.15);
    transition: transform 0.2s ease;
}

/* PhotoSwipe zoom animation */
.pswp__img {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}


/* ========================================
   AOS CUSTOM ANIMATIONS
   ======================================== */

/* Custom fade-up with scale */
[data-aos="fade-up-scale"] {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition-property: transform, opacity;
}

[data-aos="fade-up-scale"].aos-animate {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Stagger effect enhancement */
[data-aos][data-aos-delay] {
    transition-delay: 0s;
}

[data-aos][data-aos-delay].aos-animate {
    transition-delay: attr(data-aos-delay ms);
}

/* Smooth appearance for posts */
.post-card[data-aos] {
    will-change: transform, opacity;
}


/* ========================================
   INTEGRATION FIXES
   ======================================== */

/* Ensure post counter works with Swiper */
.post-carousel.swiper .post-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    backdrop-filter: blur(4px);
}

/* Hide old navigation when Swiper is active */
.post-carousel.swiper .post-nav {
    display: none;
}

.post-carousel.swiper .post-indicators {
    display: none;
}

/* Ensure overlay still works with Swiper */
.post-carousel.swiper .post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
}


/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Smaller navigation on mobile */
    .swiper-button-prev,
    .swiper-button-next {
        width: 32px !important;
        height: 32px !important;
    }

    .swiper-button-prev:after,
    .swiper-button-next:after {
        font-size: 14px !important;
    }

    /* Adjust PhotoSwipe padding for mobile */
    .pswp__custom-caption {
        max-width: 90%;
        padding: 12px 20px;
        bottom: 15px;
        font-size: 14px;
    }

    .pswp__caption-title {
        font-size: 14px;
    }

    .pswp__caption-date {
        font-size: 12px;
    }
}


/* ========================================
   LOADING STATES
   ======================================== */

/* Swiper loading skeleton */
.swiper-slide.loading {
    background: linear-gradient(
        90deg,
        var(--ig-secondary-background, #f0f0f0) 25%,
        var(--ig-hover-overlay, #e0e0e0) 50%,
        var(--ig-secondary-background, #f0f0f0) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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


/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU acceleration for smooth animations */
.swiper-slide,
.post-card[data-aos],
.pswp__img {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .swiper-slide,
    .post-card[data-aos],
    [data-aos] {
        animation: none !important;
        transition: none !important;
    }

    .swiper-pagination-bullet-active {
        transition: none !important;
    }
}
