/* app/static/css/carousel.css - Carousel Styles with Swiper Support */

/* Category Card Hover Effects */
.category-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Listings Carousel Container */
.listings-carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0 -10px;
    padding: 0 10px;
}

/* Base Carousel (before Swiper init) */
.listings-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    padding: 5px 0 15px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.listings-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Listing Cards */
.listing-card-small {
    flex: 0 0 200px;
    min-width: 200px;
    max-width: 200px;
}

.listing-thumbnail-small {
    height: 120px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

/* Mini Cards (Recently Viewed) */
.listing-card-mini {
    flex: 0 0 120px;
    min-width: 120px;
    max-width: 120px;
}

.listing-thumbnail-mini {
    height: 80px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

/* Legacy Navigation Buttons (for header controls) */
.carousel-nav-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    flex-shrink: 0;
}

.carousel-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.carousel-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Swiper-Specific Overrides
   ============================================ */

/* When initialized as Swiper */
.listings-carousel.swiper {
    overflow: hidden;
    padding: 10px 0 35px 0;
}

.listings-carousel.swiper .swiper-wrapper {
    align-items: stretch;
}

.listings-carousel.swiper .swiper-slide {
    width: 200px;
    height: auto;
}

/* Mini card slides (Recently Viewed) - match card width */
#recent-carousel.swiper .swiper-slide {
    width: 200px;
}

/* Swiper Navigation */
.listings-carousel .swiper-button-next,
.listings-carousel .swiper-button-prev {
    color: #F15A29;
    background: rgba(255, 255, 255, 0.95);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    top: 40%;
}

.listings-carousel .swiper-button-next:after,
.listings-carousel .swiper-button-prev:after {
    font-size: 14px;
    font-weight: bold;
}

.listings-carousel .swiper-button-next:hover,
.listings-carousel .swiper-button-prev:hover {
    background: #F15A29;
    color: white;
    transform: scale(1.1);
}

.listings-carousel .swiper-button-disabled {
    opacity: 0.3 !important;
    pointer-events: none;
}

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

.listings-carousel .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #ccc;
    opacity: 1;
    transition: all 0.2s ease;
}

.listings-carousel .swiper-pagination-bullet-active {
    background: #F15A29;
    width: 20px;
    border-radius: 4px;
}

/* ============================================
   Card Hover Effects
   ============================================ */
.listing-card-clickable {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.listing-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */
@media (max-width: 768px) {
    .listing-card-small {
        flex: 0 0 160px;
        min-width: 160px;
        max-width: 160px;
    }

    .listing-thumbnail-small {
        height: 100px;
    }

    .listing-card-mini {
        flex: 0 0 100px;
        min-width: 100px;
        max-width: 100px;
    }

    .listing-thumbnail-mini {
        height: 65px;
    }

    .carousel-nav-btn {
        width: 35px;
        height: 35px;
    }

    /* Hide Swiper nav buttons on mobile */
    .listings-carousel .swiper-button-next,
    .listings-carousel .swiper-button-prev {
        display: none !important;
    }

    .listings-carousel.swiper .swiper-slide {
        width: 160px;
    }

    /* Mini card slides on tablet */
    #recent-carousel.swiper .swiper-slide {
        width: 100px;
    }

    .listings-carousel-container {
        margin: 0 -15px;
        padding: 0 15px;
    }

    /* Native momentum scrolling on mobile (cssMode) */
    .listings-carousel.swiper {
        overflow: visible;
    }

    .listings-carousel.swiper .swiper-wrapper {
        /* Enable native iOS/Android momentum scrolling */
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .listings-carousel.swiper .swiper-slide {
        scroll-snap-align: start;
    }
}

@media (max-width: 480px) {
    .listing-card-small {
        flex: 0 0 140px;
        min-width: 140px;
        max-width: 140px;
    }

    .listing-thumbnail-small {
        height: 90px;
    }

    .listing-card-mini {
        flex: 0 0 90px;
        min-width: 90px;
        max-width: 90px;
    }

    .listing-thumbnail-mini {
        height: 55px;
    }

    .listings-carousel.swiper .swiper-slide {
        width: 140px;
    }

    /* Mini card slides on mobile */
    #recent-carousel.swiper .swiper-slide {
        width: 90px;
    }

    /* Smaller card text on mobile */
    .listing-card-small .card-title {
        font-size: 0.75rem;
        line-height: 1.2;
    }

    .listing-card-small .card-text {
        font-size: 0.65rem;
    }

    .listing-card-small .text-primary.fw-bold {
        font-size: 0.8rem;
    }
}

/* ============================================
   Premium Spotlight Carousel
   ============================================ */
.premium-spotlight .carousel-indicators {
    bottom: 15px;
}

.premium-spotlight .carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    transition: all 0.3s ease;
}

.premium-spotlight .carousel-indicators button.active {
    background-color: white;
    width: 24px;
    border-radius: 6px;
}

.premium-spotlight .carousel-control-prev,
.premium-spotlight .carousel-control-next {
    width: 10%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.premium-spotlight:hover .carousel-control-prev,
.premium-spotlight:hover .carousel-control-next {
    opacity: 1;
}

@media (max-width: 768px) {
    .premium-spotlight .carousel-control-prev,
    .premium-spotlight .carousel-control-next {
        display: none;
    }

    .premium-spotlight .spotlight-image {
        height: 250px !important;
    }

    .premium-spotlight .carousel-caption {
        padding: 1rem !important;
    }

    .premium-spotlight .carousel-caption h2 {
        font-size: 1.25rem !important;
    }

    .premium-spotlight .carousel-caption p {
        display: none;
    }

    .premium-spotlight .h2.text-primary {
        font-size: 1.25rem !important;
    }
}

/* ============================================
   Touch Feedback
   ============================================ */
@media (max-width: 768px) {
    .listings-carousel .swiper-slide:active .listing-card-clickable {
        transform: scale(0.98);
    }
}

/* ============================================
   Card Price & Meta Styling
   ============================================ */
.listing-card-small .card-body,
.listing-card-mini .card-body {
    padding: 0.5rem;
}

.listing-card-small .card-title,
.listing-card-mini .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.listing-card-small .text-primary.fw-bold,
.listing-card-mini .text-primary.fw-bold {
    color: #F15A29 !important;
    font-size: 0.9rem;
}

.listing-card-small .text-muted,
.listing-card-mini .text-muted {
    font-size: 0.75rem;
    line-height: 1.4;
    /* Truncate location to single line for consistent card height */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Boost badge overlay on image */
.boost-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #F15A29 0%, #d94820 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

.boost-badge i {
    font-size: 0.65rem;
}

/* Boost indicator in cards (legacy - can be removed) */
.listing-card-small .card-header,
.listing-card-mini .card-header {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

/* Kudo badge */
.listing-card-small .badge.bg-warning,
.listing-card-mini .badge.bg-warning {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

/* ============================================
   Swipe Hint Animation
   ============================================ */
.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    animation: swipeHint 2s ease-in-out forwards;
    animation-delay: 1s;
}

.swipe-indicator::before {
    content: '👆';
    font-size: 2rem;
    animation: swipeMotion 1s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

@keyframes swipeMotion {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
}

/* Only show on mobile, first visit */
@media (min-width: 769px) {
    .swipe-indicator {
        display: none;
    }
}
