/**
 * Mobile Horizontal Tour Card Layout
 * ===================================================
 * Mobile-first design with image on left, content on right
 * Desktop: Switches to vertical card layout
 *
 * Structure:
 * ┌─────────────────────────────────┐
 * │ [Image] │ Title               │
 * │         │ ⭐ 4.3 (3,491)      │
 * │         │ Pickup • 8h         │
 * │         │ From $113           │
 * └─────────────────────────────────┘
 */

/* ============================================
   Mobile First: Horizontal Layout (< 768px)
   ============================================ */

/* Debug borders removed after verification - spacing fix confirmed working */

/* === GLOBAL BASE STYLES (all viewports) === */

/* Article needs position context */
.pca-tour-card {
    position: relative;
}

/* Swipe container - transparent on desktop, scrollable on mobile */
.pca-card-swipe-container {
    display: block; /* Default: no special behavior on desktop */
}

/* Excerpt slide - hidden on desktop */
.pca-card-excerpt-slide {
    display: none;
}

/* Mobile-specific styles - ONLY apply below 768px */
@media (max-width: 767px) {
    .pca-tour-card {
        display: block;
        position: relative;
        border-radius: 0 !important;
        overflow: hidden;
        background: transparent;
        box-shadow: none !important;
        transition: none;
    }

    /* === DISABLE IMAGE CAROUSEL ON MOBILE (Production Hardening) === */

    /* Single image only - no carousel behavior whatsoever */
    .pca-carousel-track {
        display: block !important;
        overflow: hidden !important;
        scroll-snap-type: none !important;
        touch-action: pan-y !important; /* Allow vertical scroll only - prevent horizontal interference */
        -webkit-touch-callout: none;
    }

    /* Hide all slides except first - single hero image only */
    .pca-carousel-slide:not(:first-child) {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        pointer-events: none !important;
    }

    /* Hide excerpt slide within carousel (excerpt moved to swipe container) */
    .pca-carousel-slide--excerpt {
        display: none !important;
    }

    /* Hide all carousel UI elements on mobile */
    .pca-carousel-dots,
    .pca-carousel-nav,
    .pca-carousel-nav--prev,
    .pca-carousel-nav--next {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* === HORIZONTAL SWIPE CONTAINER === */

    /* Container for side-by-side cards */
    .pca-card-swipe-container {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        /* REMOVED: -webkit-overflow-scrolling: touch; (deprecated, causes scroll jank) */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    /* Hide scrollbar */
    .pca-card-swipe-container::-webkit-scrollbar {
        display: none;
    }

    /* Both slides take EXACTLY full container width - no partial visibility */
    .pca-card-swipe-container > * {
        flex: 0 0 100%;
        min-width: 100%;
        width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* Main card link - ensure full width */
    .pca-card-swipe-container > .tour-card-link {
        flex: 0 0 100%;
        min-width: 100%;
        width: 100%;
    }

    /* === EXCERPT SLIDE STYLES === */

    /* Excerpt slide - same size as main card, completely hidden by default */
    .pca-card-excerpt-slide {
        display: flex;
        flex: 0 0 100%;
        min-width: 100%;
        width: 100%;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Excerpt slide content */
    .pca-excerpt-slide-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 20px;
        width: 100%;
        font-size: 15px;
        line-height: 1.6;
        color: #374151;
    }

    .pca-excerpt-slide-content p {
        margin: 0 0 16px;
        flex: 1;
        display: flex;
        align-items: center;
    }

    /* Explicit navigation link */
    .pca-excerpt-more-link {
        display: inline-block;
        padding: 12px 20px;
        font-weight: 600;
        font-size: 14px;
        color: #fff;
        background: #2563eb;
        text-decoration: none;
        border-radius: 8px;
        text-align: center;
        transition: background 0.2s ease;
    }

    .pca-excerpt-more-link:hover,
    .pca-excerpt-more-link:focus {
        background: #1d4ed8;
        color: #fff;
    }

    .pca-excerpt-more-link:focus-visible {
        outline: 2px solid #2563eb;
        outline-offset: 2px;
    }

    /* Reduced motion - instant scroll snap */
    @media (prefers-reduced-motion: reduce) {
        .pca-card-swipe-container {
            scroll-behavior: auto;
        }
    }

    .pca-tour-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Horizontal container - Reference layout with 12px padding */
    .pca-card-layout {
        display: flex;
        flex-direction: row;
        align-items: stretch !important; /* Force children to stretch */
        padding: 10px; /* Reduced from 12px */
        min-height: 180px; /* Reduced ~15% */
        gap: 10px; /* Reduced from 12px */
    }

    /* Left: Image container - Fixed width, stretch to full height */
    /* Override shared CSS height: 160px !important */
    .pca-card-layout figure.pca-card-carousel,
    .pca-card-layout .pca-card-carousel {
        flex: 0 0 140px !important;
        width: 140px !important;
        height: auto !important;
        max-height: none !important;
        min-height: 120px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border-radius: 8px !important;
        box-sizing: border-box;
        position: relative;
    }

    /* Carousel track fills figure - override shared max-height */
    .pca-card-layout .pca-carousel-track {
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
    }

    /* Slides fill track - override shared max-height */
    .pca-card-layout .pca-carousel-slide {
        width: 140px !important;
        height: 100% !important;
        max-height: none !important;
        position: absolute !important;
        top: 0;
        left: 0;
    }

    /* Image fills slide */
    .pca-card-layout .pca-carousel-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
        border-radius: 8px !important;
    }

    /* Ensure primary image fills container */
    .pca-image-primary {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
    }

    /* Hide hover image on mobile */
    .pca-image-hover {
        display: none;
    }

    /* Right: Content wrapper */
    .pca-card-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 4px 8px 4px 0; /* Reduced padding */
        min-width: 0; /* Allow text truncation */
        gap: 4px; /* Tighter spacing for compact layout */
    }

    /* Header: Rating FIRST, then Title (Reference layout) */
    /* Use .pca-tour-card prefix to override tour-card-shared.css specificity */
    .pca-tour-card .pca-card-header {
        margin-bottom: 0; /* Remove margin - flex handles spacing */
        padding: 0 !important; /* Override shared CSS 16px horizontal padding */
        flex: 0 0 auto; /* Don't grow, stay at top */
    }

    /* Star Rating - FIRST in header (Reference layout) */
    .pca-tour-rating {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 14px;
        /* margin handled by parent flex gap */
    }

    .tour-card-title {
        font-size: 18px; /* Increased from 16px */
        font-weight: 600;
        line-height: 1.25;
        color: #1a1a1a;
        margin: 0;
        min-height: 38px; /* Reduced for compact layout */

        /* Truncate to 2 lines on mobile */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        /* line-clamp handles truncation - no max-height needed */
    }

    .pca-rating-star {
        color: #F59E0B; /* Amber star - matches desktop for consistency */
        font-size: 16px;
        line-height: 1;
    }

    .pca-rating-value {
        font-weight: 600;
        color: #000;
    }

    .pca-rating-count {
        color: #6B7280; /* Gray-500 */
        font-weight: 400;
    }

    /* Body: Simplified trust signal, Duration, Price (Reference layout) */
    /* Use .pca-tour-card prefix to override tour-card-shared.css specificity */
    .pca-tour-card .pca-card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px !important; /* Compact spacing */
        padding: 0 !important; /* Remove inherited 16px bottom padding from shared CSS */
        /* Content flows naturally - no push to bottom */
    }

    /* Hide old badge/trust elements on mobile */
    .tour-badges,
    .tour-trust-text {
        display: none !important;
    }

    /* Show "Book now, pay later" badge on mobile */
    .tour-badges-mobile {
        display: block;
        /* REMOVED: margin-bottom: 6px - flex gap handles spacing */
    }

    .tour-badge-paylater {
        display: inline-block;
        font-size: 11px;
        padding: 4px 10px; /* Increased from 3px 8px for 24px+ touch target */
        background: #E8F5E9;
        color: #2E7D32;
        border-radius: 4px;
        font-weight: 500;
    }

    /* Trust signal - text only, no background */
    .tour-trust-simple {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 500;
        color: #6B7280; /* Gray text */
    }

    .tour-trust-simple svg {
        width: 12px;
        height: 12px;
        color: #6B7280; /* Gray checkmark */
        flex-shrink: 0;
    }

    /* Duration and Price row - Left aligned */
    .pca-tour-meta-price-row {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        margin-top: 2px;
        padding-top: 4px; /* Reduced for compact layout */
    }

    /* Review ratings (left side) - replacing duration */
    .pca-tour-rating-bottom {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 14px;
    }

    .pca-tour-rating-bottom .pca-rating-star {
        color: #F59E0B; /* Amber star - matches desktop for consistency */
        font-size: 14px;
        line-height: 1;
    }

    .pca-tour-rating-bottom .pca-rating-value {
        font-weight: 600;
        color: #000;
    }

    .pca-tour-rating-bottom .pca-rating-count {
        color: #6B7280;
        font-weight: 400;
    }

    /* Hide old meta row */
    .pca-tour-meta {
        display: none;
    }

    /* Price row - Left aligned */
    .pca-tour-price-row {
        display: flex;
        align-items: baseline;
        gap: 4px;
        margin-left: 0; /* Left aligned */
    }

    .tour-price-prefix {
        font-size: 14px;
        color: #6B7280;
        font-weight: 400;
    }

    .tour-price-amount {
        font-size: 18px;
        font-weight: 700;
        color: #000;
    }

    /* Hide desktop-only CTA button on mobile */
    .card-footer-cta {
        display: none;
    }
}

