/**
 * Property Carousel Component
 * Enhanced image carousel for property cards with smooth animations
 */

/* ==========================================================================
   Carousel Container
   ========================================================================== */

.property-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
}

.carousel-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.carousel-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* ==========================================================================
   Navigation Controls
   ========================================================================== */

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.property-carousel:hover .carousel-nav {
    opacity: 1;
    pointer-events: auto;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/* ==========================================================================
   Carousel Indicators
   ========================================================================== */

.carousel-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.property-carousel:hover .carousel-indicators {
    opacity: 1;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.carousel-indicator.active,
.carousel-indicator:hover {
    background: white;
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Touch/Mobile Interactions
   ========================================================================== */

.property-carousel {
    touch-action: pan-x;
}

.carousel-slide {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Mobile Portrait */
@media (max-width: 480px) {
    .carousel-nav {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
    
    .carousel-prev {
        left: 8px;
    }
    
    .carousel-next {
        right: 8px;
    }
    
    .carousel-indicators {
        bottom: 10px;
        gap: 4px;
    }
    
    .carousel-indicator {
        width: 6px;
        height: 6px;
    }
    
    /* Always show controls on mobile for better UX */
    .carousel-nav,
    .carousel-indicators {
        opacity: 0.7;
        pointer-events: auto;
    }
    
    .property-carousel:hover .carousel-nav,
    .property-carousel:hover .carousel-indicators {
        opacity: 1;
    }
}

/* Mobile Landscape / Small Tablet */
@media (max-width: 768px) {
    .carousel-nav {
        width: 34px;
        height: 34px;
        font-size: 0.75rem;
    }
}

/* Large Screens */
@media (min-width: 1200px) {
    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .carousel-prev {
        left: 12px;
    }
    
    .carousel-next {
        right: 12px;
    }
    
    .carousel-indicators {
        bottom: 15px;
        gap: 8px;
    }
    
    .carousel-indicator {
        width: 10px;
        height: 10px;
    }
}

/* ==========================================================================
   Animation Enhancements
   ========================================================================== */

/* Slide transition effects */
.carousel-slide.slide-in-right {
    animation: slideInRight 0.5s ease-out forwards;
}

.carousel-slide.slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

.carousel-slide.slide-out-left {
    animation: slideOutLeft 0.5s ease-in forwards;
}

.carousel-slide.slide-out-right {
    animation: slideOutRight 0.5s ease-in forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading animation */
.carousel-loading {
    position: relative;
}

.carousel-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Focus states */
.carousel-nav:focus,
.carousel-indicator:focus {
    outline: 2px solid var(--accent-color, #d4af37);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .carousel-nav,
    .carousel-indicator {
        transition: none;
    }
    
    .carousel-slide.slide-in-right,
    .carousel-slide.slide-in-left,
    .carousel-slide.slide-out-left,
    .carousel-slide.slide-out-right {
        animation: none;
    }
    
    .property-carousel:hover .carousel-slide img {
        transform: none;
    }
}