/* Mobile Search Section on Homepage */
.mobile-search {
    padding: 1rem;
    margin-top: 100px;
    z-index: 1;
    position: relative;
    width: 95%;
    max-width: 950px;
    margin-left: auto;
    margin-right: auto;
}

.mobile-search-container {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 1.5px solid #bbb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.mobile-search-container .search-icon {
    font-size: 1.3rem;
    color: #666;
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.mobile-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: #333;
    padding-left: 2.4rem;
    padding-right: 0.4rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.mobile-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.mobile-search-input::placeholder {
    color: #aaa;
}

@media (min-width: 768px) {
    .mobile-search {
        display: none;
    }
}

/* Mobile Search Modal Styles */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    /* Use dvh for the modal height */
    background-color: #fff;
    z-index: 99999999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s ease-out;
}

.mobile-search-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Modal Header */
.mobile-search-modal-header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    height: 90px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Modal Input Wrapper */
.mobile-search-modal-input-wrapper {
    flex: 1;
    position: relative;
    margin-right: 0.5rem;
}

.mobile-search-modal-input-wrapper .mobile-search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    padding-left: 2.8rem;
    padding-right: 3rem;
    /* Adjusted for clear button */
    border-radius: 8px;
    border: 1.5px solid #bbb;
    font-size: 1rem;
    background: #f0f0f0;
}

.mobile-search-modal-input-wrapper .search-icon {
    left: 1rem;
    font-size: 1.2rem;
    cursor: pointer;
}

.mobile-search-modal-input-wrapper .clear-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-out;
    padding: 5px;
}

.mobile-search-modal-input-wrapper .clear-search-icon.active {
    opacity: 1;
    pointer-events: auto;
}

/* Close Modal Button */
.close-modal-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #333;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-button:focus {
    outline: none;
}

/* Modal Search Results Container */
.mobile-search-modal-results {
    flex: 1;
    overflow-y: auto;
    padding-top: 0;
    padding-bottom: 3rem;
    /* Increased padding-bottom for more clearance */
    padding-left: 0;
    padding-right: 0;
    height: calc(100dvh - 90px);
    /* Calculate height using dvh, subtracting the header height */
    box-sizing: border-box;
    /* Include padding in the height calculation */
}

/* Search Results Category Title */
.mobile-search-modal-results .search-results-category-title {
    font-weight: 500;
    font-size: 1.1em;
    color: #000;
    padding: 10px 1.25rem 5px 1.25rem;
    margin-top: 0;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
}

/* Individual Search Result Item */
.mobile-search-modal-results .search-result-item {
    padding: 15px 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

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

.mobile-search-modal-results .search-result-item:hover {
    background-color: #f5f5f5;
}

/* Search Result Image */
.mobile-search-modal-results .search-result-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Search Result Info (Name, Location, Type) */
.mobile-search-modal-results .search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mobile-search-modal-results .search-result-name {
    font-weight: 600;
    color: #2e4a7d;
    margin-bottom: 0px;
    font-size: 16px;
}

.mobile-search-modal-results .search-result-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 0px;
}

.mobile-search-modal-results .search-result-type {
    font-size: 13px;
    color: #555;
    background-color: #e9e9e9;
    padding: 3px 10px;
    border-radius: 15px;
    display: inline-block;
    align-self: flex-start;
    font-weight: 500;
}

/* Search Result Highlight */
.mobile-search-modal-results .search-result-highlight {
    background-color: rgba(255, 230, 0, 0.3);
    font-weight: 500;
}

/* No Results Message */
.mobile-search-modal-results .no-results-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Changed to flex-start */
    height: 100%;
    padding: 20px 1.25rem;
    text-align: center;
    color: #666;
    font-style: normal;
    font-size: 1.1em;
    font-weight: 500;
    max-width: 90%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* No Results Icon - Subtle Style with Pulse */
.no-results-message .no-results-icon {
    font-size: 3em;
    margin-bottom: 10px;
    color: #999;
    animation: pulse 1.5s infinite ease-in-out;
}

/* Keyframes for Subtle Pulse Effect */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}


/* Results Counter */
.results-counter {
    text-align: center;
    padding: 15px 1.25rem;
    color: #555;
    font-size: 0.9em;
    margin-top: 10px;
    border-top: 1px solid #f0f0f0;
}

/* "Start Searching" Message Styles */
.start-searching-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Changed to flex-start */
    height: 100%;
    color: #aaa;
    font-size: 1.1em;
    text-align: center;
    padding-top: 20px;
}

.start-searching-message .search-icon-large {
    font-size: 3em;
    margin-bottom: 10px;
    animation: search-icon-sweep 4s infinite ease-in-out;
}

/* Keyframes for Search Icon Sweep Animation */
@keyframes search-icon-sweep {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.8;
    }

    25% {
        transform: translate(10px, -5px) rotate(10deg);
        /* Sweep right and up */
        opacity: 0.95;
    }

    50% {
        transform: translate(-10px, 5px) rotate(-10deg);
        /* Sweep left and down */
        opacity: 0.95;
    }

    75% {
        transform: translate(5px, -2px) rotate(5deg);
        /* Sweep back towards center-right */
        opacity: 0.9;
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
        /* Return to original */
        opacity: 0.8;
    }
}