/* Seasonal/Featured badges on image */
.tour-badge-seasonal-overlay,
.tour-badge-featured-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    color: #fff;
    background: rgba(64, 85, 169, 0.95); /* Solid with opacity instead of blur (perf) */
    /* REMOVED: backdrop-filter: blur(4px); (causes scroll jank on mobile) */
    z-index: 2;
}

.tour-badge-featured-overlay {
    background: rgba(64, 85, 169, 0.95);
}

/* ============================================
   Tablet: Transition to Larger Layout (768px - 991px)
   ============================================ */

@media (min-width: 768px) {
    .pca-card-layout {
        min-height: 160px;
    }

    /* Slightly larger image on tablet */
    .pca-card-image {
        flex: 0 0 40%;
    }

    .pca-card-content {
        padding: 16px 18px;
    }

    .tour-card-title {
        font-size: 16px;
        -webkit-line-clamp: 3; /* Allow 3 lines on tablet */
    }

    .pca-tour-rating {
        font-size: 14px;
    }

    .pca-tour-meta {
        font-size: 14px;
    }

    .tour-price-amount {
        font-size: 20px;
    }

    /* Show trust text on tablet */
    .tour-trust-text {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px;
        font-size: 12px;
        color: #666;
    }

    .tour-trust-item {
        display: flex;
        align-items: center;
        gap: 2px;
    }
}

