.custom-obituary-search-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 35px 40px;
    background: #fdf3f0; /* Standout warm tone (distinct from gray) */
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(109, 76, 65, 0.12); /* Warm shadow */
    border: 2px solid #8d6e63; /* Stronger theme-colored border */
    position: relative;
    overflow: hidden;
}

.custom-obituary-search-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #8d6e63;
}

.custom-obituary-search-container:hover {
    transform: translateY(-2px);
}

.custom-search-form {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.search-header {
    flex-shrink: 0;
    color: #4a4a4a;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-right: 2px solid #ddd;
    padding-right: 20px;
}

.search-input-group {
    flex-grow: 1;
    display: flex;
    align-items: center;
    position: relative;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #fff;
    padding: 5px 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.03);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.search-input-group:focus-within {
    border-color: #6d4c41; /* Brownish accent matching funeral themes */
    box-shadow: 0 8px 25px rgba(109, 76, 65, 0.15);
}

.search-icon {
    color: #bcaaa4;
    font-size: 1.2em;
    margin-right: 15px;
}

.custom-obituary-autocomplete {
    flex-grow: 1;
    border: none !important;
    padding: 15px 0 !important;
    font-size: 1.15em !important;
    color: #2e2e2e;
    font-family: 'Inter', sans-serif;
    background: transparent !important;
    width: 100%;
}

.custom-obituary-autocomplete::placeholder {
    color: #bdbdbd;
    font-style: italic;
    font-weight: 300;
}

.custom-obituary-autocomplete:focus {
    outline: none !important;
    box-shadow: none !important;
}

.search-submit-btn {
    background: #6d4c41;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.search-submit-btn:hover {
    background: #4e342e;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.search-loader {
    position: absolute;
    right: 70px;
    color: #6d4c41;
}

/* Autocomplete Dropdown Premium Styles */
.ui-autocomplete {
    background: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 45px rgba(0,0,0,0.15) !important;
    list-style: none !important;
    padding: 10px 0 !important;
    z-index: 99999 !important; /* Extremely high to be above fixed menus */
    margin-top: 5px !important;
    overflow: visible !important;
    animation: fadeInDown 0.3s ease-out;
    min-width: 500px !important; 
    max-height: 500px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Ensure the header dropdown is positioned correctly without breaking the parent menu */
.search-module-opened .ui-autocomplete {
    position: absolute !important;
    width: 550px !important;
}

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

.ui-menu-item {
    border-bottom: 1px solid #f9f9f9 !important;
    display: block !important;
    width: 100% !important;
}

.ui-menu-item:last-child {
    border-bottom: none !important;
}

.ui-menu-item-wrapper {
    padding: 0 !important; /* Let inner div handle padding */
    cursor: pointer !important;
    font-size: 1.1em !important;
    color: #444 !important;
    transition: all 0.2s ease !important;
    display: block !important;
    position: relative !important;
    overflow: visible !important;
}

.ui-menu-item-wrapper:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 6px;
    background: #6d4c41;
    transform: translateX(-6px);
    transition: transform 0.3s ease;
}

.ui-menu-item-wrapper.ui-state-active {
    background: #fdfaf8;
    color: #6d4c41;
    border: none;
    margin: 0;
    padding-left: 35px;
}

.ui-menu-item-wrapper.ui-state-active:before {
    transform: translateX(0);
}

/* Rich Preview Styles */
.search-res-item-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    width: 100% !important;
    min-height: 80px !important;
}

.search-res-img {
    flex-shrink: 0 !important;
    width: 80px !important;
    height: 80px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f8f8f8 !important;
    border: 1px solid #eee !important;
}

.search-res-img img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.no-img-placeholder {
    width: 100%;
    height: 100%;
    background: #eee;
}

.search-res-content {
    flex-grow: 1 !important;
    text-align: left !important;
}

.search-res-title {
    font-weight: 700 !important;
    color: #222 !important;
    margin: 0 0 5px 0 !important;
    font-size: 1.15em !important;
    line-height: 1.2 !important;
}

.search-loc-prefix {
    color: #8d6e63 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 0.7em !important;
    background: #fdf3f0 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    margin-right: 10px !important;
    display: inline-block !important;
}

.search-dates {
    font-size: 0.95em !important;
    color: #555 !important;
    margin-bottom: 3px !important;
    display: block !important;
}

.search-funeral-date {
    font-size: 0.9em !important;
    color: #8d6e63 !important;
    font-weight: 600 !important;
}

@media (max-width: 768px) {
    .custom-search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-header {
        border-right: none;
        border-bottom: 2px solid #ddd;
        padding-right: 0;
        padding-bottom: 15px;
        text-align: center;
        margin-bottom: 15px;
    }
}
