/**
 * Homepage Hero Search Component Styles
 * Mobile-first, conversion-optimized hero section
 *
 * @package Traveler_Child
 * @since 1.0.0
 */

/* ==========================================================================
   Hero Container - Full Width Edge-to-Edge
   ========================================================================== */

.pca-hero-search {
    /* Break out of container constraints - Full width edge-to-edge */
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);

    /* Fixed height at 480px across all breakpoints */
    height: 480px;
    min-height: 480px;
    max-height: 480px;

    /* Flexbox for centering content */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;

    /* Proper box-sizing - prevents padding from expanding height */
    box-sizing: border-box;
    padding: 0; /* No padding on hero itself */

    /* Performance optimization */
    contain: layout style paint;
    isolation: isolate;
}

/* ==========================================================================
   Background & Overlay
   ========================================================================== */

.pca-hero-background {
    position: absolute;
    inset: 0;
    z-index: 1;

    /* Background image */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;

    /* Performance: GPU acceleration */
    transform: translateZ(0);
    will-change: transform;
}

/* Dark overlay for text readability - Directional gradient to black */
.pca-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(268deg, #00000000 34.23%, #000 97.86%);
    backdrop-filter: blur(1px);
}

/* ==========================================================================
   Content Container
   ========================================================================== */

.pca-hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem; /* Bootstrap-style padding: ~48px top/bottom, 24px sides */
    color: var(--hero-text-color, #ffffff);
    box-sizing: border-box;
}

.pca-hero-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    max-width: 800px;
}

/* Center alignment */
.pca-hero-content[data-alignment="center"] .pca-hero-inner {
    margin: 0 auto;
    text-align: center;
    align-items: center;
}

/* Left alignment */
.pca-hero-content[data-alignment="left"] .pca-hero-inner {
    margin: 0;
    text-align: left;
    align-items: flex-start;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.pca-hero-headline {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(24px, 5vw, 32px); /* Mobile responsive */
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0;
    color: inherit;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

    /* Smooth text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Desktop only - Override with design tokens (higher specificity to beat global h1 styles) */
@media (min-width: 992px) {
    .pca-hero-search .pca-hero-headline,
    h1.pca-hero-headline {
        font-family: var(--font-display) !important;
        font-weight: var(--weight-black) !important;  /* 900 from design tokens */
        font-size: var(--fs-hero) !important;         /* 36px from design tokens */
        line-height: 1.2 !important;
        letter-spacing: -0.01em !important;
    }
}

.pca-hero-subheadline {
    font-family: var(--font-body);
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: var(--weight-regular);
    line-height: var(--lh-body);
    margin: 0;
    color: inherit;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    max-width: 600px;
}

/* Helper Text - Hotel-first guidance */
.pca-hero-helper {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    max-width: 700px;
    margin-inline: auto;
}

@media (max-width: 480px) {
    .pca-hero-helper {
        font-size: 13px;
    }
}

/* ==========================================================================
   Search Form
   ========================================================================== */

.pca-hero-search-form {
    position: relative;
    width: 100%;
    max-width: 700px;
}

/* Ultra-specific selector to prevent override - PRODUCTION FIX */
.pca-hero-search .pca-hero-search-form .pca-search-input-wrapper {
    position: relative;
    display: flex !important; /* CRITICAL: Must be flex for order/flex-direction to work */
    align-items: stretch;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden; /* Restored: prevents button from overflowing container */
    transition: box-shadow 0.3s ease;
}

.pca-hero-search .pca-hero-search-form .pca-search-input-wrapper:focus-within {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15),
                0 0 0 4px rgba(255, 107, 0, 0.3);
}

/* Search Icon */
.pca-search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search Input */
.pca-search-input {
    width: 100%;
    padding: var(--space-md) 140px var(--space-md) calc(var(--space-md) + 32px); /* Right padding for button */
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    color: #555555 !important;
    border: 2px solid transparent;
    background: transparent;
    outline: none;
    min-height: 56px;
    border-radius: var(--radius-lg);

    /* Better mobile typing experience */
    font-size: 16px !important; /* Prevent zoom on iOS */
}

.pca-search-input::placeholder {
    color: var(--color-muted);
    opacity: 1;
}

.pca-search-input:focus {
    border-color: transparent;
}

/* Search Button (CTA) - Positioned inside input field on right */
.pca-hero-search .pca-search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 10px 24px;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--weight-semibold);
    color: #ffffff;
    background: #FF6B00;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
    height: 48px; /* Slightly smaller than input for visual inset */
    z-index: 10;
}

