/* Specialized Hotel Search Drawer - Optimized for Mobile Performance */

/* Hotel Search Overlay - Lightweight */
.hotel-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    /* Optimize for mobile */
    -webkit-tap-highlight-color: transparent;
}

.hotel-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Hotel Search Drawer Container - Mobile-First Design */
.hotel-search-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    z-index: 2001;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.2s ease-out;
    /* Mobile optimizations */
    will-change: transform;
    backface-visibility: hidden;
    /* Reduce rendering complexity */
    contain: layout style paint;
    /* Ensure it's hidden initially */
    visibility: hidden;
    /* Ensure proper isolation */
    isolation: isolate;
}

.hotel-search-drawer.active {
    transform: translate3d(0, 0, 0);
    visibility: visible;
}

/* Search Header - Simplified */
.hotel-search-drawer .hotel-search-header {
    position: sticky;
    top: 0;
    background-color: #FFFFFF;
    border-bottom: 1px solid #F0F0F0;
    padding: 1rem;
    z-index: 10;
    /* Optimize header performance */
    contain: layout style;
}

.hotel-search-drawer .hotel-search-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.hotel-search-drawer .hotel-search-title {
    font-size: 18px;
    font-weight: 600;
    color: #2D3A45;
    margin: 0;
    flex: 1;
    text-align: left;
}

.hotel-search-drawer .hotel-search-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #757575;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Optimize button interactions */
    touch-action: manipulation;
}

.hotel-search-drawer .hotel-search-close:hover {
    background-color: #F5F5F5;
}

/* Search Input - Optimized */
.hotel-search-drawer .hotel-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #F8F9FA;
    border: 1px solid #E7E7E7;
    border-radius: 12px;
    padding: 12px 16px;
    /* Input performance optimizations */
    will-change: border-color;
}

.hotel-search-drawer .hotel-search-input-wrapper:focus-within {
    border-color: #FD6542;
    background-color: #FFFFFF;
}

.hotel-search-drawer .hotel-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px; /* Prevent zoom on iOS */
    font-weight: 500;
    color: #2D3A45;
    outline: none;
    /* Optimize input performance */
    will-change: auto;
}

.hotel-search-drawer .hotel-search-input::placeholder {
    color: #9CA4AB;
}

.hotel-search-drawer .hotel-search-icon {
    color: #757575;
    font-size: 18px;
}

/* Search Results - Lightweight */
.hotel-search-content {
    padding: 0;
    height: calc(100vh - 120px);
    overflow-y: auto;
    /* Mobile scrolling optimization */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Performance optimizations */
    contain: layout style;
    /* Safari bottom content fix */
    padding-bottom: env(safe-area-inset-bottom, 20px);
    margin-bottom: env(safe-area-inset-bottom, 0);
    /* Prevent content from being hidden behind bottom bars */
    max-height: -webkit-fill-available;
}

/* Results List - Simplified */
.search-results-list {
    padding: 0;
    margin: 0;
    list-style: none;
    /* Virtual scrolling preparation */
    contain: layout;
}

.search-result-item {
    border-bottom: 1px solid #F0F0F0;
    /* Optimize list items */
    contain: layout style;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-link {
    display: block;
    padding: 16px 20px;
    color: #2D3A45;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    /* Optimize link interactions */
    touch-action: manipulation;
    /* Reduce layout thrashing */
    will-change: background-color;
}

.search-result-link:active {
    background-color: #F0F0F0;
}

/* Remove hover effects on mobile for better performance */
@media (hover: none) {
    .search-result-link:hover {
        background-color: transparent;
    }
}

/* Only add hover on devices that support it */
@media (hover: hover) {
    .search-result-link:hover {
        background-color: #F8F9FA;
    }
}

.search-result-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #CCCCCC;
    font-size: 12px;
}

/* Popular Destinations Section */
.search-section {
    padding: 1rem 0;
}

.search-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #757575;
    margin: 0 0 0.5rem 0;
    padding: 0 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading and Error States */
.search-loading,
.search-error,
.search-empty {
    padding: 40px 20px;
    text-align: center;
    color: #757575;
    font-size: 14px;
}

