/**
 * Portfolio Slider Styles
 * Responsive image/video sliders with lightbox
 */

/* Portfolio Section */
.portfolio-slider-section {
    padding: 60px 0;
}

.portfolio-slider-section[data-type="image"] {
    background: #f8f8f6; /* Light bone for images */
}

.portfolio-slider-section[data-type="video"] {
    background: #fff; /* White for videos */
}

/* Portfolio Slider Container */
.portfolio-slider {
    position: relative;
    overflow: hidden;
    margin-top: 30px;
    padding-bottom: 50px; /* Space for pagination */
}

/* Swiper Wrapper */
.swiper-wrapper {
    display: flex;
}

/* Portfolio Item (Swiper Slide) */
.portfolio-item {
    flex-shrink: 0;
    width: 100%;
}

.portfolio-item-inner {
    position: relative;
    width: 100%;
    height: 400px; /* Fixed height */
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.portfolio-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lazy Loading States */
.portfolio-item-inner img.swiper-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item-inner img.swiper-lazy-loaded {
    opacity: 1;
}

/* Swiper Lazy Preloader */
.swiper-lazy-preloader {
    width: 42px;
    height: 42px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -21px;
    margin-top: -21px;
    z-index: 10;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: swiper-preloader-spin 1s linear infinite;
}

@keyframes swiper-preloader-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Portfolio Caption */
.portfolio-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 40px 20px 20px;
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item-inner:hover .portfolio-caption {
    opacity: 1;
}

/* Zoom Button (for images) */
.portfolio-zoom {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.portfolio-item-inner:hover .portfolio-zoom {
    opacity: 1;
}

.portfolio-zoom:hover {
    transform: scale(1.1);
    background: white;
}

.portfolio-zoom svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Play Button (for videos) */
.portfolio-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10;
}

.portfolio-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.portfolio-play-btn svg {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Swiper Navigation Buttons */
.swiper-button-prev,
.swiper-button-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.swiper-button-prev:after,
.swiper-button-next:after {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: white;
    transform: scale(1.1);
}

/* Swiper Pagination */
.swiper-pagination {
    bottom: 10px !important;
}

.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #999;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: var(--red, #C2261B);
    opacity: 1;
    transform: scale(1.2);
}

/* Old slider controls - keep for compatibility */
.slider-ctrl {
    display: none; /* Hide old custom controls */
}

/* Lightbox Overlay */
.portfolio-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 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;
}

.portfolio-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.portfolio-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.portfolio-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
}

.portfolio-lightbox video {
    max-width: 100%;
    max-height: 90vh;
    display: block;
}

.portfolio-lightbox iframe {
    width: 90vw;
    height: calc(90vw * 9 / 16); /* 16:9 aspect ratio */
    max-height: 90vh;
    border: none;
}

/* Lightbox Close Button */
.portfolio-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 100000;
}

.portfolio-lightbox-close:hover {
    background: white;
    transform: scale(1.1);
}

.portfolio-lightbox-close svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* Loading Spinner */
.portfolio-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .portfolio-item-inner {
        height: 350px;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 45px;
        height: 45px;
    }
    
    .swiper-button-prev:after,
    .swiper-button-next:after {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .portfolio-item-inner {
        height: 300px;
    }
    
    .portfolio-play-btn svg {
        width: 60px;
        height: 60px;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 40px;
        height: 40px;
    }
    
    .swiper-button-prev:after,
    .swiper-button-next:after {
        font-size: 16px;
    }
    
    .portfolio-lightbox iframe {
        width: 95vw;
        height: calc(95vw * 9 / 16);
    }
    
    .portfolio-slider-section {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .portfolio-item-inner {
        height: 250px;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 36px;
        height: 36px;
    }
    
    .swiper-button-prev:after,
    .swiper-button-next:after {
        font-size: 14px;
    }
    
    .portfolio-lightbox-close {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }
}

/* Lightbox Navigation Arrows */
.portfolio-lightbox-prev,
.portfolio-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    z-index: 100001;
    opacity: 0.8;
}

.portfolio-lightbox-prev {
    left: 30px;
}

.portfolio-lightbox-next {
    right: 30px;
}

.portfolio-lightbox-prev:hover,
.portfolio-lightbox-next:hover {
    background: white;
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.portfolio-lightbox-prev svg,
.portfolio-lightbox-next svg {
    width: 28px;
    height: 28px;
    color: #333;
}

/* Lightbox Counter */
.portfolio-lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 100000;
}

/* Error State */
.portfolio-error {
    color: white;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* Mobile Navigation Adjustments */
@media (max-width: 768px) {
    .portfolio-lightbox-prev,
    .portfolio-lightbox-next {
        width: 50px;
        height: 50px;
    }
    
    .portfolio-lightbox-prev {
        left: 15px;
    }
    
    .portfolio-lightbox-next {
        right: 15px;
    }
    
    .portfolio-lightbox-prev svg,
    .portfolio-lightbox-next svg {
        width: 24px;
        height: 24px;
    }
    
    .portfolio-lightbox-counter {
        bottom: 20px;
        font-size: 13px;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .portfolio-lightbox-prev,
    .portfolio-lightbox-next {
        width: 44px;
        height: 44px;
        opacity: 0.7;
    }
    
    .portfolio-lightbox-prev {
        left: 10px;
    }
    
    .portfolio-lightbox-next {
        right: 10px;
    }
    
    .portfolio-lightbox-prev svg,
    .portfolio-lightbox-next svg {
        width: 20px;
        height: 20px;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    .portfolio-item-inner {
        -webkit-tap-highlight-color: transparent;
    }
    
    .portfolio-lightbox-prev,
    .portfolio-lightbox-next,
    .portfolio-lightbox-close {
        min-width: 44px;
        min-height: 44px;
    }
}