.pca-search-button:hover {
    background: #E55F00;
    transform: translateY(-50%) scale(1.02); /* Keep centered while scaling */
}

.pca-search-button:active {
    transform: translateY(-50%) scale(0.98); /* Keep centered while pressing */
}

.pca-search-button:focus-visible {
    outline: 3px solid rgba(255, 107, 0, 0.5);
    outline-offset: 2px;
}

.pca-search-button-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.pca-search-button:hover .pca-search-button-icon {
    transform: translateX(3px);
}

/* ==========================================================================
   Autocomplete Results
   ========================================================================== */

.pca-hero-search .pca-search-results {
    position: absolute;
    top: calc(100% + var(--space-xs));
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.pca-search-results[hidden] {
    display: none;
}

/* Results list styling - reuse existing autocomplete styles */
.pca-search-results .pca-results-list {
    list-style: none;
    margin: 0;
    padding: var(--space-xs);
}

.pca-search-results .pca-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: var(--color-body);
}

.pca-search-results .pca-result-item:hover,
.pca-search-results .pca-result-item:focus {
    background: var(--color-background-light);
}

.pca-search-results .pca-result-item[aria-selected="true"] {
    background: var(--color-background-muted);
}

/* Hotel-specific result styling */
.pca-search-results .pca-hotel-result {
    border-left: 3px solid #FF6B00;
    background: rgba(255, 107, 0, 0.05);
}

.pca-search-results .pca-hotel-result:hover {
    background: rgba(255, 107, 0, 0.1);
}

/* Hotel result icon */
.pca-search-results .pca-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

/* Pickup available badge */
.pca-pickup-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #10b981;
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
}

/* ==========================================================================
   Browse All Tours Link (Secondary CTA)
   ========================================================================== */

.pca-hero-browse-link {
    margin: 0.75rem 0 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.pca-hero-search .pca-browse-all-link {
    color: #FF6B00;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s ease, text-decoration 0.2s ease;
    border-bottom: 1px solid rgba(255, 107, 0, 0.5);
}

.pca-hero-search .pca-browse-all-link:hover {
    opacity: 0.9;
    text-decoration: none;
    border-bottom-color: #FF6B00;
    color: #FF6B00;
}

.pca-hero-search .pca-browse-all-link:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* ==========================================================================
   Trust Badge
   ========================================================================== */

.pca-hero-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--weight-medium);
    color: inherit;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);

    /* Subtle animation on mount */
    animation: fadeInUp 0.6s ease 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Category Quick Links
   ========================================================================== */

.pca-hero-categories {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    animation: fadeInUp 0.6s ease 0.4s both;
}

.pca-categories-label {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--weight-medium);
    color: inherit;
    opacity: 0.8;
}

.pca-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    list-style: none;
    margin: 0;
    padding: 0;
}