/* ============================================
   Desktop: Vertical Card Layout (992px+)
   ============================================ */

@media (min-width: 992px) {
    /* Switch to vertical layout */
    .pca-card-layout {
        flex-direction: column;
        min-height: auto;
    }

    /* Image full width on top */
    .pca-card-image {
        flex: 0 0 auto;
        aspect-ratio: 3 / 2;
        min-height: 200px;
    }

    /* Show hover image on desktop */
    .pca-image-hover {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .pca-card-image:hover .pca-image-hover {
        opacity: 1;
    }

    /* Content below image */
    .pca-card-content {
        padding: 20px;
    }

    .tour-card-title {
        font-size: 18px;
        -webkit-line-clamp: 2;
        margin-bottom: 10px;
    }

    .pca-tour-rating {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .pca-card-body {
        gap: 10px;
    }

    /* Show more badges on desktop */
    .tour-badges {
        gap: 8px;
        margin-bottom: 12px;
    }

    .tour-badge {
        display: inline-block;
        font-size: 13px;
        padding: 6px 12px;
    }

    .tour-trust-text {
        display: flex;
        font-size: 14px;
        gap: 8px;
    }

    .pca-tour-meta {
        font-size: 15px;
    }

    .pca-tour-price-row {
        gap: 6px;
        margin-top: 12px;
    }

    .tour-price-prefix {
        font-size: 14px;
    }

    .tour-price-amount {
        font-size: 24px;
    }

    /* Show CTA button on desktop */
    .card-footer-cta {
        display: block;
        padding: 16px 20px;
        border-top: 1px solid #eee;
        margin-top: auto;
    }

    .btn-check-availability {
        display: block;
        width: 100%;
        padding: 12px;
        background: var(--pca-primary, #0066cc);
        color: #fff;
        text-align: center;
        font-weight: 600;
        font-size: 15px;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .btn-check-availability:hover {
        background: var(--pca-primary-dark, #0052a3);
    }

    .tour-badge-seasonal-overlay,
    .tour-badge-featured-overlay {
        top: 12px;
        left: 12px;
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* ============================================
   Large Desktop: Extra spacing (1200px+)
   ============================================ */

@media (min-width: 1200px) {
    .pca-card-content {
        padding: 24px;
    }

    .tour-card-title {
        font-size: 19px;
    }

    .card-footer-cta {
        padding: 18px 24px;
    }
}

/* ============================================
   Accessibility & Touch Targets
   ============================================ */

/* Ensure minimum touch target size on mobile */
.full-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Focus states for keyboard navigation */
.full-card-link:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

/* Visually hidden class for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
