/**
 * Modern 3D Carousel Styles for PGPL Recent Work Section
 * Features: 3D transforms, smooth animations, lightbox integration
 */

/* ===== CAROUSEL WRAPPER ===== */
.recent-work-3d {
    position: relative;
    overflow: hidden;
    padding: 80px 0;
    background-color: #f8f9fa !important;
}

.recent-work-3d .section-header-wrapper {
    position: relative;
    z-index: 100;
    margin-bottom: 60px;
    text-align: center;
}

.recent-work-3d .section-title {
    font-size: 3.6rem;
    font-weight: 700;
    color: #1a1a1a !important;
    margin-bottom: 15px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.recent-work-3d .section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, transparent, #e31e26, transparent);
    border-radius: 2px;
}

.recent-work-3d .section-subtitle {
    font-size: 1.8rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.carousel-3d-wrapper {
    position: relative;
    width: 100%;
    margin: 60px auto;
    padding: 40px 0;
}

/* ===== 3D CAROUSEL CONTAINER ===== */
.carousel-3d {
    position: relative;
    width: 100%;
    height: 500px;
    perspective: 1800px;
    perspective-origin: 50% 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

/* ===== CAROUSEL SLIDES ===== */
.carousel-3d-slide {
    position: absolute;
    width: 450px;
    height: 350px;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    cursor: pointer;
    will-change: transform, opacity;
}

/* Default Hidden State */
.carousel-3d-slide {
    opacity: 0;
    transform: translateX(0) translateZ(-400px) rotateY(0deg) scale(0.5);
    pointer-events: none;
    z-index: 1;
}

/* Active Slide (Center) */
.carousel-3d-slide[data-position="active"] {
    opacity: 1;
    transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
    z-index: 10;
    pointer-events: auto;
}

/* Previous Slide (Left) */
.carousel-3d-slide[data-position="prev"] {
    opacity: 0.85;
    transform: translateX(-65%) translateZ(-200px) rotateY(35deg) scale(0.85);
    z-index: 8;
    pointer-events: auto;
}

/* Next Slide (Right) */
.carousel-3d-slide[data-position="next"] {
    opacity: 0.85;
    transform: translateX(65%) translateZ(-200px) rotateY(-35deg) scale(0.85);
    z-index: 8;
    pointer-events: auto;
}

/* Far Left Slide */
.carousel-3d-slide[data-position="prev-2"] {
    opacity: 0.5;
    transform: translateX(-110%) translateZ(-350px) rotateY(50deg) scale(0.65);
    z-index: 6;
    pointer-events: none;
}

/* Far Right Slide */
.carousel-3d-slide[data-position="next-2"] {
    opacity: 0.5;
    transform: translateX(110%) translateZ(-350px) rotateY(-50deg) scale(0.65);
    z-index: 6;
    pointer-events: none;
}

/* ===== CAROUSEL CARD STYLING ===== */
.carousel-3d-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    transition: all 0.4s ease;
    transform-style: preserve-3d;
}

.carousel-3d-slide[data-position="active"] .carousel-3d-card {
    box-shadow: 
        0 30px 80px rgba(227, 30, 38, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.carousel-3d-card:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 35px 90px rgba(227, 30, 38, 0.3),
        0 15px 40px rgba(0, 0, 0, 0.2);
}

/* ===== IMAGE CONTAINER ===== */
.carousel-3d-image {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.carousel-3d-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease, filter 0.4s ease;
}

.carousel-3d-card:hover .carousel-3d-image img {
    transform: scale(1.1);
    filter: brightness(1.05);
}

/* Shine Effect Overlay */
.carousel-3d-shine {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform 0.8s ease;
    pointer-events: none;
}

.carousel-3d-slide[data-position="active"] .carousel-3d-card:hover .carousel-3d-shine {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

/* ===== CARD CONTENT ===== */
.carousel-3d-content {
    padding: 20px 25px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    position: relative;
}

.carousel-3d-content h4 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.carousel-3d-card:hover .carousel-3d-content h4 {
    color: var(--color-primary, #e31e26);
}

.carousel-3d-content p {
    font-size: 1.4rem;
    color: #666;
    margin: 0 0 15px 0;
    line-height: 1.6;
}

/* Badge */
.carousel-3d-badge {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #e31e26 0%, #c41920 100%);
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(227, 30, 38, 0.25);
    transition: all 0.3s ease;
}

.carousel-3d-card:hover .carousel-3d-badge {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(227, 30, 38, 0.35);
}

/* ===== NAVIGATION CONTROLS ===== */
.carousel-3d-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-top: 50px;
    position: relative;
    z-index: 50;
}

.carousel-3d-nav {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid rgba(227, 30, 38, 0.2);
    color: #e31e26;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    z-index: 100;
    pointer-events: auto;
}

.carousel-3d-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e31e26 0%, #c41920 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.carousel-3d-nav:hover {
    transform: scale(1.1);
    border-color: #e31e26;
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(227, 30, 38, 0.3);
}

.carousel-3d-nav:hover::before {
    opacity: 1;
}

.carousel-3d-nav:active {
    transform: scale(0.95);
}

/* Indicators */
.carousel-3d-indicators {
    display: flex;
    gap: 12px;
    align-items: center;
}

.carousel-3d-indicators .indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d0d0d0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.carousel-3d-indicators .indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(227, 30, 38, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-3d-indicators .indicator:hover::before {
    opacity: 1;
}

.carousel-3d-indicators .indicator.active {
    background: linear-gradient(135deg, #e31e26 0%, #c41920 100%);
    width: 14px;
    height: 14px;
    box-shadow: 0 0 10px rgba(227, 30, 38, 0.5);
}

/* ===== CTA BUTTON ===== */
.recent-work-3d .carousel-cta {
    margin-top: 50px;
    text-align: center;
    position: relative;
    z-index: 100;
}

.recent-work-3d .carousel-cta .btn {
    background: linear-gradient(135deg, #e31e26 0%, #c11119 100%);
    color: #ffffff;
    padding: 18px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 8px 25px rgba(227, 30, 38, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.recent-work-3d .carousel-cta .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(227, 30, 38, 0.4);
    background: linear-gradient(135deg, #ff2936 0%, #e31e26 100%);
}

.recent-work-3d .carousel-cta .btn:active {
    transform: translateY(-1px);
}

/* ===== CUSTOM LIGHTBOX ===== */
.custom-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
}

.custom-lightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(2px);
}

.lightbox-content {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 60px 20px;
    flex-wrap: wrap;
    flex-direction: column;
}

.lightbox-image-wrapper {
    position: relative;
    width: auto !important;
    max-width: 95vw !important;
    max-height: auto !important;
    animation: lightboxZoomIn 0.4s ease;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    flex-shrink: 1;
    margin: 0 auto !important;
    padding: 0;
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Image quality enhancement */
.lightbox-image-wrapper img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 90vw !important;
    max-height: 80vh !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    background-color: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    margin: 0 auto !important;
    padding: 0;
    /* High quality image rendering for photographs */
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    -ms-interpolation-mode: bicubic;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.lightbox-caption {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 500;
    padding: 15px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    border-radius: 0 0 12px 12px;
}

.lightbox-close {
    display: flex !important;
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    font-size: 2.4rem !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    z-index: 10001 !important;
    opacity: 0;
    visibility: hidden;
}

.custom-lightbox.active .lightbox-close {
    opacity: 1 !important;
    visibility: visible !important;
}

.lightbox-close:hover {
    background: rgba(227, 30, 38, 0.9);
    border-color: #e31e26;
    transform: rotate(90deg) scale(1.1);
}

.lightbox-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    font-size: 2.4rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    z-index: 10001 !important;
    opacity: 0;
    visibility: hidden;
}

.custom-lightbox.active .lightbox-nav {
    opacity: 1 !important;
    visibility: visible !important;
}

.lightbox-nav:hover {
    background: rgba(227, 30, 38, 0.9);
    border-color: #e31e26;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 30px !important;
}

.lightbox-next {
    right: 30px !important;
}

.lightbox-counter {
    position: fixed !important;
    top: 25px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: #ffffff !important;
    font-size: 1.6rem !important;
    font-weight: 500 !important;
    padding: 10px 20px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(5px);
    border-radius: 25px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    z-index: 10001 !important;
    opacity: 0;
    visibility: hidden;
}

.custom-lightbox.active .lightbox-counter {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Large Tablets */
@media (max-width: 1199px) {
    .carousel-3d {
        height: 450px;
    }

    .carousel-3d-slide {
        width: 400px;
        height: 320px;
    }

    .carousel-3d-image {
        height: 220px;
    }

    .carousel-3d-slide[data-position="prev-2"],
    .carousel-3d-slide[data-position="next-2"] {
        display: none;
    }

    .carousel-3d-slide[data-position="prev"] {
        transform: translateX(-75%) translateZ(-150px) rotateY(30deg) scale(0.8);
    }

    .carousel-3d-slide[data-position="next"] {
        transform: translateX(75%) translateZ(-150px) rotateY(-30deg) scale(0.8);
    }
}

/* Tablets */
@media (max-width: 991px) {
    .carousel-3d {
        height: 420px;
        perspective: 1400px;
    }

    .carousel-3d-slide {
        width: 360px;
        height: 300px;
    }

    .carousel-3d-image {
        height: 200px;
    }

    .carousel-3d-content h4 {
        font-size: 1.6rem;
    }

    .carousel-3d-content p {
        font-size: 1.3rem;
    }

    .carousel-3d-nav {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }
}

/* Mobile Landscape */
@media (max-width: 767px) {
    .recent-work-3d {
        padding: 60px 0;
    }

    .carousel-3d-wrapper {
        margin: 40px auto;
    }

    .carousel-3d {
        height: 380px;
        perspective: 1000px;
    }

    .carousel-3d-slide {
        width: 320px;
        height: 280px;
    }

    .carousel-3d-image {
        height: 180px;
    }

    /* Hide side slides on mobile */
    .carousel-3d-slide[data-position="prev"],
    .carousel-3d-slide[data-position="next"] {
        opacity: 0.3;
        transform: translateX(-50%) translateZ(-100px) rotateY(0deg) scale(0.7);
        pointer-events: none;
    }

    .carousel-3d-slide[data-position="next"] {
        transform: translateX(50%) translateZ(-100px) rotateY(0deg) scale(0.7);
    }

    .carousel-3d-controls {
        gap: 20px;
        margin-top: 40px;
    }

    .carousel-3d-nav {
        width: 45px;
        height: 45px;
        font-size: 1.6rem;
    }

    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }

    .lightbox-prev {
        left: 15px;
    }

    .lightbox-next {
        right: 15px;
    }

    .lightbox-close {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .carousel-3d {
        height: 350px;
    }

    .carousel-3d-slide {
        width: 290px;
        height: 260px;
    }

    .carousel-3d-image {
        height: 170px;
    }

    .carousel-3d-content {
        padding: 15px 20px;
    }

    .carousel-3d-content h4 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .carousel-3d-content p {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .carousel-3d-badge {
        font-size: 1.1rem;
        padding: 5px 12px;
    }

    .carousel-3d-indicators .indicator {
        width: 10px;
        height: 10px;
    }

    .carousel-3d-indicators .indicator.active {
        width: 12px;
        height: 12px;
    }

    .lightbox-caption {
        font-size: 1.5rem;
        bottom: -50px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .carousel-3d {
        height: 320px;
    }

    .carousel-3d-slide {
        width: 270px;
        height: 240px;
    }

    .carousel-3d-image {
        height: 155px;
    }

    .carousel-3d-controls {
        gap: 15px;
    }

    .carousel-3d-nav {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .carousel-3d-slide,
    .carousel-3d-card,
    .carousel-3d-image img,
    .carousel-3d-shine,
    .carousel-3d-nav,
    .carousel-3d-indicators .indicator,
    .custom-lightbox {
        transition: none;
        animation: none;
    }
}

/* Focus States for Keyboard Navigation */
.carousel-3d-nav:focus,
.carousel-3d-indicators .indicator:focus,
.lightbox-close:focus,
.lightbox-nav:focus {
    outline: 3px solid rgba(227, 30, 38, 0.5);
    outline-offset: 3px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .carousel-3d-card {
        border: 2px solid currentColor;
    }

    .carousel-3d-nav,
    .lightbox-close,
    .lightbox-nav {
        border-width: 3px;
    }
}
