/* Carousel Styles */
.space-carousel {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.space-carousel:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1000px;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(1.05) translateZ(0);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    cursor: pointer;
    will-change: opacity, transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.carousel-slide.active {
    opacity: 1;
    display: block;
    transform: scale(1) translateZ(0);
}

.carousel-slide img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.space-carousel:hover .carousel-slide.active img {
    transform: scale(1.03);
}

.carousel-controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.space-carousel:hover .carousel-controls {
    opacity: 1;
    pointer-events: all;
}

.carousel-prev,
.carousel-next {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateZ(0);
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1) translateZ(0);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.carousel-prev:active,
.carousel-next:active {
    transform: scale(0.95) translateZ(0);
}

.carousel-indicators {
    position: absolute;
    bottom: 14px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.space-carousel:hover .carousel-indicators {
    opacity: 1;
    pointer-events: all;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0;
}

.carousel-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 50%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-indicator.active {
    width: 24px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
}

.carousel-indicator:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.15);
}

/* Space card adjustments */
.space-card {
    display: flex;
    flex-direction: column;
}

.space-card-content {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Fullscreen Modal */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-modal.active {
    display: flex;
    opacity: 1;
    animation: modalFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fullscreen-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    animation: imageZoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    will-change: transform;
}

@keyframes imageZoomIn {
    from {
        transform: scale(0.9) translateZ(0);
        opacity: 0;
    }
    to {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
}

.fullscreen-close {
    position: absolute;
    top: 24px;
    right: 24px;
    color: white;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.05);
}

.fullscreen-prev,
.fullscreen-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.fullscreen-prev {
    left: 32px;
}

.fullscreen-next {
    right: 32px;
}

.fullscreen-prev:hover,
.fullscreen-next:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.fullscreen-prev:active,
.fullscreen-next:active {
    transform: translateY(-50%) scale(0.95);
}

.fullscreen-caption {
    position: absolute;
    bottom: 32px;
    color: white;
    text-align: center;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 0 auto;
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .carousel-prev,
    .carousel-next {
        width: 30px;
        height: 30px;
    }
    
    .carousel-indicator {
        width: 8px;
        height: 8px;
    }
    
    .fullscreen-prev,
    .fullscreen-next {
        width: 40px;
        height: 40px;
    }
    
    .fullscreen-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 768px) {
    .space-carousel {
        height: 300px;
    }
    
    .fullscreen-caption {
        font-size: 14px;
        bottom: 20px;
        padding: 10px 16px;
    }
}

/* Loading states and smooth image rendering */
.carousel-slide img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.carousel-slide img:not([src]) {
    opacity: 0;
}

.carousel-slide img.loaded,
.carousel-slide img[src] {
    animation: imageLoad 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes imageLoad {
    from {
        opacity: 0;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhance button icons visibility */
.carousel-prev i,
.carousel-next i,
.fullscreen-prev i,
.fullscreen-next i {
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.fullscreen-prev i,
.fullscreen-next i {
    font-size: 22px;
}