.search-error {
    color: #FF6B6B;
}

.search-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

/* Highlight search terms */
.search-highlight {
    color: #FD6542;
    font-weight: 600;
    background-color: rgba(253, 101, 66, 0.1);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Tablet Optimizations (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .hotel-search-drawer {
        max-width: 600px;
        max-height: 85vh;
        left: 50%;
        top: 7.5vh;
        transform: translateX(-50%) translateY(-30px);
        border-radius: 16px;
        box-shadow: 0px 15px 60px 0px rgba(0, 0, 0, 0.15);
        opacity: 0;
        transition: transform 0.2s ease-out, opacity 0.2s ease;
    }
    
    .hotel-search-drawer.active {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    
    .hotel-search-drawer .hotel-search-header {
        padding: 1.25rem;
        border-radius: 16px 16px 0 0;
    }
    
    .hotel-search-drawer .hotel-search-title {
        font-size: 18px;
    }
    
    .hotel-search-drawer .hotel-search-input-wrapper {
        padding: 14px 18px;
        border-radius: 14px;
    }
    
    .search-result-link {
        padding: 15px 20px;
        font-size: 15px;
    }
    
    .hotel-search-content {
        height: auto;
        max-height: 60vh;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 767px) {
    .hotel-search-drawer .hotel-search-header {
        padding: 0.75rem 1rem;
    }
    
    .hotel-search-drawer .hotel-search-title {
        font-size: 16px;
    }
    
    .hotel-search-drawer .hotel-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-result-link {
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* Desktop and Laptop Optimizations (1024px+) */
@media (min-width: 1024px) {
    /* Desktop hotel search drawer - Modal style instead of fullscreen */
    .hotel-search-drawer {
        max-width: 700px;
        max-height: 80vh;
        left: 50%;
        top: 10vh;
        transform: translateX(-50%) translateY(-50px);
        border-radius: 20px;
        box-shadow: 0px 20px 80px 0px rgba(0, 0, 0, 0.2);
        transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.25s ease;
        opacity: 0;
    }
    
    .hotel-search-drawer.active {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    
    /* Desktop header optimization */
    .hotel-search-drawer .hotel-search-header {
        padding: 1.5rem;
        border-radius: 20px 20px 0 0;
    }
    
    .hotel-search-drawer .hotel-search-title {
        font-size: 20px;
    }
    
    .hotel-search-drawer .hotel-search-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    /* Desktop search input */
    .hotel-search-drawer .hotel-search-input-wrapper {
        padding: 16px 20px;
        border-radius: 16px;
    }
    
    .hotel-search-drawer .hotel-search-input {
        font-size: 16px;
    }
    
    /* Desktop search content */
    .hotel-search-content {
        height: auto;
        max-height: 50vh;
        padding: 0 0 1rem 0;
    }
    
    /* Desktop search results with hover effects */
    .search-result-link {
        padding: 16px 24px;
        font-size: 16px;
        transition: background-color 0.2s ease, transform 0.1s ease;
    }
    
    .search-result-link:hover {
        background-color: #F8F9FA;
        transform: translateX(4px);
    }
    
    .search-section-title {
        font-size: 16px;
        padding: 0 24px;
    }
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .hotel-search-drawer {
        max-width: 800px;
        max-height: 70vh;
    }
    
    .hotel-search-drawer .hotel-search-header {
        padding: 2rem;
    }
    
    .hotel-search-drawer .hotel-search-title {
        font-size: 22px;
    }
    
    .search-result-link {
        padding: 18px 28px;
        font-size: 17px;
    }
}

/* Low-end device optimizations */
@media (max-width: 480px) {
    /* Reduce animation complexity */
    .hotel-search-drawer {
        transition: transform 0.15s ease-out;
    }
    
    .hotel-search-overlay {
        transition: opacity 0.15s ease, visibility 0.15s ease;
    }
    
    /* Simplify interactions */
    .search-result-link {
        transition: none;
    }
    
    /* Reduce visual effects */
    .hotel-search-drawer .hotel-search-input-wrapper {
        box-shadow: none;
    }
}