.pca-category-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--weight-medium);
    color: inherit;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pca-category-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.pca-category-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.pca-category-icon {
    font-size: 18px;
    line-height: 1;
}

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

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible styles for keyboard navigation */
.pca-hero-search *:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Mobile Portrait (320px - 479px) */
@media (max-width: 479px) {
    .pca-hero-search {
        height: 480px;
        min-height: 480px;
        max-height: 480px;
    }

    .pca-hero-content {
        padding: var(--space-lg) var(--space-md);
    }

    .pca-hero-inner {
        gap: var(--space-md);
    }

    .pca-hero-headline {
        /* Removed font-size - controlled by main rule + desktop media query */
    }

    .pca-hero-subheadline {
        font-size: 16px;
    }

    /* Stack search button BELOW input - UX Best Practice - PRODUCTION FIX */
    .pca-hero-search .pca-hero-search-form .pca-search-input-wrapper {
        display: flex !important; /* Ensure flex is active on mobile */
        flex-direction: column !important;
        gap: 0;
        border-radius: var(--radius-lg);
    }

    .pca-search-input {
        order: 1 !important;
        width: 100%;
        border: none;
        border-bottom: 1px solid #e5e7eb;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        padding: 16px var(--space-md) 16px calc(var(--space-md) + 32px);
        min-height: 56px;
    }

    .pca-search-button {
        position: static !important; /* Override absolute positioning from base rule */
        transform: none !important; /* Remove transform from base rule */
        order: 2 !important;
        width: 100%;
        min-height: 56px;
        padding: 16px var(--space-md);
        justify-content: center;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
        margin: 0 !important; /* Ensure no margin */
        right: auto !important; /* Remove right positioning */
        top: auto !important; /* Remove top positioning */
        box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05) inset;
    }

    .pca-search-button:active {
        transform: scale(0.98);
        background: #E55F00;
    }

    /* Search icon positioning adjustment */
    .pca-search-icon {
        top: 28px;
        transform: none;
    }

    /* Hide "Popular" label on very small screens */
    .pca-categories-label {
        display: none;
    }
}

/* Mobile Landscape / Small Tablet (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .pca-hero-search {
        height: 480px;
        min-height: 480px;
        max-height: 480px;
    }

    .pca-hero-headline {
        /* Removed font-size - controlled by main rule + desktop media query */
    }

    /* Stack search button BELOW input - UX Best Practice - PRODUCTION FIX */
    .pca-hero-search .pca-hero-search-form .pca-search-input-wrapper {
        display: flex !important; /* Ensure flex is active on mobile */
        flex-direction: column !important;
        gap: 0;
    }

    .pca-search-input {
        order: 1 !important;
        border: none;
        border-bottom: 1px solid #e5e7eb;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        padding: 18px var(--space-md) 18px calc(var(--space-md) + 32px);
    }

    .pca-search-button {
        position: static !important; /* Override absolute positioning from base rule */
        transform: none !important; /* Remove transform from base rule */
        order: 2 !important;
        width: 100%;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
        right: auto !important; /* Remove right positioning */
        top: auto !important; /* Remove top positioning */
        margin: 0 !important; /* Ensure no margin */
    }

    .pca-search-button-text {
        display: inline; /* Show text on larger screens */
    }
}

/* Tablet & Desktop (768px+) - Responsive height with breakpoints */
@media (min-width: 768px) {
    .pca-hero-search {
        height: 480px;
        min-height: 480px;
        max-height: 480px;
    }

    .pca-hero-content {
        padding: var(--space-2xl) var(--space-xl);
    }

    .pca-hero-inner {
        gap: var(--space-xl);
    }

    .pca-hero-headline {
        /* Removed font-size - controlled by main rule + desktop media query */
    }

    .pca-hero-subheadline {
        font-size: 20px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .pca-hero-search {
        height: 480px;
        min-height: 480px;
        max-height: 480px;
    }

    .pca-hero-headline {
        /* Removed font-size - controlled by main rule + desktop media query */
    }

    /* Hover effects removed - no background zoom */
}

/* Ultra-wide screens (1400px+) */
@media (min-width: 1400px) {
    .pca-hero-content {
        padding: var(--space-2xl) 0;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .pca-hero-search {
        min-height: auto;
        page-break-inside: avoid;
    }

    .pca-hero-background,
    .pca-hero-overlay {
        display: none;
    }

    .pca-hero-content {
        color: #000000;
        padding: var(--space-md);
    }

    .pca-hero-search-form,
    .pca-hero-categories {
        display: none;
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* Reduce motion for users with motion sensitivity */
@media (prefers-reduced-motion: reduce) {
    .pca-hero-search *,
    .pca-hero-search *::before,
    .pca-hero-search *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .pca-hero-background {
        transform: none !important;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.pca-search-results.pca-loading {
    pointer-events: none;
}

.pca-search-results.pca-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Skeleton loading animation for search results */
.pca-skeleton-item {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
